diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 6648074ea50..07018996409 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -46,10 +46,6 @@ jobs: ASSISTANT_WORKSPACE_ID: ${{ secrets.WA_WORKSPACE_ID }} ASSISTANT_ASSISTANT_ID: ${{ secrets.WA_ASSISTANT_ID }} ASSISTANT_URL: "https://api.us-south.assistant.watson.cloud.ibm.com" - DISCOVERY_APIKEY: ${{ secrets.D1_APIKEY }} - DISCOVERY_ENVIRONMENT_ID: ${{ secrets.D1_ENVIRONMENT_ID }} - DISCOVERY_COLLECTION_ID: ${{ secrets.D1_COLLECTION_ID }} - DISCOVERY_URL: "https://api.us-south.discovery.watson.cloud.ibm.com" DISCOVERY_V2_APIKEY: ${{ secrets.D2_APIKEY }} DISCOVERY_V2_PROJECT_ID: ${{ secrets.D2_PROJECT_ID }} DISCOVERY_V2_COLLECTION_ID: ${{ secrets.D2_COLLECTION_ID }} @@ -57,7 +53,6 @@ jobs: run: | mvn test -Dtest=v1/AssistantServiceIT -DfailIfNoTests=false -pl assistant,common $MVN_ARGS mvn test -Dtest=v2/AssistantServiceIT -DfailIfNoTests=false -pl assistant,common $MVN_ARGS - mvn test -Dtest=v1/DiscoveryServiceIT -DfailIfNoTests=false -pl discovery,common $MVN_ARGS mvn test -Dtest=v2/DiscoveryIT -DfailIfNoTests=false -pl discovery,common $MVN_ARGS mvn test -Dtest=LanguageTranslatorIT -DfailIfNoTests=false -pl language-translator,common $MVN_ARGS mvn test -Dtest=NaturalLanguageUnderstandingIT -DfailIfNoTests=false -pl natural-language-understanding,common $MVN_ARGS diff --git a/discovery/README.md b/discovery/README.md index 32f9b9b236c..57c67082e82 100644 --- a/discovery/README.md +++ b/discovery/README.md @@ -20,23 +20,9 @@ ## Usage -This SDK supports both the Discovery v1 and v2 APIs. +This SDK supports the Discovery v2 APIs. -Otherwise, the APIs are fairly similar, offering the ability to manage collections of documents and query them for insights. You can learn more about the Discovery service [here](https://cloud.ibm.com/docs/discovery?topic=discovery-gs-api). - -### Using Discovery v1 - -```java -// Make sure to use the Discovery v1 import! -Authenticator authenticator = new IamAuthenticator(""); -Discovery discovery = new Discovery("2019-04-30", authenticator); - -//Build an empty query on an existing environment/collection -String environmentId = ""; -String collectionId = ""; -QueryOptions queryOptions = new QueryOptions.Builder(environmentId, collectionId).build(); -QueryResponse queryResponse = discovery.query(queryOptions).execute().getResult(); -``` +Otherwise, the APIs are fairly similar, offering the ability to manage collections of documents and query them for insights. You can learn more about the Discovery service [here](https://cloud.ibm.com/apidocs/discovery-data). ### Using Discovery v2 diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java deleted file mode 100644 index f80bc008fad..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/Discovery.java +++ /dev/null @@ -1,2943 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -/* - * IBM OpenAPI SDK Code Generator Version: 3.64.1-cee95189-20230124-211647 - */ - -package com.ibm.watson.discovery.v1; - -import com.google.gson.JsonObject; -import com.ibm.cloud.sdk.core.http.RequestBuilder; -import com.ibm.cloud.sdk.core.http.ResponseConverter; -import com.ibm.cloud.sdk.core.http.ServiceCall; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.ConfigBasedAuthenticatorFactory; -import com.ibm.cloud.sdk.core.service.BaseService; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.cloud.sdk.core.util.RequestUtils; -import com.ibm.cloud.sdk.core.util.ResponseConverterUtils; -import com.ibm.watson.common.SdkCommon; -import com.ibm.watson.discovery.v1.model.AddDocumentOptions; -import com.ibm.watson.discovery.v1.model.AddTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.Collection; -import com.ibm.watson.discovery.v1.model.Completions; -import com.ibm.watson.discovery.v1.model.Configuration; -import com.ibm.watson.discovery.v1.model.CreateCollectionOptions; -import com.ibm.watson.discovery.v1.model.CreateConfigurationOptions; -import com.ibm.watson.discovery.v1.model.CreateCredentialsOptions; -import com.ibm.watson.discovery.v1.model.CreateEnvironmentOptions; -import com.ibm.watson.discovery.v1.model.CreateEventOptions; -import com.ibm.watson.discovery.v1.model.CreateEventResponse; -import com.ibm.watson.discovery.v1.model.CreateExpansionsOptions; -import com.ibm.watson.discovery.v1.model.CreateGatewayOptions; -import com.ibm.watson.discovery.v1.model.CreateStopwordListOptions; -import com.ibm.watson.discovery.v1.model.CreateTokenizationDictionaryOptions; -import com.ibm.watson.discovery.v1.model.CreateTrainingExampleOptions; -import com.ibm.watson.discovery.v1.model.Credentials; -import com.ibm.watson.discovery.v1.model.CredentialsList; -import com.ibm.watson.discovery.v1.model.DeleteAllTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.DeleteCollectionOptions; -import com.ibm.watson.discovery.v1.model.DeleteCollectionResponse; -import com.ibm.watson.discovery.v1.model.DeleteConfigurationOptions; -import com.ibm.watson.discovery.v1.model.DeleteConfigurationResponse; -import com.ibm.watson.discovery.v1.model.DeleteCredentials; -import com.ibm.watson.discovery.v1.model.DeleteCredentialsOptions; -import com.ibm.watson.discovery.v1.model.DeleteDocumentOptions; -import com.ibm.watson.discovery.v1.model.DeleteDocumentResponse; -import com.ibm.watson.discovery.v1.model.DeleteEnvironmentOptions; -import com.ibm.watson.discovery.v1.model.DeleteEnvironmentResponse; -import com.ibm.watson.discovery.v1.model.DeleteExpansionsOptions; -import com.ibm.watson.discovery.v1.model.DeleteGatewayOptions; -import com.ibm.watson.discovery.v1.model.DeleteStopwordListOptions; -import com.ibm.watson.discovery.v1.model.DeleteTokenizationDictionaryOptions; -import com.ibm.watson.discovery.v1.model.DeleteTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.DeleteTrainingExampleOptions; -import com.ibm.watson.discovery.v1.model.DeleteUserDataOptions; -import com.ibm.watson.discovery.v1.model.DocumentAccepted; -import com.ibm.watson.discovery.v1.model.DocumentStatus; -import com.ibm.watson.discovery.v1.model.Environment; -import com.ibm.watson.discovery.v1.model.Expansions; -import com.ibm.watson.discovery.v1.model.FederatedQueryNoticesOptions; -import com.ibm.watson.discovery.v1.model.FederatedQueryOptions; -import com.ibm.watson.discovery.v1.model.Gateway; -import com.ibm.watson.discovery.v1.model.GatewayDelete; -import com.ibm.watson.discovery.v1.model.GatewayList; -import com.ibm.watson.discovery.v1.model.GetAutocompletionOptions; -import com.ibm.watson.discovery.v1.model.GetCollectionOptions; -import com.ibm.watson.discovery.v1.model.GetConfigurationOptions; -import com.ibm.watson.discovery.v1.model.GetCredentialsOptions; -import com.ibm.watson.discovery.v1.model.GetDocumentStatusOptions; -import com.ibm.watson.discovery.v1.model.GetEnvironmentOptions; -import com.ibm.watson.discovery.v1.model.GetGatewayOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsEventRateOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsQueryEventOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsQueryNoResultsOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsQueryOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsQueryTokenEventOptions; -import com.ibm.watson.discovery.v1.model.GetStopwordListStatusOptions; -import com.ibm.watson.discovery.v1.model.GetTokenizationDictionaryStatusOptions; -import com.ibm.watson.discovery.v1.model.GetTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.GetTrainingExampleOptions; -import com.ibm.watson.discovery.v1.model.ListCollectionFieldsOptions; -import com.ibm.watson.discovery.v1.model.ListCollectionFieldsResponse; -import com.ibm.watson.discovery.v1.model.ListCollectionsOptions; -import com.ibm.watson.discovery.v1.model.ListCollectionsResponse; -import com.ibm.watson.discovery.v1.model.ListConfigurationsOptions; -import com.ibm.watson.discovery.v1.model.ListConfigurationsResponse; -import com.ibm.watson.discovery.v1.model.ListCredentialsOptions; -import com.ibm.watson.discovery.v1.model.ListEnvironmentsOptions; -import com.ibm.watson.discovery.v1.model.ListEnvironmentsResponse; -import com.ibm.watson.discovery.v1.model.ListExpansionsOptions; -import com.ibm.watson.discovery.v1.model.ListFieldsOptions; -import com.ibm.watson.discovery.v1.model.ListGatewaysOptions; -import com.ibm.watson.discovery.v1.model.ListTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.ListTrainingExamplesOptions; -import com.ibm.watson.discovery.v1.model.LogQueryResponse; -import com.ibm.watson.discovery.v1.model.MetricResponse; -import com.ibm.watson.discovery.v1.model.MetricTokenResponse; -import com.ibm.watson.discovery.v1.model.QueryLogOptions; -import com.ibm.watson.discovery.v1.model.QueryNoticesOptions; -import com.ibm.watson.discovery.v1.model.QueryNoticesResponse; -import com.ibm.watson.discovery.v1.model.QueryOptions; -import com.ibm.watson.discovery.v1.model.QueryResponse; -import com.ibm.watson.discovery.v1.model.TokenDictStatusResponse; -import com.ibm.watson.discovery.v1.model.TrainingDataSet; -import com.ibm.watson.discovery.v1.model.TrainingExample; -import com.ibm.watson.discovery.v1.model.TrainingExampleList; -import com.ibm.watson.discovery.v1.model.TrainingQuery; -import com.ibm.watson.discovery.v1.model.UpdateCollectionOptions; -import com.ibm.watson.discovery.v1.model.UpdateConfigurationOptions; -import com.ibm.watson.discovery.v1.model.UpdateCredentialsOptions; -import com.ibm.watson.discovery.v1.model.UpdateDocumentOptions; -import com.ibm.watson.discovery.v1.model.UpdateEnvironmentOptions; -import com.ibm.watson.discovery.v1.model.UpdateTrainingExampleOptions; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import okhttp3.MultipartBody; - -/** - * IBM Watson™ Discovery v1 is a cognitive search and content analytics engine that you - * can add to applications to identify patterns, trends and actionable insights to drive better - * decision-making. Securely unify structured and unstructured data with pre-enriched content, and - * use a simplified query language to eliminate the need for manual filtering of results. - * - *

API Version: 1.0 See: https://cloud.ibm.com/docs/discovery - */ -public class Discovery extends BaseService { - - /** Default service name used when configuring the `Discovery` client. */ - public static final String DEFAULT_SERVICE_NAME = "discovery"; - - /** Default service endpoint URL. */ - public static final String DEFAULT_SERVICE_URL = - "https://api.us-south.discovery.watson.cloud.ibm.com"; - - private String version; - - /** - * Constructs an instance of the `Discovery` client. The default service name is used to configure - * the client instance. - * - * @param version Release date of the version of the API you want to use. Specify dates in - * YYYY-MM-DD format. The current version is `2019-04-30`. - */ - public Discovery(String version) { - this( - version, - DEFAULT_SERVICE_NAME, - ConfigBasedAuthenticatorFactory.getAuthenticator(DEFAULT_SERVICE_NAME)); - } - - /** - * Constructs an instance of the `Discovery` client. The default service name and specified - * authenticator are used to configure the client instance. - * - * @param version Release date of the version of the API you want to use. Specify dates in - * YYYY-MM-DD format. The current version is `2019-04-30`. - * @param authenticator the {@link Authenticator} instance to be configured for this client - */ - public Discovery(String version, Authenticator authenticator) { - this(version, DEFAULT_SERVICE_NAME, authenticator); - } - - /** - * Constructs an instance of the `Discovery` client. The specified service name is used to - * configure the client instance. - * - * @param version Release date of the version of the API you want to use. Specify dates in - * YYYY-MM-DD format. The current version is `2019-04-30`. - * @param serviceName the service name to be used when configuring the client instance - */ - public Discovery(String version, String serviceName) { - this(version, serviceName, ConfigBasedAuthenticatorFactory.getAuthenticator(serviceName)); - } - - /** - * Constructs an instance of the `Discovery` client. The specified service name and authenticator - * are used to configure the client instance. - * - * @param version Release date of the version of the API you want to use. Specify dates in - * YYYY-MM-DD format. The current version is `2019-04-30`. - * @param serviceName the service name to be used when configuring the client instance - * @param authenticator the {@link Authenticator} instance to be configured for this client - */ - public Discovery(String version, String serviceName, Authenticator authenticator) { - super(serviceName, authenticator); - setServiceUrl(DEFAULT_SERVICE_URL); - setVersion(version); - this.configureService(serviceName); - } - - /** - * Gets the version. - * - *

Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. - * The current version is `2019-04-30`. - * - * @return the version - */ - public String getVersion() { - return this.version; - } - - /** - * Sets the version. - * - * @param version the new version - */ - public void setVersion(final String version) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty(version, "version cannot be empty."); - this.version = version; - } - - /** - * Create an environment. - * - *

Creates a new environment for private data. An environment must be created before - * collections can be created. - * - *

**Note**: You can create only one environment for private data per service instance. An - * attempt to create another environment results in an error. - * - * @param createEnvironmentOptions the {@link CreateEnvironmentOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link Environment} - */ - public ServiceCall createEnvironment( - CreateEnvironmentOptions createEnvironmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createEnvironmentOptions, "createEnvironmentOptions cannot be null"); - RequestBuilder builder = - RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/environments")); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "createEnvironment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createEnvironmentOptions.name()); - if (createEnvironmentOptions.description() != null) { - contentJson.addProperty("description", createEnvironmentOptions.description()); - } - if (createEnvironmentOptions.size() != null) { - contentJson.addProperty("size", createEnvironmentOptions.size()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List environments. - * - *

List existing environments for the service instance. - * - * @param listEnvironmentsOptions the {@link ListEnvironmentsOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link ListEnvironmentsResponse} - */ - public ServiceCall listEnvironments( - ListEnvironmentsOptions listEnvironmentsOptions) { - if (listEnvironmentsOptions == null) { - listEnvironmentsOptions = new ListEnvironmentsOptions.Builder().build(); - } - RequestBuilder builder = - RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/environments")); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listEnvironments"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - if (listEnvironmentsOptions.name() != null) { - builder.query("name", String.valueOf(listEnvironmentsOptions.name())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List environments. - * - *

List existing environments for the service instance. - * - * @return a {@link ServiceCall} with a result of type {@link ListEnvironmentsResponse} - */ - public ServiceCall listEnvironments() { - return listEnvironments(null); - } - - /** - * Get environment info. - * - * @param getEnvironmentOptions the {@link GetEnvironmentOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link Environment} - */ - public ServiceCall getEnvironment(GetEnvironmentOptions getEnvironmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getEnvironmentOptions, "getEnvironmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", getEnvironmentOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/environments/{environment_id}", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getEnvironment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update an environment. - * - *

Updates an environment. The environment's **name** and **description** parameters can be - * changed. You must specify a **name** for the environment. - * - * @param updateEnvironmentOptions the {@link UpdateEnvironmentOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link Environment} - */ - public ServiceCall updateEnvironment( - UpdateEnvironmentOptions updateEnvironmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - updateEnvironmentOptions, "updateEnvironmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", updateEnvironmentOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.put( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/environments/{environment_id}", pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "updateEnvironment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - if (updateEnvironmentOptions.name() != null) { - contentJson.addProperty("name", updateEnvironmentOptions.name()); - } - if (updateEnvironmentOptions.description() != null) { - contentJson.addProperty("description", updateEnvironmentOptions.description()); - } - if (updateEnvironmentOptions.size() != null) { - contentJson.addProperty("size", updateEnvironmentOptions.size()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete environment. - * - * @param deleteEnvironmentOptions the {@link DeleteEnvironmentOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link DeleteEnvironmentResponse} - */ - public ServiceCall deleteEnvironment( - DeleteEnvironmentOptions deleteEnvironmentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteEnvironmentOptions, "deleteEnvironmentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", deleteEnvironmentOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/environments/{environment_id}", pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "deleteEnvironment"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List fields across collections. - * - *

Gets a list of the unique fields (and their types) stored in the indexes of the specified - * collections. - * - * @param listFieldsOptions the {@link ListFieldsOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link ListCollectionFieldsResponse} - */ - public ServiceCall listFields(ListFieldsOptions listFieldsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listFieldsOptions, "listFieldsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", listFieldsOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/environments/{environment_id}/fields", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listFields"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - builder.query("collection_ids", RequestUtils.join(listFieldsOptions.collectionIds(), ",")); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Add configuration. - * - *

Creates a new configuration. - * - *

If the input configuration contains the **configuration_id**, **created**, or **updated** - * properties, then they are ignored and overridden by the system, and an error is not returned so - * that the overridden fields do not need to be removed when copying a configuration. - * - *

The configuration can contain unrecognized JSON fields. Any such fields are ignored and do - * not generate an error. This makes it easier to use newer configuration files with older - * versions of the API and the service. It also makes it possible for the tooling to add - * additional metadata and information to the configuration. - * - * @param createConfigurationOptions the {@link CreateConfigurationOptions} containing the options - * for the call - * @return a {@link ServiceCall} with a result of type {@link Configuration} - */ - public ServiceCall createConfiguration( - CreateConfigurationOptions createConfigurationOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createConfigurationOptions, "createConfigurationOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", createConfigurationOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/configurations", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "createConfiguration"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createConfigurationOptions.name()); - if (createConfigurationOptions.description() != null) { - contentJson.addProperty("description", createConfigurationOptions.description()); - } - if (createConfigurationOptions.conversions() != null) { - contentJson.add( - "conversions", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(createConfigurationOptions.conversions())); - } - if (createConfigurationOptions.enrichments() != null) { - contentJson.add( - "enrichments", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(createConfigurationOptions.enrichments())); - } - if (createConfigurationOptions.normalizations() != null) { - contentJson.add( - "normalizations", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(createConfigurationOptions.normalizations())); - } - if (createConfigurationOptions.source() != null) { - contentJson.add( - "source", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(createConfigurationOptions.source())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List configurations. - * - *

Lists existing configurations for the service instance. - * - * @param listConfigurationsOptions the {@link ListConfigurationsOptions} containing the options - * for the call - * @return a {@link ServiceCall} with a result of type {@link ListConfigurationsResponse} - */ - public ServiceCall listConfigurations( - ListConfigurationsOptions listConfigurationsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listConfigurationsOptions, "listConfigurationsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", listConfigurationsOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/configurations", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "listConfigurations"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - if (listConfigurationsOptions.name() != null) { - builder.query("name", String.valueOf(listConfigurationsOptions.name())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get configuration details. - * - * @param getConfigurationOptions the {@link GetConfigurationOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link Configuration} - */ - public ServiceCall getConfiguration( - GetConfigurationOptions getConfigurationOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getConfigurationOptions, "getConfigurationOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", getConfigurationOptions.environmentId()); - pathParamsMap.put("configuration_id", getConfigurationOptions.configurationId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/configurations/{configuration_id}", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getConfiguration"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a configuration. - * - *

Replaces an existing configuration. * Completely replaces the original configuration. * The - * **configuration_id**, **updated**, and **created** fields are accepted in the request, but they - * are ignored, and an error is not generated. It is also acceptable for users to submit an - * updated configuration with none of the three properties. * Documents are processed with a - * snapshot of the configuration as it was at the time the document was submitted to be ingested. - * This means that already submitted documents will not see any updates made to the configuration. - * - * @param updateConfigurationOptions the {@link UpdateConfigurationOptions} containing the options - * for the call - * @return a {@link ServiceCall} with a result of type {@link Configuration} - */ - public ServiceCall updateConfiguration( - UpdateConfigurationOptions updateConfigurationOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - updateConfigurationOptions, "updateConfigurationOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", updateConfigurationOptions.environmentId()); - pathParamsMap.put("configuration_id", updateConfigurationOptions.configurationId()); - RequestBuilder builder = - RequestBuilder.put( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/configurations/{configuration_id}", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "updateConfiguration"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", updateConfigurationOptions.name()); - if (updateConfigurationOptions.description() != null) { - contentJson.addProperty("description", updateConfigurationOptions.description()); - } - if (updateConfigurationOptions.conversions() != null) { - contentJson.add( - "conversions", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(updateConfigurationOptions.conversions())); - } - if (updateConfigurationOptions.enrichments() != null) { - contentJson.add( - "enrichments", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(updateConfigurationOptions.enrichments())); - } - if (updateConfigurationOptions.normalizations() != null) { - contentJson.add( - "normalizations", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(updateConfigurationOptions.normalizations())); - } - if (updateConfigurationOptions.source() != null) { - contentJson.add( - "source", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(updateConfigurationOptions.source())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a configuration. - * - *

The deletion is performed unconditionally. A configuration deletion request succeeds even if - * the configuration is referenced by a collection or document ingestion. However, documents that - * have already been submitted for processing continue to use the deleted configuration. Documents - * are always processed with a snapshot of the configuration as it existed at the time the - * document was submitted. - * - * @param deleteConfigurationOptions the {@link DeleteConfigurationOptions} containing the options - * for the call - * @return a {@link ServiceCall} with a result of type {@link DeleteConfigurationResponse} - */ - public ServiceCall deleteConfiguration( - DeleteConfigurationOptions deleteConfigurationOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteConfigurationOptions, "deleteConfigurationOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", deleteConfigurationOptions.environmentId()); - pathParamsMap.put("configuration_id", deleteConfigurationOptions.configurationId()); - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/configurations/{configuration_id}", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "deleteConfiguration"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create a collection. - * - * @param createCollectionOptions the {@link CreateCollectionOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link Collection} - */ - public ServiceCall createCollection(CreateCollectionOptions createCollectionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createCollectionOptions, "createCollectionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", createCollectionOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/environments/{environment_id}/collections", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createCollection"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", createCollectionOptions.name()); - if (createCollectionOptions.description() != null) { - contentJson.addProperty("description", createCollectionOptions.description()); - } - if (createCollectionOptions.configurationId() != null) { - contentJson.addProperty("configuration_id", createCollectionOptions.configurationId()); - } - if (createCollectionOptions.language() != null) { - contentJson.addProperty("language", createCollectionOptions.language()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List collections. - * - *

Lists existing collections for the service instance. - * - * @param listCollectionsOptions the {@link ListCollectionsOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link ListCollectionsResponse} - */ - public ServiceCall listCollections( - ListCollectionsOptions listCollectionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listCollectionsOptions, "listCollectionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", listCollectionsOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/environments/{environment_id}/collections", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listCollections"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - if (listCollectionsOptions.name() != null) { - builder.query("name", String.valueOf(listCollectionsOptions.name())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get collection details. - * - * @param getCollectionOptions the {@link GetCollectionOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link Collection} - */ - public ServiceCall getCollection(GetCollectionOptions getCollectionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getCollectionOptions, "getCollectionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", getCollectionOptions.environmentId()); - pathParamsMap.put("collection_id", getCollectionOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getCollection"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a collection. - * - * @param updateCollectionOptions the {@link UpdateCollectionOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link Collection} - */ - public ServiceCall updateCollection(UpdateCollectionOptions updateCollectionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - updateCollectionOptions, "updateCollectionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", updateCollectionOptions.environmentId()); - pathParamsMap.put("collection_id", updateCollectionOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.put( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "updateCollection"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("name", updateCollectionOptions.name()); - if (updateCollectionOptions.description() != null) { - contentJson.addProperty("description", updateCollectionOptions.description()); - } - if (updateCollectionOptions.configurationId() != null) { - contentJson.addProperty("configuration_id", updateCollectionOptions.configurationId()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a collection. - * - * @param deleteCollectionOptions the {@link DeleteCollectionOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link DeleteCollectionResponse} - */ - public ServiceCall deleteCollection( - DeleteCollectionOptions deleteCollectionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteCollectionOptions, "deleteCollectionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", deleteCollectionOptions.environmentId()); - pathParamsMap.put("collection_id", deleteCollectionOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "deleteCollection"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List collection fields. - * - *

Gets a list of the unique fields (and their types) stored in the index. - * - * @param listCollectionFieldsOptions the {@link ListCollectionFieldsOptions} containing the - * options for the call - * @return a {@link ServiceCall} with a result of type {@link ListCollectionFieldsResponse} - */ - public ServiceCall listCollectionFields( - ListCollectionFieldsOptions listCollectionFieldsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listCollectionFieldsOptions, "listCollectionFieldsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", listCollectionFieldsOptions.environmentId()); - pathParamsMap.put("collection_id", listCollectionFieldsOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/fields", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "listCollectionFields"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get the expansion list. - * - *

Returns the current expansion list for the specified collection. If an expansion list is not - * specified, an object with empty expansion arrays is returned. - * - * @param listExpansionsOptions the {@link ListExpansionsOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link Expansions} - */ - public ServiceCall listExpansions(ListExpansionsOptions listExpansionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listExpansionsOptions, "listExpansionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", listExpansionsOptions.environmentId()); - pathParamsMap.put("collection_id", listExpansionsOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/expansions", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listExpansions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create or update expansion list. - * - *

Create or replace the Expansion list for this collection. The maximum number of expanded - * terms per collection is `500`. The current expansion list is replaced with the uploaded - * content. - * - * @param createExpansionsOptions the {@link CreateExpansionsOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link Expansions} - */ - public ServiceCall createExpansions(CreateExpansionsOptions createExpansionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createExpansionsOptions, "createExpansionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", createExpansionsOptions.environmentId()); - pathParamsMap.put("collection_id", createExpansionsOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/expansions", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createExpansions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - contentJson.add( - "expansions", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(createExpansionsOptions.expansions())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete the expansion list. - * - *

Remove the expansion information for this collection. The expansion list must be deleted to - * disable query expansion for a collection. - * - * @param deleteExpansionsOptions the {@link DeleteExpansionsOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteExpansions(DeleteExpansionsOptions deleteExpansionsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteExpansionsOptions, "deleteExpansionsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", deleteExpansionsOptions.environmentId()); - pathParamsMap.put("collection_id", deleteExpansionsOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/expansions", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "deleteExpansions"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get tokenization dictionary status. - * - *

Returns the current status of the tokenization dictionary for the specified collection. - * - * @param getTokenizationDictionaryStatusOptions the {@link - * GetTokenizationDictionaryStatusOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TokenDictStatusResponse} - */ - public ServiceCall getTokenizationDictionaryStatus( - GetTokenizationDictionaryStatusOptions getTokenizationDictionaryStatusOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getTokenizationDictionaryStatusOptions, - "getTokenizationDictionaryStatusOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", getTokenizationDictionaryStatusOptions.environmentId()); - pathParamsMap.put("collection_id", getTokenizationDictionaryStatusOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/word_lists/tokenization_dictionary", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "getTokenizationDictionaryStatus"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create tokenization dictionary. - * - *

Upload a custom tokenization dictionary to use with the specified collection. - * - * @param createTokenizationDictionaryOptions the {@link CreateTokenizationDictionaryOptions} - * containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link TokenDictStatusResponse} - */ - public ServiceCall createTokenizationDictionary( - CreateTokenizationDictionaryOptions createTokenizationDictionaryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createTokenizationDictionaryOptions, "createTokenizationDictionaryOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", createTokenizationDictionaryOptions.environmentId()); - pathParamsMap.put("collection_id", createTokenizationDictionaryOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/word_lists/tokenization_dictionary", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "createTokenizationDictionary"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - if (createTokenizationDictionaryOptions.tokenizationRules() != null) { - contentJson.add( - "tokenization_rules", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(createTokenizationDictionaryOptions.tokenizationRules())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete tokenization dictionary. - * - *

Delete the tokenization dictionary from the collection. - * - * @param deleteTokenizationDictionaryOptions the {@link DeleteTokenizationDictionaryOptions} - * containing the options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteTokenizationDictionary( - DeleteTokenizationDictionaryOptions deleteTokenizationDictionaryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteTokenizationDictionaryOptions, "deleteTokenizationDictionaryOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", deleteTokenizationDictionaryOptions.environmentId()); - pathParamsMap.put("collection_id", deleteTokenizationDictionaryOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/word_lists/tokenization_dictionary", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "deleteTokenizationDictionary"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get stopword list status. - * - *

Returns the current status of the stopword list for the specified collection. - * - * @param getStopwordListStatusOptions the {@link GetStopwordListStatusOptions} containing the - * options for the call - * @return a {@link ServiceCall} with a result of type {@link TokenDictStatusResponse} - */ - public ServiceCall getStopwordListStatus( - GetStopwordListStatusOptions getStopwordListStatusOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getStopwordListStatusOptions, "getStopwordListStatusOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", getStopwordListStatusOptions.environmentId()); - pathParamsMap.put("collection_id", getStopwordListStatusOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/word_lists/stopwords", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "getStopwordListStatus"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create stopword list. - * - *

Upload a custom stopword list to use with the specified collection. - * - * @param createStopwordListOptions the {@link CreateStopwordListOptions} containing the options - * for the call - * @return a {@link ServiceCall} with a result of type {@link TokenDictStatusResponse} - */ - public ServiceCall createStopwordList( - CreateStopwordListOptions createStopwordListOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createStopwordListOptions, "createStopwordListOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", createStopwordListOptions.environmentId()); - pathParamsMap.put("collection_id", createStopwordListOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/word_lists/stopwords", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "createStopwordList"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); - multipartBuilder.setType(MultipartBody.FORM); - okhttp3.RequestBody stopwordFileBody = - RequestUtils.inputStreamBody( - createStopwordListOptions.stopwordFile(), "application/octet-stream"); - multipartBuilder.addFormDataPart( - "stopword_file", createStopwordListOptions.stopwordFilename(), stopwordFileBody); - builder.body(multipartBuilder.build()); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a custom stopword list. - * - *

Delete a custom stopword list from the collection. After a custom stopword list is deleted, - * the default list is used for the collection. - * - * @param deleteStopwordListOptions the {@link DeleteStopwordListOptions} containing the options - * for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteStopwordList(DeleteStopwordListOptions deleteStopwordListOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteStopwordListOptions, "deleteStopwordListOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", deleteStopwordListOptions.environmentId()); - pathParamsMap.put("collection_id", deleteStopwordListOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/word_lists/stopwords", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "deleteStopwordList"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Add a document. - * - *

Add a document to a collection with optional metadata. - * - *

* The **version** query parameter is still required. - * - *

* Returns immediately after the system has accepted the document for processing. - * - *

* The user must provide document content, metadata, or both. If the request is missing both - * document content and metadata, it is rejected. - * - *

* The user can set the **Content-Type** parameter on the **file** part to indicate the media - * type of the document. If the **Content-Type** parameter is missing or is one of the generic - * media types (for example, `application/octet-stream`), then the service attempts to - * automatically detect the document's media type. - * - *

* The following field names are reserved and will be filtered out if present after - * normalization: `id`, `score`, `highlight`, and any field with the prefix of: `_`, `+`, or `-` - * - *

* Fields with empty name values after normalization are filtered out before indexing. - * - *

* Fields containing the following characters after normalization are filtered out before - * indexing: `#` and `,` - * - *

**Note:** Documents can be added with a specific **document_id** by using the - * **_/v1/environments/{environment_id}/collections/{collection_id}/documents** method. - * - * @param addDocumentOptions the {@link AddDocumentOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link DocumentAccepted} - */ - public ServiceCall addDocument(AddDocumentOptions addDocumentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - addDocumentOptions, "addDocumentOptions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.isTrue( - (addDocumentOptions.file() != null) || (addDocumentOptions.metadata() != null), - "At least one of file or metadata must be supplied."); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", addDocumentOptions.environmentId()); - pathParamsMap.put("collection_id", addDocumentOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/documents", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "addDocument"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); - multipartBuilder.setType(MultipartBody.FORM); - if (addDocumentOptions.file() != null) { - okhttp3.RequestBody fileBody = - RequestUtils.inputStreamBody( - addDocumentOptions.file(), addDocumentOptions.fileContentType()); - multipartBuilder.addFormDataPart("file", addDocumentOptions.filename(), fileBody); - } - if (addDocumentOptions.metadata() != null) { - multipartBuilder.addFormDataPart("metadata", addDocumentOptions.metadata()); - } - builder.body(multipartBuilder.build()); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get document details. - * - *

Fetch status details about a submitted document. **Note:** this operation does not return - * the document itself. Instead, it returns only the document's processing status and any notices - * (warnings or errors) that were generated when the document was ingested. Use the query API to - * retrieve the actual document content. - * - * @param getDocumentStatusOptions the {@link GetDocumentStatusOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link DocumentStatus} - */ - public ServiceCall getDocumentStatus( - GetDocumentStatusOptions getDocumentStatusOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getDocumentStatusOptions, "getDocumentStatusOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", getDocumentStatusOptions.environmentId()); - pathParamsMap.put("collection_id", getDocumentStatusOptions.collectionId()); - pathParamsMap.put("document_id", getDocumentStatusOptions.documentId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/documents/{document_id}", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "getDocumentStatus"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update a document. - * - *

Replace an existing document or add a document with a specified **document_id**. Starts - * ingesting a document with optional metadata. - * - *

**Note:** When uploading a new document with this method it automatically replaces any - * document stored with the same **document_id** if it exists. - * - * @param updateDocumentOptions the {@link UpdateDocumentOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link DocumentAccepted} - */ - public ServiceCall updateDocument(UpdateDocumentOptions updateDocumentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - updateDocumentOptions, "updateDocumentOptions cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.isTrue( - (updateDocumentOptions.file() != null) || (updateDocumentOptions.metadata() != null), - "At least one of file or metadata must be supplied."); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", updateDocumentOptions.environmentId()); - pathParamsMap.put("collection_id", updateDocumentOptions.collectionId()); - pathParamsMap.put("document_id", updateDocumentOptions.documentId()); - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/documents/{document_id}", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "updateDocument"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - MultipartBody.Builder multipartBuilder = new MultipartBody.Builder(); - multipartBuilder.setType(MultipartBody.FORM); - if (updateDocumentOptions.file() != null) { - okhttp3.RequestBody fileBody = - RequestUtils.inputStreamBody( - updateDocumentOptions.file(), updateDocumentOptions.fileContentType()); - multipartBuilder.addFormDataPart("file", updateDocumentOptions.filename(), fileBody); - } - if (updateDocumentOptions.metadata() != null) { - multipartBuilder.addFormDataPart("metadata", updateDocumentOptions.metadata()); - } - builder.body(multipartBuilder.build()); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a document. - * - *

If the given document ID is invalid, or if the document is not found, then the a success - * response is returned (HTTP status code `200`) with the status set to 'deleted'. - * - * @param deleteDocumentOptions the {@link DeleteDocumentOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link DeleteDocumentResponse} - */ - public ServiceCall deleteDocument( - DeleteDocumentOptions deleteDocumentOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteDocumentOptions, "deleteDocumentOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", deleteDocumentOptions.environmentId()); - pathParamsMap.put("collection_id", deleteDocumentOptions.collectionId()); - pathParamsMap.put("document_id", deleteDocumentOptions.documentId()); - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/documents/{document_id}", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "deleteDocument"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Query a collection. - * - *

By using this method, you can construct long queries. For details, see the [Discovery - * documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-concepts#query-concepts). - * - * @param queryOptions the {@link QueryOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link QueryResponse} - */ - public ServiceCall query(QueryOptions queryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(queryOptions, "queryOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", queryOptions.environmentId()); - pathParamsMap.put("collection_id", queryOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/query", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "query"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (queryOptions.xWatsonLoggingOptOut() != null) { - builder.header("X-Watson-Logging-Opt-Out", queryOptions.xWatsonLoggingOptOut()); - } - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - if (queryOptions.filter() != null) { - contentJson.addProperty("filter", queryOptions.filter()); - } - if (queryOptions.query() != null) { - contentJson.addProperty("query", queryOptions.query()); - } - if (queryOptions.naturalLanguageQuery() != null) { - contentJson.addProperty("natural_language_query", queryOptions.naturalLanguageQuery()); - } - if (queryOptions.passages() != null) { - contentJson.addProperty("passages", queryOptions.passages()); - } - if (queryOptions.aggregation() != null) { - contentJson.addProperty("aggregation", queryOptions.aggregation()); - } - if (queryOptions.count() != null) { - contentJson.addProperty("count", queryOptions.count()); - } - if (queryOptions.xReturn() != null) { - contentJson.addProperty("return", queryOptions.xReturn()); - } - if (queryOptions.offset() != null) { - contentJson.addProperty("offset", queryOptions.offset()); - } - if (queryOptions.sort() != null) { - contentJson.addProperty("sort", queryOptions.sort()); - } - if (queryOptions.highlight() != null) { - contentJson.addProperty("highlight", queryOptions.highlight()); - } - if (queryOptions.passagesFields() != null) { - contentJson.addProperty("passages.fields", queryOptions.passagesFields()); - } - if (queryOptions.passagesCount() != null) { - contentJson.addProperty("passages.count", queryOptions.passagesCount()); - } - if (queryOptions.passagesCharacters() != null) { - contentJson.addProperty("passages.characters", queryOptions.passagesCharacters()); - } - if (queryOptions.deduplicate() != null) { - contentJson.addProperty("deduplicate", queryOptions.deduplicate()); - } - if (queryOptions.deduplicateField() != null) { - contentJson.addProperty("deduplicate.field", queryOptions.deduplicateField()); - } - if (queryOptions.similar() != null) { - contentJson.addProperty("similar", queryOptions.similar()); - } - if (queryOptions.similarDocumentIds() != null) { - contentJson.addProperty("similar.document_ids", queryOptions.similarDocumentIds()); - } - if (queryOptions.similarFields() != null) { - contentJson.addProperty("similar.fields", queryOptions.similarFields()); - } - if (queryOptions.bias() != null) { - contentJson.addProperty("bias", queryOptions.bias()); - } - if (queryOptions.spellingSuggestions() != null) { - contentJson.addProperty("spelling_suggestions", queryOptions.spellingSuggestions()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Query system notices. - * - *

Queries for notices (errors or warnings) that might have been generated by the system. - * Notices are generated when ingesting documents and performing relevance training. See the - * [Discovery - * documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-concepts#query-concepts) - * for more details on the query language. - * - * @param queryNoticesOptions the {@link QueryNoticesOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link QueryNoticesResponse} - */ - public ServiceCall queryNotices(QueryNoticesOptions queryNoticesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - queryNoticesOptions, "queryNoticesOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", queryNoticesOptions.environmentId()); - pathParamsMap.put("collection_id", queryNoticesOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/notices", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "queryNotices"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - if (queryNoticesOptions.filter() != null) { - builder.query("filter", String.valueOf(queryNoticesOptions.filter())); - } - if (queryNoticesOptions.query() != null) { - builder.query("query", String.valueOf(queryNoticesOptions.query())); - } - if (queryNoticesOptions.naturalLanguageQuery() != null) { - builder.query( - "natural_language_query", String.valueOf(queryNoticesOptions.naturalLanguageQuery())); - } - if (queryNoticesOptions.passages() != null) { - builder.query("passages", String.valueOf(queryNoticesOptions.passages())); - } - if (queryNoticesOptions.aggregation() != null) { - builder.query("aggregation", String.valueOf(queryNoticesOptions.aggregation())); - } - if (queryNoticesOptions.count() != null) { - builder.query("count", String.valueOf(queryNoticesOptions.count())); - } - if (queryNoticesOptions.xReturn() != null) { - builder.query("return", RequestUtils.join(queryNoticesOptions.xReturn(), ",")); - } - if (queryNoticesOptions.offset() != null) { - builder.query("offset", String.valueOf(queryNoticesOptions.offset())); - } - if (queryNoticesOptions.sort() != null) { - builder.query("sort", RequestUtils.join(queryNoticesOptions.sort(), ",")); - } - if (queryNoticesOptions.highlight() != null) { - builder.query("highlight", String.valueOf(queryNoticesOptions.highlight())); - } - if (queryNoticesOptions.passagesFields() != null) { - builder.query( - "passages.fields", RequestUtils.join(queryNoticesOptions.passagesFields(), ",")); - } - if (queryNoticesOptions.passagesCount() != null) { - builder.query("passages.count", String.valueOf(queryNoticesOptions.passagesCount())); - } - if (queryNoticesOptions.passagesCharacters() != null) { - builder.query( - "passages.characters", String.valueOf(queryNoticesOptions.passagesCharacters())); - } - if (queryNoticesOptions.deduplicateField() != null) { - builder.query("deduplicate.field", String.valueOf(queryNoticesOptions.deduplicateField())); - } - if (queryNoticesOptions.similar() != null) { - builder.query("similar", String.valueOf(queryNoticesOptions.similar())); - } - if (queryNoticesOptions.similarDocumentIds() != null) { - builder.query( - "similar.document_ids", RequestUtils.join(queryNoticesOptions.similarDocumentIds(), ",")); - } - if (queryNoticesOptions.similarFields() != null) { - builder.query("similar.fields", RequestUtils.join(queryNoticesOptions.similarFields(), ",")); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Query multiple collections. - * - *

By using this method, you can construct long queries that search multiple collection. For - * details, see the [Discovery - * documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-concepts#query-concepts). - * - * @param federatedQueryOptions the {@link FederatedQueryOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link QueryResponse} - */ - public ServiceCall federatedQuery(FederatedQueryOptions federatedQueryOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - federatedQueryOptions, "federatedQueryOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", federatedQueryOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/environments/{environment_id}/query", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "federatedQuery"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - if (federatedQueryOptions.xWatsonLoggingOptOut() != null) { - builder.header("X-Watson-Logging-Opt-Out", federatedQueryOptions.xWatsonLoggingOptOut()); - } - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("collection_ids", federatedQueryOptions.collectionIds()); - if (federatedQueryOptions.filter() != null) { - contentJson.addProperty("filter", federatedQueryOptions.filter()); - } - if (federatedQueryOptions.query() != null) { - contentJson.addProperty("query", federatedQueryOptions.query()); - } - if (federatedQueryOptions.naturalLanguageQuery() != null) { - contentJson.addProperty( - "natural_language_query", federatedQueryOptions.naturalLanguageQuery()); - } - if (federatedQueryOptions.passages() != null) { - contentJson.addProperty("passages", federatedQueryOptions.passages()); - } - if (federatedQueryOptions.aggregation() != null) { - contentJson.addProperty("aggregation", federatedQueryOptions.aggregation()); - } - if (federatedQueryOptions.count() != null) { - contentJson.addProperty("count", federatedQueryOptions.count()); - } - if (federatedQueryOptions.xReturn() != null) { - contentJson.addProperty("return", federatedQueryOptions.xReturn()); - } - if (federatedQueryOptions.offset() != null) { - contentJson.addProperty("offset", federatedQueryOptions.offset()); - } - if (federatedQueryOptions.sort() != null) { - contentJson.addProperty("sort", federatedQueryOptions.sort()); - } - if (federatedQueryOptions.highlight() != null) { - contentJson.addProperty("highlight", federatedQueryOptions.highlight()); - } - if (federatedQueryOptions.passagesFields() != null) { - contentJson.addProperty("passages.fields", federatedQueryOptions.passagesFields()); - } - if (federatedQueryOptions.passagesCount() != null) { - contentJson.addProperty("passages.count", federatedQueryOptions.passagesCount()); - } - if (federatedQueryOptions.passagesCharacters() != null) { - contentJson.addProperty("passages.characters", federatedQueryOptions.passagesCharacters()); - } - if (federatedQueryOptions.deduplicate() != null) { - contentJson.addProperty("deduplicate", federatedQueryOptions.deduplicate()); - } - if (federatedQueryOptions.deduplicateField() != null) { - contentJson.addProperty("deduplicate.field", federatedQueryOptions.deduplicateField()); - } - if (federatedQueryOptions.similar() != null) { - contentJson.addProperty("similar", federatedQueryOptions.similar()); - } - if (federatedQueryOptions.similarDocumentIds() != null) { - contentJson.addProperty("similar.document_ids", federatedQueryOptions.similarDocumentIds()); - } - if (federatedQueryOptions.similarFields() != null) { - contentJson.addProperty("similar.fields", federatedQueryOptions.similarFields()); - } - if (federatedQueryOptions.bias() != null) { - contentJson.addProperty("bias", federatedQueryOptions.bias()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Query multiple collection system notices. - * - *

Queries for notices (errors or warnings) that might have been generated by the system. - * Notices are generated when ingesting documents and performing relevance training. See the - * [Discovery - * documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-concepts#query-concepts) - * for more details on the query language. - * - * @param federatedQueryNoticesOptions the {@link FederatedQueryNoticesOptions} containing the - * options for the call - * @return a {@link ServiceCall} with a result of type {@link QueryNoticesResponse} - */ - public ServiceCall federatedQueryNotices( - FederatedQueryNoticesOptions federatedQueryNoticesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - federatedQueryNoticesOptions, "federatedQueryNoticesOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", federatedQueryNoticesOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/environments/{environment_id}/notices", pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "federatedQueryNotices"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - builder.query( - "collection_ids", RequestUtils.join(federatedQueryNoticesOptions.collectionIds(), ",")); - if (federatedQueryNoticesOptions.filter() != null) { - builder.query("filter", String.valueOf(federatedQueryNoticesOptions.filter())); - } - if (federatedQueryNoticesOptions.query() != null) { - builder.query("query", String.valueOf(federatedQueryNoticesOptions.query())); - } - if (federatedQueryNoticesOptions.naturalLanguageQuery() != null) { - builder.query( - "natural_language_query", - String.valueOf(federatedQueryNoticesOptions.naturalLanguageQuery())); - } - if (federatedQueryNoticesOptions.aggregation() != null) { - builder.query("aggregation", String.valueOf(federatedQueryNoticesOptions.aggregation())); - } - if (federatedQueryNoticesOptions.count() != null) { - builder.query("count", String.valueOf(federatedQueryNoticesOptions.count())); - } - if (federatedQueryNoticesOptions.xReturn() != null) { - builder.query("return", RequestUtils.join(federatedQueryNoticesOptions.xReturn(), ",")); - } - if (federatedQueryNoticesOptions.offset() != null) { - builder.query("offset", String.valueOf(federatedQueryNoticesOptions.offset())); - } - if (federatedQueryNoticesOptions.sort() != null) { - builder.query("sort", RequestUtils.join(federatedQueryNoticesOptions.sort(), ",")); - } - if (federatedQueryNoticesOptions.highlight() != null) { - builder.query("highlight", String.valueOf(federatedQueryNoticesOptions.highlight())); - } - if (federatedQueryNoticesOptions.deduplicateField() != null) { - builder.query( - "deduplicate.field", String.valueOf(federatedQueryNoticesOptions.deduplicateField())); - } - if (federatedQueryNoticesOptions.similar() != null) { - builder.query("similar", String.valueOf(federatedQueryNoticesOptions.similar())); - } - if (federatedQueryNoticesOptions.similarDocumentIds() != null) { - builder.query( - "similar.document_ids", - RequestUtils.join(federatedQueryNoticesOptions.similarDocumentIds(), ",")); - } - if (federatedQueryNoticesOptions.similarFields() != null) { - builder.query( - "similar.fields", RequestUtils.join(federatedQueryNoticesOptions.similarFields(), ",")); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get Autocomplete Suggestions. - * - *

Returns completion query suggestions for the specified prefix. /n/n **Important:** this - * method is only valid when using the Cloud Pak version of Discovery. - * - * @param getAutocompletionOptions the {@link GetAutocompletionOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link Completions} - */ - public ServiceCall getAutocompletion( - GetAutocompletionOptions getAutocompletionOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getAutocompletionOptions, "getAutocompletionOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", getAutocompletionOptions.environmentId()); - pathParamsMap.put("collection_id", getAutocompletionOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/autocompletion", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "getAutocompletion"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - builder.query("prefix", String.valueOf(getAutocompletionOptions.prefix())); - if (getAutocompletionOptions.field() != null) { - builder.query("field", String.valueOf(getAutocompletionOptions.field())); - } - if (getAutocompletionOptions.count() != null) { - builder.query("count", String.valueOf(getAutocompletionOptions.count())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List training data. - * - *

Lists the training data for the specified collection. - * - * @param listTrainingDataOptions the {@link ListTrainingDataOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link TrainingDataSet} - */ - public ServiceCall listTrainingData( - ListTrainingDataOptions listTrainingDataOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listTrainingDataOptions, "listTrainingDataOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", listTrainingDataOptions.environmentId()); - pathParamsMap.put("collection_id", listTrainingDataOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/training_data", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listTrainingData"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Add query to training data. - * - *

Adds a query to the training data for this collection. The query can contain a filter and - * natural language query. - * - * @param addTrainingDataOptions the {@link AddTrainingDataOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link TrainingQuery} - */ - public ServiceCall addTrainingData(AddTrainingDataOptions addTrainingDataOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - addTrainingDataOptions, "addTrainingDataOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", addTrainingDataOptions.environmentId()); - pathParamsMap.put("collection_id", addTrainingDataOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/training_data", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "addTrainingData"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - if (addTrainingDataOptions.naturalLanguageQuery() != null) { - contentJson.addProperty( - "natural_language_query", addTrainingDataOptions.naturalLanguageQuery()); - } - if (addTrainingDataOptions.filter() != null) { - contentJson.addProperty("filter", addTrainingDataOptions.filter()); - } - if (addTrainingDataOptions.examples() != null) { - contentJson.add( - "examples", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(addTrainingDataOptions.examples())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete all training data. - * - *

Deletes all training data from a collection. - * - * @param deleteAllTrainingDataOptions the {@link DeleteAllTrainingDataOptions} containing the - * options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteAllTrainingData( - DeleteAllTrainingDataOptions deleteAllTrainingDataOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteAllTrainingDataOptions, "deleteAllTrainingDataOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", deleteAllTrainingDataOptions.environmentId()); - pathParamsMap.put("collection_id", deleteAllTrainingDataOptions.collectionId()); - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/training_data", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "deleteAllTrainingData"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get details about a query. - * - *

Gets details for a specific training data query, including the query string and all - * examples. - * - * @param getTrainingDataOptions the {@link GetTrainingDataOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link TrainingQuery} - */ - public ServiceCall getTrainingData(GetTrainingDataOptions getTrainingDataOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getTrainingDataOptions, "getTrainingDataOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", getTrainingDataOptions.environmentId()); - pathParamsMap.put("collection_id", getTrainingDataOptions.collectionId()); - pathParamsMap.put("query_id", getTrainingDataOptions.queryId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/training_data/{query_id}", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getTrainingData"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete a training data query. - * - *

Removes the training data query and all associated examples from the training data set. - * - * @param deleteTrainingDataOptions the {@link DeleteTrainingDataOptions} containing the options - * for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteTrainingData(DeleteTrainingDataOptions deleteTrainingDataOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteTrainingDataOptions, "deleteTrainingDataOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", deleteTrainingDataOptions.environmentId()); - pathParamsMap.put("collection_id", deleteTrainingDataOptions.collectionId()); - pathParamsMap.put("query_id", deleteTrainingDataOptions.queryId()); - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/training_data/{query_id}", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "deleteTrainingData"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List examples for a training data query. - * - *

List all examples for this training data query. - * - * @param listTrainingExamplesOptions the {@link ListTrainingExamplesOptions} containing the - * options for the call - * @return a {@link ServiceCall} with a result of type {@link TrainingExampleList} - */ - public ServiceCall listTrainingExamples( - ListTrainingExamplesOptions listTrainingExamplesOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listTrainingExamplesOptions, "listTrainingExamplesOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", listTrainingExamplesOptions.environmentId()); - pathParamsMap.put("collection_id", listTrainingExamplesOptions.collectionId()); - pathParamsMap.put("query_id", listTrainingExamplesOptions.queryId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/training_data/{query_id}/examples", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "listTrainingExamples"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Add example to training data query. - * - *

Adds a example to this training data query. - * - * @param createTrainingExampleOptions the {@link CreateTrainingExampleOptions} containing the - * options for the call - * @return a {@link ServiceCall} with a result of type {@link TrainingExample} - */ - public ServiceCall createTrainingExample( - CreateTrainingExampleOptions createTrainingExampleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createTrainingExampleOptions, "createTrainingExampleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", createTrainingExampleOptions.environmentId()); - pathParamsMap.put("collection_id", createTrainingExampleOptions.collectionId()); - pathParamsMap.put("query_id", createTrainingExampleOptions.queryId()); - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/training_data/{query_id}/examples", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "createTrainingExample"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - if (createTrainingExampleOptions.documentId() != null) { - contentJson.addProperty("document_id", createTrainingExampleOptions.documentId()); - } - if (createTrainingExampleOptions.crossReference() != null) { - contentJson.addProperty("cross_reference", createTrainingExampleOptions.crossReference()); - } - if (createTrainingExampleOptions.relevance() != null) { - contentJson.addProperty("relevance", createTrainingExampleOptions.relevance()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete example for training data query. - * - *

Deletes the example document with the given ID from the training data query. - * - * @param deleteTrainingExampleOptions the {@link DeleteTrainingExampleOptions} containing the - * options for the call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteTrainingExample( - DeleteTrainingExampleOptions deleteTrainingExampleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteTrainingExampleOptions, "deleteTrainingExampleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", deleteTrainingExampleOptions.environmentId()); - pathParamsMap.put("collection_id", deleteTrainingExampleOptions.collectionId()); - pathParamsMap.put("query_id", deleteTrainingExampleOptions.queryId()); - pathParamsMap.put("example_id", deleteTrainingExampleOptions.exampleId()); - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/training_data/{query_id}/examples/{example_id}", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "deleteTrainingExample"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Change label or cross reference for example. - * - *

Changes the label or cross reference query for this training data example. - * - * @param updateTrainingExampleOptions the {@link UpdateTrainingExampleOptions} containing the - * options for the call - * @return a {@link ServiceCall} with a result of type {@link TrainingExample} - */ - public ServiceCall updateTrainingExample( - UpdateTrainingExampleOptions updateTrainingExampleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - updateTrainingExampleOptions, "updateTrainingExampleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", updateTrainingExampleOptions.environmentId()); - pathParamsMap.put("collection_id", updateTrainingExampleOptions.collectionId()); - pathParamsMap.put("query_id", updateTrainingExampleOptions.queryId()); - pathParamsMap.put("example_id", updateTrainingExampleOptions.exampleId()); - RequestBuilder builder = - RequestBuilder.put( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/training_data/{query_id}/examples/{example_id}", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "updateTrainingExample"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - if (updateTrainingExampleOptions.crossReference() != null) { - contentJson.addProperty("cross_reference", updateTrainingExampleOptions.crossReference()); - } - if (updateTrainingExampleOptions.relevance() != null) { - contentJson.addProperty("relevance", updateTrainingExampleOptions.relevance()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Get details for training data example. - * - *

Gets the details for this training example. - * - * @param getTrainingExampleOptions the {@link GetTrainingExampleOptions} containing the options - * for the call - * @return a {@link ServiceCall} with a result of type {@link TrainingExample} - */ - public ServiceCall getTrainingExample( - GetTrainingExampleOptions getTrainingExampleOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getTrainingExampleOptions, "getTrainingExampleOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", getTrainingExampleOptions.environmentId()); - pathParamsMap.put("collection_id", getTrainingExampleOptions.collectionId()); - pathParamsMap.put("query_id", getTrainingExampleOptions.queryId()); - pathParamsMap.put("example_id", getTrainingExampleOptions.exampleId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/collections/{collection_id}/training_data/{query_id}/examples/{example_id}", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "getTrainingExample"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete labeled data. - * - *

Deletes all data associated with a specified customer ID. The method has no effect if no - * data is associated with the customer ID. - * - *

You associate a customer ID with data by passing the **X-Watson-Metadata** header with a - * request that passes data. For more information about personal data and customer IDs, see - * [Information - * security](https://cloud.ibm.com/docs/discovery?topic=discovery-information-security#information-security). - * - * @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a void result - */ - public ServiceCall deleteUserData(DeleteUserDataOptions deleteUserDataOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteUserDataOptions, "deleteUserDataOptions cannot be null"); - RequestBuilder builder = - RequestBuilder.delete(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/user_data")); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "deleteUserData"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.query("version", String.valueOf(this.version)); - builder.query("customer_id", String.valueOf(deleteUserDataOptions.customerId())); - ResponseConverter responseConverter = ResponseConverterUtils.getVoid(); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create event. - * - *

The **Events** API can be used to create log entries that are associated with specific - * queries. For example, you can record which documents in the results set were "clicked" by a - * user and when that click occurred. - * - * @param createEventOptions the {@link CreateEventOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link CreateEventResponse} - */ - public ServiceCall createEvent(CreateEventOptions createEventOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createEventOptions, "createEventOptions cannot be null"); - RequestBuilder builder = - RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/events")); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createEvent"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - contentJson.addProperty("type", createEventOptions.type()); - contentJson.add( - "data", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(createEventOptions.data())); - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Search the query and event log. - * - *

Searches the query and event log to find query sessions that match the specified criteria. - * Searching the **logs** endpoint uses the standard Discovery query syntax for the parameters - * that are supported. - * - * @param queryLogOptions the {@link QueryLogOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link LogQueryResponse} - */ - public ServiceCall queryLog(QueryLogOptions queryLogOptions) { - if (queryLogOptions == null) { - queryLogOptions = new QueryLogOptions.Builder().build(); - } - RequestBuilder builder = - RequestBuilder.get(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/logs")); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "queryLog"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - if (queryLogOptions.filter() != null) { - builder.query("filter", String.valueOf(queryLogOptions.filter())); - } - if (queryLogOptions.query() != null) { - builder.query("query", String.valueOf(queryLogOptions.query())); - } - if (queryLogOptions.count() != null) { - builder.query("count", String.valueOf(queryLogOptions.count())); - } - if (queryLogOptions.offset() != null) { - builder.query("offset", String.valueOf(queryLogOptions.offset())); - } - if (queryLogOptions.sort() != null) { - builder.query("sort", RequestUtils.join(queryLogOptions.sort(), ",")); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Search the query and event log. - * - *

Searches the query and event log to find query sessions that match the specified criteria. - * Searching the **logs** endpoint uses the standard Discovery query syntax for the parameters - * that are supported. - * - * @return a {@link ServiceCall} with a result of type {@link LogQueryResponse} - */ - public ServiceCall queryLog() { - return queryLog(null); - } - - /** - * Number of queries over time. - * - *

Total number of queries using the **natural_language_query** parameter over a specific time - * window. - * - * @param getMetricsQueryOptions the {@link GetMetricsQueryOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link MetricResponse} - */ - public ServiceCall getMetricsQuery( - GetMetricsQueryOptions getMetricsQueryOptions) { - if (getMetricsQueryOptions == null) { - getMetricsQueryOptions = new GetMetricsQueryOptions.Builder().build(); - } - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/metrics/number_of_queries")); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getMetricsQuery"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - if (getMetricsQueryOptions.startTime() != null) { - builder.query("start_time", DateUtils.formatAsDateTime(getMetricsQueryOptions.startTime())); - } - if (getMetricsQueryOptions.endTime() != null) { - builder.query("end_time", DateUtils.formatAsDateTime(getMetricsQueryOptions.endTime())); - } - if (getMetricsQueryOptions.resultType() != null) { - builder.query("result_type", String.valueOf(getMetricsQueryOptions.resultType())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Number of queries over time. - * - *

Total number of queries using the **natural_language_query** parameter over a specific time - * window. - * - * @return a {@link ServiceCall} with a result of type {@link MetricResponse} - */ - public ServiceCall getMetricsQuery() { - return getMetricsQuery(null); - } - - /** - * Number of queries with an event over time. - * - *

Total number of queries using the **natural_language_query** parameter that have a - * corresponding "click" event over a specified time window. This metric requires having - * integrated event tracking in your application using the **Events** API. - * - * @param getMetricsQueryEventOptions the {@link GetMetricsQueryEventOptions} containing the - * options for the call - * @return a {@link ServiceCall} with a result of type {@link MetricResponse} - */ - public ServiceCall getMetricsQueryEvent( - GetMetricsQueryEventOptions getMetricsQueryEventOptions) { - if (getMetricsQueryEventOptions == null) { - getMetricsQueryEventOptions = new GetMetricsQueryEventOptions.Builder().build(); - } - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/metrics/number_of_queries_with_event")); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "getMetricsQueryEvent"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - if (getMetricsQueryEventOptions.startTime() != null) { - builder.query( - "start_time", DateUtils.formatAsDateTime(getMetricsQueryEventOptions.startTime())); - } - if (getMetricsQueryEventOptions.endTime() != null) { - builder.query("end_time", DateUtils.formatAsDateTime(getMetricsQueryEventOptions.endTime())); - } - if (getMetricsQueryEventOptions.resultType() != null) { - builder.query("result_type", String.valueOf(getMetricsQueryEventOptions.resultType())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Number of queries with an event over time. - * - *

Total number of queries using the **natural_language_query** parameter that have a - * corresponding "click" event over a specified time window. This metric requires having - * integrated event tracking in your application using the **Events** API. - * - * @return a {@link ServiceCall} with a result of type {@link MetricResponse} - */ - public ServiceCall getMetricsQueryEvent() { - return getMetricsQueryEvent(null); - } - - /** - * Number of queries with no search results over time. - * - *

Total number of queries using the **natural_language_query** parameter that have no results - * returned over a specified time window. - * - * @param getMetricsQueryNoResultsOptions the {@link GetMetricsQueryNoResultsOptions} containing - * the options for the call - * @return a {@link ServiceCall} with a result of type {@link MetricResponse} - */ - public ServiceCall getMetricsQueryNoResults( - GetMetricsQueryNoResultsOptions getMetricsQueryNoResultsOptions) { - if (getMetricsQueryNoResultsOptions == null) { - getMetricsQueryNoResultsOptions = new GetMetricsQueryNoResultsOptions.Builder().build(); - } - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/metrics/number_of_queries_with_no_search_results")); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "getMetricsQueryNoResults"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - if (getMetricsQueryNoResultsOptions.startTime() != null) { - builder.query( - "start_time", DateUtils.formatAsDateTime(getMetricsQueryNoResultsOptions.startTime())); - } - if (getMetricsQueryNoResultsOptions.endTime() != null) { - builder.query( - "end_time", DateUtils.formatAsDateTime(getMetricsQueryNoResultsOptions.endTime())); - } - if (getMetricsQueryNoResultsOptions.resultType() != null) { - builder.query("result_type", String.valueOf(getMetricsQueryNoResultsOptions.resultType())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Number of queries with no search results over time. - * - *

Total number of queries using the **natural_language_query** parameter that have no results - * returned over a specified time window. - * - * @return a {@link ServiceCall} with a result of type {@link MetricResponse} - */ - public ServiceCall getMetricsQueryNoResults() { - return getMetricsQueryNoResults(null); - } - - /** - * Percentage of queries with an associated event. - * - *

The percentage of queries using the **natural_language_query** parameter that have a - * corresponding "click" event over a specified time window. This metric requires having - * integrated event tracking in your application using the **Events** API. - * - * @param getMetricsEventRateOptions the {@link GetMetricsEventRateOptions} containing the options - * for the call - * @return a {@link ServiceCall} with a result of type {@link MetricResponse} - */ - public ServiceCall getMetricsEventRate( - GetMetricsEventRateOptions getMetricsEventRateOptions) { - if (getMetricsEventRateOptions == null) { - getMetricsEventRateOptions = new GetMetricsEventRateOptions.Builder().build(); - } - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v1/metrics/event_rate")); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "getMetricsEventRate"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - if (getMetricsEventRateOptions.startTime() != null) { - builder.query( - "start_time", DateUtils.formatAsDateTime(getMetricsEventRateOptions.startTime())); - } - if (getMetricsEventRateOptions.endTime() != null) { - builder.query("end_time", DateUtils.formatAsDateTime(getMetricsEventRateOptions.endTime())); - } - if (getMetricsEventRateOptions.resultType() != null) { - builder.query("result_type", String.valueOf(getMetricsEventRateOptions.resultType())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Percentage of queries with an associated event. - * - *

The percentage of queries using the **natural_language_query** parameter that have a - * corresponding "click" event over a specified time window. This metric requires having - * integrated event tracking in your application using the **Events** API. - * - * @return a {@link ServiceCall} with a result of type {@link MetricResponse} - */ - public ServiceCall getMetricsEventRate() { - return getMetricsEventRate(null); - } - - /** - * Most frequent query tokens with an event. - * - *

The most frequent query tokens parsed from the **natural_language_query** parameter and - * their corresponding "click" event rate within the recording period (queries and events are - * stored for 30 days). A query token is an individual word or unigram within the query string. - * - * @param getMetricsQueryTokenEventOptions the {@link GetMetricsQueryTokenEventOptions} containing - * the options for the call - * @return a {@link ServiceCall} with a result of type {@link MetricTokenResponse} - */ - public ServiceCall getMetricsQueryTokenEvent( - GetMetricsQueryTokenEventOptions getMetricsQueryTokenEventOptions) { - if (getMetricsQueryTokenEventOptions == null) { - getMetricsQueryTokenEventOptions = new GetMetricsQueryTokenEventOptions.Builder().build(); - } - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/metrics/top_query_tokens_with_event_rate")); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "getMetricsQueryTokenEvent"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - if (getMetricsQueryTokenEventOptions.count() != null) { - builder.query("count", String.valueOf(getMetricsQueryTokenEventOptions.count())); - } - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Most frequent query tokens with an event. - * - *

The most frequent query tokens parsed from the **natural_language_query** parameter and - * their corresponding "click" event rate within the recording period (queries and events are - * stored for 30 days). A query token is an individual word or unigram within the query string. - * - * @return a {@link ServiceCall} with a result of type {@link MetricTokenResponse} - */ - public ServiceCall getMetricsQueryTokenEvent() { - return getMetricsQueryTokenEvent(null); - } - - /** - * List credentials. - * - *

List all the source credentials that have been created for this service instance. - * - *

**Note:** All credentials are sent over an encrypted connection and encrypted at rest. - * - * @param listCredentialsOptions the {@link ListCredentialsOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link CredentialsList} - */ - public ServiceCall listCredentials( - ListCredentialsOptions listCredentialsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listCredentialsOptions, "listCredentialsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", listCredentialsOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/environments/{environment_id}/credentials", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listCredentials"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create credentials. - * - *

Creates a set of credentials to connect to a remote source. Created credentials are used in - * a configuration to associate a collection with the remote source. - * - *

**Note:** All credentials are sent over an encrypted connection and encrypted at rest. - * - * @param createCredentialsOptions the {@link CreateCredentialsOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link Credentials} - */ - public ServiceCall createCredentials( - CreateCredentialsOptions createCredentialsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createCredentialsOptions, "createCredentialsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", createCredentialsOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/environments/{environment_id}/credentials", pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "createCredentials"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - if (createCredentialsOptions.sourceType() != null) { - contentJson.addProperty("source_type", createCredentialsOptions.sourceType()); - } - if (createCredentialsOptions.credentialDetails() != null) { - contentJson.add( - "credential_details", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(createCredentialsOptions.credentialDetails())); - } - if (createCredentialsOptions.status() != null) { - contentJson.add( - "status", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(createCredentialsOptions.status())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * View Credentials. - * - *

Returns details about the specified credentials. - * - *

**Note:** Secure credential information such as a password or SSH key is never returned and - * must be obtained from the source system. - * - * @param getCredentialsOptions the {@link GetCredentialsOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link Credentials} - */ - public ServiceCall getCredentials(GetCredentialsOptions getCredentialsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getCredentialsOptions, "getCredentialsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", getCredentialsOptions.environmentId()); - pathParamsMap.put("credential_id", getCredentialsOptions.credentialId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/credentials/{credential_id}", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getCredentials"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Update credentials. - * - *

Updates an existing set of source credentials. - * - *

**Note:** All credentials are sent over an encrypted connection and encrypted at rest. - * - * @param updateCredentialsOptions the {@link UpdateCredentialsOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link Credentials} - */ - public ServiceCall updateCredentials( - UpdateCredentialsOptions updateCredentialsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - updateCredentialsOptions, "updateCredentialsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", updateCredentialsOptions.environmentId()); - pathParamsMap.put("credential_id", updateCredentialsOptions.credentialId()); - RequestBuilder builder = - RequestBuilder.put( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/credentials/{credential_id}", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "updateCredentials"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - if (updateCredentialsOptions.sourceType() != null) { - contentJson.addProperty("source_type", updateCredentialsOptions.sourceType()); - } - if (updateCredentialsOptions.credentialDetails() != null) { - contentJson.add( - "credential_details", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(updateCredentialsOptions.credentialDetails())); - } - if (updateCredentialsOptions.status() != null) { - contentJson.add( - "status", - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() - .toJsonTree(updateCredentialsOptions.status())); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete credentials. - * - *

Deletes a set of stored credentials from your Discovery instance. - * - * @param deleteCredentialsOptions the {@link DeleteCredentialsOptions} containing the options for - * the call - * @return a {@link ServiceCall} with a result of type {@link DeleteCredentials} - */ - public ServiceCall deleteCredentials( - DeleteCredentialsOptions deleteCredentialsOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteCredentialsOptions, "deleteCredentialsOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", deleteCredentialsOptions.environmentId()); - pathParamsMap.put("credential_id", deleteCredentialsOptions.credentialId()); - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/credentials/{credential_id}", - pathParamsMap)); - Map sdkHeaders = - SdkCommon.getSdkHeaders("discovery", "v1", "deleteCredentials"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List Gateways. - * - *

List the currently configured gateways. - * - * @param listGatewaysOptions the {@link ListGatewaysOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link GatewayList} - */ - public ServiceCall listGateways(ListGatewaysOptions listGatewaysOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - listGatewaysOptions, "listGatewaysOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", listGatewaysOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/environments/{environment_id}/gateways", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "listGateways"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Create Gateway. - * - *

Create a gateway configuration to use with a remotely installed gateway. - * - * @param createGatewayOptions the {@link CreateGatewayOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link Gateway} - */ - public ServiceCall createGateway(CreateGatewayOptions createGatewayOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - createGatewayOptions, "createGatewayOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", createGatewayOptions.environmentId()); - RequestBuilder builder = - RequestBuilder.post( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), "/v1/environments/{environment_id}/gateways", pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "createGateway"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - final JsonObject contentJson = new JsonObject(); - if (createGatewayOptions.name() != null) { - contentJson.addProperty("name", createGatewayOptions.name()); - } - builder.bodyJson(contentJson); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * List Gateway Details. - * - *

List information about the specified gateway. - * - * @param getGatewayOptions the {@link GetGatewayOptions} containing the options for the call - * @return a {@link ServiceCall} with a result of type {@link Gateway} - */ - public ServiceCall getGateway(GetGatewayOptions getGatewayOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - getGatewayOptions, "getGatewayOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", getGatewayOptions.environmentId()); - pathParamsMap.put("gateway_id", getGatewayOptions.gatewayId()); - RequestBuilder builder = - RequestBuilder.get( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/gateways/{gateway_id}", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getGateway"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } - - /** - * Delete Gateway. - * - *

Delete the specified gateway configuration. - * - * @param deleteGatewayOptions the {@link DeleteGatewayOptions} containing the options for the - * call - * @return a {@link ServiceCall} with a result of type {@link GatewayDelete} - */ - public ServiceCall deleteGateway(DeleteGatewayOptions deleteGatewayOptions) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - deleteGatewayOptions, "deleteGatewayOptions cannot be null"); - Map pathParamsMap = new HashMap(); - pathParamsMap.put("environment_id", deleteGatewayOptions.environmentId()); - pathParamsMap.put("gateway_id", deleteGatewayOptions.gatewayId()); - RequestBuilder builder = - RequestBuilder.delete( - RequestBuilder.resolveRequestUrl( - getServiceUrl(), - "/v1/environments/{environment_id}/gateways/{gateway_id}", - pathParamsMap)); - Map sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "deleteGateway"); - for (Entry header : sdkHeaders.entrySet()) { - builder.header(header.getKey(), header.getValue()); - } - builder.header("Accept", "application/json"); - builder.query("version", String.valueOf(this.version)); - ResponseConverter responseConverter = - ResponseConverterUtils.getValue( - new com.google.gson.reflect.TypeToken() {}.getType()); - return createServiceCall(builder.build(), responseConverter); - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddDocumentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddDocumentOptions.java deleted file mode 100644 index b8ba8a545ef..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddDocumentOptions.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; - -/** The addDocument options. */ -public class AddDocumentOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected InputStream file; - protected String filename; - protected String fileContentType; - protected String metadata; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private InputStream file; - private String filename; - private String fileContentType; - private String metadata; - - /** - * Instantiates a new Builder from an existing AddDocumentOptions instance. - * - * @param addDocumentOptions the instance to initialize the Builder with - */ - private Builder(AddDocumentOptions addDocumentOptions) { - this.environmentId = addDocumentOptions.environmentId; - this.collectionId = addDocumentOptions.collectionId; - this.file = addDocumentOptions.file; - this.filename = addDocumentOptions.filename; - this.fileContentType = addDocumentOptions.fileContentType; - this.metadata = addDocumentOptions.metadata; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a AddDocumentOptions. - * - * @return the new AddDocumentOptions instance - */ - public AddDocumentOptions build() { - return new AddDocumentOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the AddDocumentOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the AddDocumentOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the file. - * - * @param file the file - * @return the AddDocumentOptions builder - */ - public Builder file(InputStream file) { - this.file = file; - return this; - } - - /** - * Set the filename. - * - * @param filename the filename - * @return the AddDocumentOptions builder - */ - public Builder filename(String filename) { - this.filename = filename; - return this; - } - - /** - * Set the fileContentType. - * - * @param fileContentType the fileContentType - * @return the AddDocumentOptions builder - */ - public Builder fileContentType(String fileContentType) { - this.fileContentType = fileContentType; - return this; - } - - /** - * Set the metadata. - * - * @param metadata the metadata - * @return the AddDocumentOptions builder - */ - public Builder metadata(String metadata) { - this.metadata = metadata; - return this; - } - - /** - * Set the file. - * - * @param file the file - * @return the AddDocumentOptions builder - * @throws FileNotFoundException if the file could not be found - */ - public Builder file(File file) throws FileNotFoundException { - this.file = new FileInputStream(file); - this.filename = file.getName(); - return this; - } - } - - protected AddDocumentOptions() {} - - protected AddDocumentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.isTrue( - (builder.file == null) || (builder.filename != null), - "filename cannot be null if file is not null."); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - file = builder.file; - filename = builder.filename; - fileContentType = builder.fileContentType; - metadata = builder.metadata; - } - - /** - * New builder. - * - * @return a AddDocumentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the file. - * - *

The content of the document to ingest. The maximum supported file size when adding a file to - * a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 - * megabyte. Files larger than the supported size are rejected. - * - * @return the file - */ - public InputStream file() { - return file; - } - - /** - * Gets the filename. - * - *

The filename for file. - * - * @return the filename - */ - public String filename() { - return filename; - } - - /** - * Gets the fileContentType. - * - *

The content type of file. Values for this parameter can be obtained from the HttpMediaType - * class. - * - * @return the fileContentType - */ - public String fileContentType() { - return fileContentType; - } - - /** - * Gets the metadata. - * - *

The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are - * rejected. Example: ``` { "Creator": "Johnny Appleseed", "Subject": "Apples" } ```. - * - * @return the metadata - */ - public String metadata() { - return metadata; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddTrainingDataOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddTrainingDataOptions.java deleted file mode 100644 index 84c57841bcf..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AddTrainingDataOptions.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** The addTrainingData options. */ -public class AddTrainingDataOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String naturalLanguageQuery; - protected String filter; - protected List examples; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String naturalLanguageQuery; - private String filter; - private List examples; - - /** - * Instantiates a new Builder from an existing AddTrainingDataOptions instance. - * - * @param addTrainingDataOptions the instance to initialize the Builder with - */ - private Builder(AddTrainingDataOptions addTrainingDataOptions) { - this.environmentId = addTrainingDataOptions.environmentId; - this.collectionId = addTrainingDataOptions.collectionId; - this.naturalLanguageQuery = addTrainingDataOptions.naturalLanguageQuery; - this.filter = addTrainingDataOptions.filter; - this.examples = addTrainingDataOptions.examples; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a AddTrainingDataOptions. - * - * @return the new AddTrainingDataOptions instance - */ - public AddTrainingDataOptions build() { - return new AddTrainingDataOptions(this); - } - - /** - * Adds a new element to examples. - * - * @param examples the new element to be added - * @return the AddTrainingDataOptions builder - */ - public Builder addExamples(TrainingExample examples) { - com.ibm.cloud.sdk.core.util.Validator.notNull(examples, "examples cannot be null"); - if (this.examples == null) { - this.examples = new ArrayList(); - } - this.examples.add(examples); - return this; - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the AddTrainingDataOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the AddTrainingDataOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the naturalLanguageQuery. - * - * @param naturalLanguageQuery the naturalLanguageQuery - * @return the AddTrainingDataOptions builder - */ - public Builder naturalLanguageQuery(String naturalLanguageQuery) { - this.naturalLanguageQuery = naturalLanguageQuery; - return this; - } - - /** - * Set the filter. - * - * @param filter the filter - * @return the AddTrainingDataOptions builder - */ - public Builder filter(String filter) { - this.filter = filter; - return this; - } - - /** - * Set the examples. Existing examples will be replaced. - * - * @param examples the examples - * @return the AddTrainingDataOptions builder - */ - public Builder examples(List examples) { - this.examples = examples; - return this; - } - } - - protected AddTrainingDataOptions() {} - - protected AddTrainingDataOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - naturalLanguageQuery = builder.naturalLanguageQuery; - filter = builder.filter; - examples = builder.examples; - } - - /** - * New builder. - * - * @return a AddTrainingDataOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the naturalLanguageQuery. - * - *

The natural text query for the new training query. - * - * @return the naturalLanguageQuery - */ - public String naturalLanguageQuery() { - return naturalLanguageQuery; - } - - /** - * Gets the filter. - * - *

The filter used on the collection before the **natural_language_query** is applied. - * - * @return the filter - */ - public String filter() { - return filter; - } - - /** - * Gets the examples. - * - *

Array of training examples. - * - * @return the examples - */ - public List examples() { - return examples; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AggregationResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AggregationResult.java deleted file mode 100644 index 47fa2ad05cb..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/AggregationResult.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Aggregation results for the specified query. */ -public class AggregationResult extends GenericModel { - - protected String key; - - @SerializedName("matching_results") - protected Long matchingResults; - - protected List aggregations; - - /** - * Gets the key. - * - *

Key that matched the aggregation type. - * - * @return the key - */ - public String getKey() { - return key; - } - - /** - * Gets the matchingResults. - * - *

Number of matching results. - * - * @return the matchingResults - */ - public Long getMatchingResults() { - return matchingResults; - } - - /** - * Gets the aggregations. - * - *

Aggregations returned in the case of chained aggregations. - * - * @return the aggregations - */ - public List getAggregations() { - return aggregations; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Collection.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Collection.java deleted file mode 100644 index 748637f5712..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Collection.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Date; - -/** A collection for storing documents. */ -public class Collection extends GenericModel { - - /** The status of the collection. */ - public interface Status { - /** active. */ - String ACTIVE = "active"; - /** pending. */ - String PENDING = "pending"; - /** maintenance. */ - String MAINTENANCE = "maintenance"; - } - - @SerializedName("collection_id") - protected String collectionId; - - protected String name; - protected String description; - protected Date created; - protected Date updated; - protected String status; - - @SerializedName("configuration_id") - protected String configurationId; - - protected String language; - - @SerializedName("document_counts") - protected DocumentCounts documentCounts; - - @SerializedName("disk_usage") - protected CollectionDiskUsage diskUsage; - - @SerializedName("training_status") - protected TrainingStatus trainingStatus; - - @SerializedName("crawl_status") - protected CollectionCrawlStatus crawlStatus; - - @SerializedName("smart_document_understanding") - protected SduStatus smartDocumentUnderstanding; - - protected Collection() {} - - /** - * Gets the collectionId. - * - *

The unique identifier of the collection. - * - * @return the collectionId - */ - public String getCollectionId() { - return collectionId; - } - - /** - * Gets the name. - * - *

The name of the collection. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - *

The description of the collection. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the created. - * - *

The creation date of the collection in the format yyyy-MM-dd'T'HH:mmcon:ss.SSS'Z'. - * - * @return the created - */ - public Date getCreated() { - return created; - } - - /** - * Gets the updated. - * - *

The timestamp of when the collection was last updated in the format - * yyyy-MM-dd'T'HH:mm:ss.SSS'Z'. - * - * @return the updated - */ - public Date getUpdated() { - return updated; - } - - /** - * Gets the status. - * - *

The status of the collection. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the configurationId. - * - *

The unique identifier of the collection's configuration. - * - * @return the configurationId - */ - public String getConfigurationId() { - return configurationId; - } - - /** - * Gets the language. - * - *

The language of the documents stored in the collection. Permitted values include `en` - * (English), `de` (German), and `es` (Spanish). - * - * @return the language - */ - public String getLanguage() { - return language; - } - - /** - * Gets the documentCounts. - * - *

Object containing collection document count information. - * - * @return the documentCounts - */ - public DocumentCounts getDocumentCounts() { - return documentCounts; - } - - /** - * Gets the diskUsage. - * - *

Summary of the disk usage statistics for this collection. - * - * @return the diskUsage - */ - public CollectionDiskUsage getDiskUsage() { - return diskUsage; - } - - /** - * Gets the trainingStatus. - * - *

Training status details. - * - * @return the trainingStatus - */ - public TrainingStatus getTrainingStatus() { - return trainingStatus; - } - - /** - * Gets the crawlStatus. - * - *

Object containing information about the crawl status of this collection. - * - * @return the crawlStatus - */ - public CollectionCrawlStatus getCrawlStatus() { - return crawlStatus; - } - - /** - * Gets the smartDocumentUnderstanding. - * - *

Object containing smart document understanding information for this collection. - * - * @return the smartDocumentUnderstanding - */ - public SduStatus getSmartDocumentUnderstanding() { - return smartDocumentUnderstanding; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionCrawlStatus.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionCrawlStatus.java deleted file mode 100644 index 615e34021aa..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionCrawlStatus.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object containing information about the crawl status of this collection. */ -public class CollectionCrawlStatus extends GenericModel { - - @SerializedName("source_crawl") - protected SourceStatus sourceCrawl; - - protected CollectionCrawlStatus() {} - - /** - * Gets the sourceCrawl. - * - *

Object containing source crawl status information. - * - * @return the sourceCrawl - */ - public SourceStatus getSourceCrawl() { - return sourceCrawl; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionDiskUsage.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionDiskUsage.java deleted file mode 100644 index 0a0ae62edde..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionDiskUsage.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Summary of the disk usage statistics for this collection. */ -public class CollectionDiskUsage extends GenericModel { - - @SerializedName("used_bytes") - protected Long usedBytes; - - protected CollectionDiskUsage() {} - - /** - * Gets the usedBytes. - * - *

Number of bytes used by the collection. - * - * @return the usedBytes - */ - public Long getUsedBytes() { - return usedBytes; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionUsage.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionUsage.java deleted file mode 100644 index a71d4adc2b4..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CollectionUsage.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Summary of the collection usage in the environment. */ -public class CollectionUsage extends GenericModel { - - protected Long available; - - @SerializedName("maximum_allowed") - protected Long maximumAllowed; - - protected CollectionUsage() {} - - /** - * Gets the available. - * - *

Number of active collections in the environment. - * - * @return the available - */ - public Long getAvailable() { - return available; - } - - /** - * Gets the maximumAllowed. - * - *

Total number of collections allowed in the environment. - * - * @return the maximumAllowed - */ - public Long getMaximumAllowed() { - return maximumAllowed; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Completions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Completions.java deleted file mode 100644 index d09e5ae59a5..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Completions.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** An object containing an array of autocompletion suggestions. */ -public class Completions extends GenericModel { - - protected List completions; - - protected Completions() {} - - /** - * Gets the completions. - * - *

Array of autcomplete suggestion based on the provided prefix. - * - * @return the completions - */ - public List getCompletions() { - return completions; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Configuration.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Configuration.java deleted file mode 100644 index 7d468e249cc..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Configuration.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** A custom configuration for the environment. */ -public class Configuration extends GenericModel { - - @SerializedName("configuration_id") - protected String configurationId; - - protected String name; - protected Date created; - protected Date updated; - protected String description; - protected Conversions conversions; - protected List enrichments; - protected List normalizations; - protected Source source; - - /** Builder. */ - public static class Builder { - private String name; - private String description; - private Conversions conversions; - private List enrichments; - private List normalizations; - private Source source; - - /** - * Instantiates a new Builder from an existing Configuration instance. - * - * @param configuration the instance to initialize the Builder with - */ - private Builder(Configuration configuration) { - this.name = configuration.name; - this.description = configuration.description; - this.conversions = configuration.conversions; - this.enrichments = configuration.enrichments; - this.normalizations = configuration.normalizations; - this.source = configuration.source; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - */ - public Builder(String name) { - this.name = name; - } - - /** - * Builds a Configuration. - * - * @return the new Configuration instance - */ - public Configuration build() { - return new Configuration(this); - } - - /** - * Adds a new element to enrichments. - * - * @param enrichment the new element to be added - * @return the Configuration builder - */ - public Builder addEnrichment(Enrichment enrichment) { - com.ibm.cloud.sdk.core.util.Validator.notNull(enrichment, "enrichment cannot be null"); - if (this.enrichments == null) { - this.enrichments = new ArrayList(); - } - this.enrichments.add(enrichment); - return this; - } - - /** - * Adds a new element to normalizations. - * - * @param normalization the new element to be added - * @return the Configuration builder - */ - public Builder addNormalization(NormalizationOperation normalization) { - com.ibm.cloud.sdk.core.util.Validator.notNull(normalization, "normalization cannot be null"); - if (this.normalizations == null) { - this.normalizations = new ArrayList(); - } - this.normalizations.add(normalization); - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the Configuration builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the Configuration builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the conversions. - * - * @param conversions the conversions - * @return the Configuration builder - */ - public Builder conversions(Conversions conversions) { - this.conversions = conversions; - return this; - } - - /** - * Set the enrichments. Existing enrichments will be replaced. - * - * @param enrichments the enrichments - * @return the Configuration builder - */ - public Builder enrichments(List enrichments) { - this.enrichments = enrichments; - return this; - } - - /** - * Set the normalizations. Existing normalizations will be replaced. - * - * @param normalizations the normalizations - * @return the Configuration builder - */ - public Builder normalizations(List normalizations) { - this.normalizations = normalizations; - return this; - } - - /** - * Set the source. - * - * @param source the source - * @return the Configuration builder - */ - public Builder source(Source source) { - this.source = source; - return this; - } - } - - protected Configuration() {} - - protected Configuration(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, "name cannot be null"); - name = builder.name; - description = builder.description; - conversions = builder.conversions; - enrichments = builder.enrichments; - normalizations = builder.normalizations; - source = builder.source; - } - - /** - * New builder. - * - * @return a Configuration builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the configurationId. - * - *

The unique identifier of the configuration. - * - * @return the configurationId - */ - public String configurationId() { - return configurationId; - } - - /** - * Gets the name. - * - *

The name of the configuration. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the created. - * - *

The creation date of the configuration in the format yyyy-MM-dd'T'HH:mm:ss.SSS'Z'. - * - * @return the created - */ - public Date created() { - return created; - } - - /** - * Gets the updated. - * - *

The timestamp of when the configuration was last updated in the format - * yyyy-MM-dd'T'HH:mm:ss.SSS'Z'. - * - * @return the updated - */ - public Date updated() { - return updated; - } - - /** - * Gets the description. - * - *

The description of the configuration, if available. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the conversions. - * - *

Document conversion settings. - * - * @return the conversions - */ - public Conversions conversions() { - return conversions; - } - - /** - * Gets the enrichments. - * - *

An array of document enrichment settings for the configuration. - * - * @return the enrichments - */ - public List enrichments() { - return enrichments; - } - - /** - * Gets the normalizations. - * - *

Defines operations that can be used to transform the final output JSON into a normalized - * form. Operations are executed in the order that they appear in the array. - * - * @return the normalizations - */ - public List normalizations() { - return normalizations; - } - - /** - * Gets the source. - * - *

Object containing source parameters for the configuration. - * - * @return the source - */ - public Source source() { - return source; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Conversions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Conversions.java deleted file mode 100644 index 429778a2c20..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Conversions.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** Document conversion settings. */ -public class Conversions extends GenericModel { - - protected PdfSettings pdf; - protected WordSettings word; - protected HtmlSettings html; - protected SegmentSettings segment; - - @SerializedName("json_normalizations") - protected List jsonNormalizations; - - @SerializedName("image_text_recognition") - protected Boolean imageTextRecognition; - - /** Builder. */ - public static class Builder { - private PdfSettings pdf; - private WordSettings word; - private HtmlSettings html; - private SegmentSettings segment; - private List jsonNormalizations; - private Boolean imageTextRecognition; - - /** - * Instantiates a new Builder from an existing Conversions instance. - * - * @param conversions the instance to initialize the Builder with - */ - private Builder(Conversions conversions) { - this.pdf = conversions.pdf; - this.word = conversions.word; - this.html = conversions.html; - this.segment = conversions.segment; - this.jsonNormalizations = conversions.jsonNormalizations; - this.imageTextRecognition = conversions.imageTextRecognition; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a Conversions. - * - * @return the new Conversions instance - */ - public Conversions build() { - return new Conversions(this); - } - - /** - * Adds a new element to jsonNormalizations. - * - * @param normalization the new element to be added - * @return the Conversions builder - */ - public Builder addNormalization(NormalizationOperation normalization) { - com.ibm.cloud.sdk.core.util.Validator.notNull(normalization, "normalization cannot be null"); - if (this.jsonNormalizations == null) { - this.jsonNormalizations = new ArrayList(); - } - this.jsonNormalizations.add(normalization); - return this; - } - - /** - * Set the pdf. - * - * @param pdf the pdf - * @return the Conversions builder - */ - public Builder pdf(PdfSettings pdf) { - this.pdf = pdf; - return this; - } - - /** - * Set the word. - * - * @param word the word - * @return the Conversions builder - */ - public Builder word(WordSettings word) { - this.word = word; - return this; - } - - /** - * Set the html. - * - * @param html the html - * @return the Conversions builder - */ - public Builder html(HtmlSettings html) { - this.html = html; - return this; - } - - /** - * Set the segment. - * - * @param segment the segment - * @return the Conversions builder - */ - public Builder segment(SegmentSettings segment) { - this.segment = segment; - return this; - } - - /** - * Set the jsonNormalizations. Existing jsonNormalizations will be replaced. - * - * @param jsonNormalizations the jsonNormalizations - * @return the Conversions builder - */ - public Builder jsonNormalizations(List jsonNormalizations) { - this.jsonNormalizations = jsonNormalizations; - return this; - } - - /** - * Set the imageTextRecognition. - * - * @param imageTextRecognition the imageTextRecognition - * @return the Conversions builder - */ - public Builder imageTextRecognition(Boolean imageTextRecognition) { - this.imageTextRecognition = imageTextRecognition; - return this; - } - } - - protected Conversions() {} - - protected Conversions(Builder builder) { - pdf = builder.pdf; - word = builder.word; - html = builder.html; - segment = builder.segment; - jsonNormalizations = builder.jsonNormalizations; - imageTextRecognition = builder.imageTextRecognition; - } - - /** - * New builder. - * - * @return a Conversions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the pdf. - * - *

A list of PDF conversion settings. - * - * @return the pdf - */ - public PdfSettings pdf() { - return pdf; - } - - /** - * Gets the word. - * - *

A list of Word conversion settings. - * - * @return the word - */ - public WordSettings word() { - return word; - } - - /** - * Gets the html. - * - *

A list of HTML conversion settings. - * - * @return the html - */ - public HtmlSettings html() { - return html; - } - - /** - * Gets the segment. - * - *

A list of Document Segmentation settings. - * - * @return the segment - */ - public SegmentSettings segment() { - return segment; - } - - /** - * Gets the jsonNormalizations. - * - *

Defines operations that can be used to transform the final output JSON into a normalized - * form. Operations are executed in the order that they appear in the array. - * - * @return the jsonNormalizations - */ - public List jsonNormalizations() { - return jsonNormalizations; - } - - /** - * Gets the imageTextRecognition. - * - *

When `true`, automatic text extraction from images (this includes images embedded in - * supported document formats, for example PDF, and suppported image formats, for example TIFF) is - * performed on documents uploaded to the collection. This field is supported on **Advanced** and - * higher plans only. **Lite** plans do not support image text recognition. - * - * @return the imageTextRecognition - */ - public Boolean imageTextRecognition() { - return imageTextRecognition; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCollectionOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCollectionOptions.java deleted file mode 100644 index a935d730699..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCollectionOptions.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The createCollection options. */ -public class CreateCollectionOptions extends GenericModel { - - /** - * The language of the documents stored in the collection, in the form of an ISO 639-1 language - * code. - */ - public interface Language { - /** en. */ - String EN = "en"; - /** es. */ - String ES = "es"; - /** de. */ - String DE = "de"; - /** ar. */ - String AR = "ar"; - /** fr. */ - String FR = "fr"; - /** it. */ - String IT = "it"; - /** ja. */ - String JA = "ja"; - /** ko. */ - String KO = "ko"; - /** pt. */ - String PT = "pt"; - /** nl. */ - String NL = "nl"; - /** zh-CN. */ - String ZH_CN = "zh-CN"; - } - - protected String environmentId; - protected String name; - protected String description; - protected String configurationId; - protected String language; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String name; - private String description; - private String configurationId; - private String language; - - /** - * Instantiates a new Builder from an existing CreateCollectionOptions instance. - * - * @param createCollectionOptions the instance to initialize the Builder with - */ - private Builder(CreateCollectionOptions createCollectionOptions) { - this.environmentId = createCollectionOptions.environmentId; - this.name = createCollectionOptions.name; - this.description = createCollectionOptions.description; - this.configurationId = createCollectionOptions.configurationId; - this.language = createCollectionOptions.language; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param name the name - */ - public Builder(String environmentId, String name) { - this.environmentId = environmentId; - this.name = name; - } - - /** - * Builds a CreateCollectionOptions. - * - * @return the new CreateCollectionOptions instance - */ - public CreateCollectionOptions build() { - return new CreateCollectionOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the CreateCollectionOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateCollectionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateCollectionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the configurationId. - * - * @param configurationId the configurationId - * @return the CreateCollectionOptions builder - */ - public Builder configurationId(String configurationId) { - this.configurationId = configurationId; - return this; - } - - /** - * Set the language. - * - * @param language the language - * @return the CreateCollectionOptions builder - */ - public Builder language(String language) { - this.language = language; - return this; - } - } - - protected CreateCollectionOptions() {} - - protected CreateCollectionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, "name cannot be null"); - environmentId = builder.environmentId; - name = builder.name; - description = builder.description; - configurationId = builder.configurationId; - language = builder.language; - } - - /** - * New builder. - * - * @return a CreateCollectionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the name. - * - *

The name of the collection to be created. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - *

A description of the collection. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the configurationId. - * - *

The ID of the configuration in which the collection is to be created. - * - * @return the configurationId - */ - public String configurationId() { - return configurationId; - } - - /** - * Gets the language. - * - *

The language of the documents stored in the collection, in the form of an ISO 639-1 language - * code. - * - * @return the language - */ - public String language() { - return language; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateConfigurationOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateConfigurationOptions.java deleted file mode 100644 index 60345831170..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateConfigurationOptions.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** The createConfiguration options. */ -public class CreateConfigurationOptions extends GenericModel { - - protected String environmentId; - protected String name; - protected String description; - protected Conversions conversions; - protected List enrichments; - protected List normalizations; - protected Source source; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String name; - private String description; - private Conversions conversions; - private List enrichments; - private List normalizations; - private Source source; - - /** - * Instantiates a new Builder from an existing CreateConfigurationOptions instance. - * - * @param createConfigurationOptions the instance to initialize the Builder with - */ - private Builder(CreateConfigurationOptions createConfigurationOptions) { - this.environmentId = createConfigurationOptions.environmentId; - this.name = createConfigurationOptions.name; - this.description = createConfigurationOptions.description; - this.conversions = createConfigurationOptions.conversions; - this.enrichments = createConfigurationOptions.enrichments; - this.normalizations = createConfigurationOptions.normalizations; - this.source = createConfigurationOptions.source; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param name the name - */ - public Builder(String environmentId, String name) { - this.environmentId = environmentId; - this.name = name; - } - - /** - * Builds a CreateConfigurationOptions. - * - * @return the new CreateConfigurationOptions instance - */ - public CreateConfigurationOptions build() { - return new CreateConfigurationOptions(this); - } - - /** - * Adds a new element to enrichments. - * - * @param enrichment the new element to be added - * @return the CreateConfigurationOptions builder - */ - public Builder addEnrichment(Enrichment enrichment) { - com.ibm.cloud.sdk.core.util.Validator.notNull(enrichment, "enrichment cannot be null"); - if (this.enrichments == null) { - this.enrichments = new ArrayList(); - } - this.enrichments.add(enrichment); - return this; - } - - /** - * Adds a new element to normalizations. - * - * @param normalization the new element to be added - * @return the CreateConfigurationOptions builder - */ - public Builder addNormalization(NormalizationOperation normalization) { - com.ibm.cloud.sdk.core.util.Validator.notNull(normalization, "normalization cannot be null"); - if (this.normalizations == null) { - this.normalizations = new ArrayList(); - } - this.normalizations.add(normalization); - return this; - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the CreateConfigurationOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateConfigurationOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateConfigurationOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the conversions. - * - * @param conversions the conversions - * @return the CreateConfigurationOptions builder - */ - public Builder conversions(Conversions conversions) { - this.conversions = conversions; - return this; - } - - /** - * Set the enrichments. Existing enrichments will be replaced. - * - * @param enrichments the enrichments - * @return the CreateConfigurationOptions builder - */ - public Builder enrichments(List enrichments) { - this.enrichments = enrichments; - return this; - } - - /** - * Set the normalizations. Existing normalizations will be replaced. - * - * @param normalizations the normalizations - * @return the CreateConfigurationOptions builder - */ - public Builder normalizations(List normalizations) { - this.normalizations = normalizations; - return this; - } - - /** - * Set the source. - * - * @param source the source - * @return the CreateConfigurationOptions builder - */ - public Builder source(Source source) { - this.source = source; - return this; - } - - /** - * Set the configuration. - * - * @param configuration the configuration - * @return the CreateConfigurationOptions builder - */ - public Builder configuration(Configuration configuration) { - this.name = configuration.name(); - this.description = configuration.description(); - this.conversions = configuration.conversions(); - this.enrichments = configuration.enrichments(); - this.normalizations = configuration.normalizations(); - this.source = configuration.source(); - return this; - } - } - - protected CreateConfigurationOptions() {} - - protected CreateConfigurationOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, "name cannot be null"); - environmentId = builder.environmentId; - name = builder.name; - description = builder.description; - conversions = builder.conversions; - enrichments = builder.enrichments; - normalizations = builder.normalizations; - source = builder.source; - } - - /** - * New builder. - * - * @return a CreateConfigurationOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the name. - * - *

The name of the configuration. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - *

The description of the configuration, if available. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the conversions. - * - *

Document conversion settings. - * - * @return the conversions - */ - public Conversions conversions() { - return conversions; - } - - /** - * Gets the enrichments. - * - *

An array of document enrichment settings for the configuration. - * - * @return the enrichments - */ - public List enrichments() { - return enrichments; - } - - /** - * Gets the normalizations. - * - *

Defines operations that can be used to transform the final output JSON into a normalized - * form. Operations are executed in the order that they appear in the array. - * - * @return the normalizations - */ - public List normalizations() { - return normalizations; - } - - /** - * Gets the source. - * - *

Object containing source parameters for the configuration. - * - * @return the source - */ - public Source source() { - return source; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptions.java deleted file mode 100644 index 5ca84b44209..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptions.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The createCredentials options. */ -public class CreateCredentialsOptions extends GenericModel { - - /** - * The source that this credentials object connects to. - `box` indicates the credentials are used - * to connect an instance of Enterprise Box. - `salesforce` indicates the credentials are used to - * connect to Salesforce. - `sharepoint` indicates the credentials are used to connect to - * Microsoft SharePoint Online. - `web_crawl` indicates the credentials are used to perform a web - * crawl. = `cloud_object_storage` indicates the credentials are used to connect to an IBM Cloud - * Object Store. - */ - public interface SourceType { - /** box. */ - String BOX = "box"; - /** salesforce. */ - String SALESFORCE = "salesforce"; - /** sharepoint. */ - String SHAREPOINT = "sharepoint"; - /** web_crawl. */ - String WEB_CRAWL = "web_crawl"; - /** cloud_object_storage. */ - String CLOUD_OBJECT_STORAGE = "cloud_object_storage"; - } - - protected String environmentId; - protected String sourceType; - protected CredentialDetails credentialDetails; - protected StatusDetails status; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String sourceType; - private CredentialDetails credentialDetails; - private StatusDetails status; - - /** - * Instantiates a new Builder from an existing CreateCredentialsOptions instance. - * - * @param createCredentialsOptions the instance to initialize the Builder with - */ - private Builder(CreateCredentialsOptions createCredentialsOptions) { - this.environmentId = createCredentialsOptions.environmentId; - this.sourceType = createCredentialsOptions.sourceType; - this.credentialDetails = createCredentialsOptions.credentialDetails; - this.status = createCredentialsOptions.status; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - */ - public Builder(String environmentId) { - this.environmentId = environmentId; - } - - /** - * Builds a CreateCredentialsOptions. - * - * @return the new CreateCredentialsOptions instance - */ - public CreateCredentialsOptions build() { - return new CreateCredentialsOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the CreateCredentialsOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the sourceType. - * - * @param sourceType the sourceType - * @return the CreateCredentialsOptions builder - */ - public Builder sourceType(String sourceType) { - this.sourceType = sourceType; - return this; - } - - /** - * Set the credentialDetails. - * - * @param credentialDetails the credentialDetails - * @return the CreateCredentialsOptions builder - */ - public Builder credentialDetails(CredentialDetails credentialDetails) { - this.credentialDetails = credentialDetails; - return this; - } - - /** - * Set the status. - * - * @param status the status - * @return the CreateCredentialsOptions builder - */ - public Builder status(StatusDetails status) { - this.status = status; - return this; - } - - /** - * Set the credentials. - * - * @param credentials the credentials - * @return the CreateCredentialsOptions builder - */ - public Builder credentials(Credentials credentials) { - this.sourceType = credentials.sourceType(); - this.credentialDetails = credentials.credentialDetails(); - this.status = credentials.status(); - return this; - } - } - - protected CreateCredentialsOptions() {} - - protected CreateCredentialsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - environmentId = builder.environmentId; - sourceType = builder.sourceType; - credentialDetails = builder.credentialDetails; - status = builder.status; - } - - /** - * New builder. - * - * @return a CreateCredentialsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the sourceType. - * - *

The source that this credentials object connects to. - `box` indicates the credentials are - * used to connect an instance of Enterprise Box. - `salesforce` indicates the credentials are - * used to connect to Salesforce. - `sharepoint` indicates the credentials are used to connect to - * Microsoft SharePoint Online. - `web_crawl` indicates the credentials are used to perform a web - * crawl. = `cloud_object_storage` indicates the credentials are used to connect to an IBM Cloud - * Object Store. - * - * @return the sourceType - */ - public String sourceType() { - return sourceType; - } - - /** - * Gets the credentialDetails. - * - *

Object containing details of the stored credentials. - * - *

Obtain credentials for your source from the administrator of the source. - * - * @return the credentialDetails - */ - public CredentialDetails credentialDetails() { - return credentialDetails; - } - - /** - * Gets the status. - * - *

Object that contains details about the status of the authentication process. - * - * @return the status - */ - public StatusDetails status() { - return status; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEnvironmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEnvironmentOptions.java deleted file mode 100644 index 07641b9f177..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEnvironmentOptions.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The createEnvironment options. */ -public class CreateEnvironmentOptions extends GenericModel { - - /** - * Size of the environment. In the Lite plan the default and only accepted value is `LT`, in all - * other plans the default is `S`. - */ - public interface Size { - /** LT. */ - String LT = "LT"; - /** XS. */ - String XS = "XS"; - /** S. */ - String S = "S"; - /** MS. */ - String MS = "MS"; - /** M. */ - String M = "M"; - /** ML. */ - String ML = "ML"; - /** L. */ - String L = "L"; - /** XL. */ - String XL = "XL"; - /** XXL. */ - String XXL = "XXL"; - /** XXXL. */ - String XXXL = "XXXL"; - } - - protected String name; - protected String description; - protected String size; - - /** Builder. */ - public static class Builder { - private String name; - private String description; - private String size; - - /** - * Instantiates a new Builder from an existing CreateEnvironmentOptions instance. - * - * @param createEnvironmentOptions the instance to initialize the Builder with - */ - private Builder(CreateEnvironmentOptions createEnvironmentOptions) { - this.name = createEnvironmentOptions.name; - this.description = createEnvironmentOptions.description; - this.size = createEnvironmentOptions.size; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - */ - public Builder(String name) { - this.name = name; - } - - /** - * Builds a CreateEnvironmentOptions. - * - * @return the new CreateEnvironmentOptions instance - */ - public CreateEnvironmentOptions build() { - return new CreateEnvironmentOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateEnvironmentOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the CreateEnvironmentOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the size. - * - * @param size the size - * @return the CreateEnvironmentOptions builder - */ - public Builder size(String size) { - this.size = size; - return this; - } - } - - protected CreateEnvironmentOptions() {} - - protected CreateEnvironmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, "name cannot be null"); - name = builder.name; - description = builder.description; - size = builder.size; - } - - /** - * New builder. - * - * @return a CreateEnvironmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - *

Name that identifies the environment. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - *

Description of the environment. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the size. - * - *

Size of the environment. In the Lite plan the default and only accepted value is `LT`, in - * all other plans the default is `S`. - * - * @return the size - */ - public String size() { - return size; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventOptions.java deleted file mode 100644 index ae055f13d5c..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventOptions.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The createEvent options. */ -public class CreateEventOptions extends GenericModel { - - /** The event type to be created. */ - public interface Type { - /** click. */ - String CLICK = "click"; - } - - protected String type; - protected EventData data; - - /** Builder. */ - public static class Builder { - private String type; - private EventData data; - - /** - * Instantiates a new Builder from an existing CreateEventOptions instance. - * - * @param createEventOptions the instance to initialize the Builder with - */ - private Builder(CreateEventOptions createEventOptions) { - this.type = createEventOptions.type; - this.data = createEventOptions.data; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param type the type - * @param data the data - */ - public Builder(String type, EventData data) { - this.type = type; - this.data = data; - } - - /** - * Builds a CreateEventOptions. - * - * @return the new CreateEventOptions instance - */ - public CreateEventOptions build() { - return new CreateEventOptions(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the CreateEventOptions builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the data. - * - * @param data the data - * @return the CreateEventOptions builder - */ - public Builder data(EventData data) { - this.data = data; - return this; - } - } - - protected CreateEventOptions() {} - - protected CreateEventOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.type, "type cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.data, "data cannot be null"); - type = builder.type; - data = builder.data; - } - - /** - * New builder. - * - * @return a CreateEventOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - *

The event type to be created. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the data. - * - *

Query event data object. - * - * @return the data - */ - public EventData data() { - return data; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventResponse.java deleted file mode 100644 index 15ad5a2adfb..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateEventResponse.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** An object defining the event being created. */ -public class CreateEventResponse extends GenericModel { - - /** The event type that was created. */ - public interface Type { - /** click. */ - String CLICK = "click"; - } - - protected String type; - protected EventData data; - - protected CreateEventResponse() {} - - /** - * Gets the type. - * - *

The event type that was created. - * - * @return the type - */ - public String getType() { - return type; - } - - /** - * Gets the data. - * - *

Query event data object. - * - * @return the data - */ - public EventData getData() { - return data; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateExpansionsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateExpansionsOptions.java deleted file mode 100644 index eedede7f9e3..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateExpansionsOptions.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** The createExpansions options. */ -public class CreateExpansionsOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected List expansions; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private List expansions; - - /** - * Instantiates a new Builder from an existing CreateExpansionsOptions instance. - * - * @param createExpansionsOptions the instance to initialize the Builder with - */ - private Builder(CreateExpansionsOptions createExpansionsOptions) { - this.environmentId = createExpansionsOptions.environmentId; - this.collectionId = createExpansionsOptions.collectionId; - this.expansions = createExpansionsOptions.expansions; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param expansions the expansions - */ - public Builder(String environmentId, String collectionId, List expansions) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.expansions = expansions; - } - - /** - * Builds a CreateExpansionsOptions. - * - * @return the new CreateExpansionsOptions instance - */ - public CreateExpansionsOptions build() { - return new CreateExpansionsOptions(this); - } - - /** - * Adds a new element to expansions. - * - * @param expansions the new element to be added - * @return the CreateExpansionsOptions builder - */ - public Builder addExpansions(Expansion expansions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(expansions, "expansions cannot be null"); - if (this.expansions == null) { - this.expansions = new ArrayList(); - } - this.expansions.add(expansions); - return this; - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the CreateExpansionsOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the CreateExpansionsOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the expansions. Existing expansions will be replaced. - * - * @param expansions the expansions - * @return the CreateExpansionsOptions builder - */ - public Builder expansions(List expansions) { - this.expansions = expansions; - return this; - } - - /** - * Set the expansions. - * - * @param expansions the expansions - * @return the CreateExpansionsOptions builder - */ - public Builder expansions(Expansions expansions) { - this.expansions = expansions.expansions(); - return this; - } - } - - protected CreateExpansionsOptions() {} - - protected CreateExpansionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.expansions, "expansions cannot be null"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - expansions = builder.expansions; - } - - /** - * New builder. - * - * @return a CreateExpansionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the expansions. - * - *

An array of query expansion definitions. - * - *

Each object in the **expansions** array represents a term or set of terms that will be - * expanded into other terms. Each expansion object can be configured as bidirectional or - * unidirectional. Bidirectional means that all terms are expanded to all other terms in the - * object. Unidirectional means that a set list of terms can be expanded into a second list of - * terms. - * - *

To create a bi-directional expansion specify an **expanded_terms** array. When found in a - * query, all items in the **expanded_terms** array are then expanded to the other items in the - * same array. - * - *

To create a uni-directional expansion, specify both an array of **input_terms** and an array - * of **expanded_terms**. When items in the **input_terms** array are present in a query, they are - * expanded using the items listed in the **expanded_terms** array. - * - * @return the expansions - */ - public List expansions() { - return expansions; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateGatewayOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateGatewayOptions.java deleted file mode 100644 index b7b0c94f6b5..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateGatewayOptions.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The createGateway options. */ -public class CreateGatewayOptions extends GenericModel { - - protected String environmentId; - protected String name; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String name; - - /** - * Instantiates a new Builder from an existing CreateGatewayOptions instance. - * - * @param createGatewayOptions the instance to initialize the Builder with - */ - private Builder(CreateGatewayOptions createGatewayOptions) { - this.environmentId = createGatewayOptions.environmentId; - this.name = createGatewayOptions.name; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - */ - public Builder(String environmentId) { - this.environmentId = environmentId; - } - - /** - * Builds a CreateGatewayOptions. - * - * @return the new CreateGatewayOptions instance - */ - public CreateGatewayOptions build() { - return new CreateGatewayOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the CreateGatewayOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the CreateGatewayOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - } - - protected CreateGatewayOptions() {} - - protected CreateGatewayOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - environmentId = builder.environmentId; - name = builder.name; - } - - /** - * New builder. - * - * @return a CreateGatewayOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the name. - * - *

User-defined name. - * - * @return the name - */ - public String name() { - return name; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateStopwordListOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateStopwordListOptions.java deleted file mode 100644 index bd8de9d527c..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateStopwordListOptions.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; - -/** The createStopwordList options. */ -public class CreateStopwordListOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected InputStream stopwordFile; - protected String stopwordFilename; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private InputStream stopwordFile; - private String stopwordFilename; - - /** - * Instantiates a new Builder from an existing CreateStopwordListOptions instance. - * - * @param createStopwordListOptions the instance to initialize the Builder with - */ - private Builder(CreateStopwordListOptions createStopwordListOptions) { - this.environmentId = createStopwordListOptions.environmentId; - this.collectionId = createStopwordListOptions.collectionId; - this.stopwordFile = createStopwordListOptions.stopwordFile; - this.stopwordFilename = createStopwordListOptions.stopwordFilename; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param stopwordFile the stopwordFile - * @param stopwordFilename the stopwordFilename - */ - public Builder( - String environmentId, - String collectionId, - InputStream stopwordFile, - String stopwordFilename) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.stopwordFile = stopwordFile; - this.stopwordFilename = stopwordFilename; - } - - /** - * Builds a CreateStopwordListOptions. - * - * @return the new CreateStopwordListOptions instance - */ - public CreateStopwordListOptions build() { - return new CreateStopwordListOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the CreateStopwordListOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the CreateStopwordListOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the stopwordFile. - * - * @param stopwordFile the stopwordFile - * @return the CreateStopwordListOptions builder - */ - public Builder stopwordFile(InputStream stopwordFile) { - this.stopwordFile = stopwordFile; - return this; - } - - /** - * Set the stopwordFilename. - * - * @param stopwordFilename the stopwordFilename - * @return the CreateStopwordListOptions builder - */ - public Builder stopwordFilename(String stopwordFilename) { - this.stopwordFilename = stopwordFilename; - return this; - } - - /** - * Set the stopwordFile. - * - * @param stopwordFile the stopwordFile - * @return the CreateStopwordListOptions builder - * @throws FileNotFoundException if the file could not be found - */ - public Builder stopwordFile(File stopwordFile) throws FileNotFoundException { - this.stopwordFile = new FileInputStream(stopwordFile); - this.stopwordFilename = stopwordFile.getName(); - return this; - } - } - - protected CreateStopwordListOptions() {} - - protected CreateStopwordListOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.stopwordFile, "stopwordFile cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.stopwordFilename, "stopwordFilename cannot be null"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - stopwordFile = builder.stopwordFile; - stopwordFilename = builder.stopwordFilename; - } - - /** - * New builder. - * - * @return a CreateStopwordListOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the stopwordFile. - * - *

The content of the stopword list to ingest. - * - * @return the stopwordFile - */ - public InputStream stopwordFile() { - return stopwordFile; - } - - /** - * Gets the stopwordFilename. - * - *

The filename for stopwordFile. - * - * @return the stopwordFilename - */ - public String stopwordFilename() { - return stopwordFilename; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTokenizationDictionaryOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTokenizationDictionaryOptions.java deleted file mode 100644 index 72dc5d3c715..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTokenizationDictionaryOptions.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** The createTokenizationDictionary options. */ -public class CreateTokenizationDictionaryOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected List tokenizationRules; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private List tokenizationRules; - - /** - * Instantiates a new Builder from an existing CreateTokenizationDictionaryOptions instance. - * - * @param createTokenizationDictionaryOptions the instance to initialize the Builder with - */ - private Builder(CreateTokenizationDictionaryOptions createTokenizationDictionaryOptions) { - this.environmentId = createTokenizationDictionaryOptions.environmentId; - this.collectionId = createTokenizationDictionaryOptions.collectionId; - this.tokenizationRules = createTokenizationDictionaryOptions.tokenizationRules; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a CreateTokenizationDictionaryOptions. - * - * @return the new CreateTokenizationDictionaryOptions instance - */ - public CreateTokenizationDictionaryOptions build() { - return new CreateTokenizationDictionaryOptions(this); - } - - /** - * Adds a new element to tokenizationRules. - * - * @param tokenizationRules the new element to be added - * @return the CreateTokenizationDictionaryOptions builder - */ - public Builder addTokenizationRules(TokenDictRule tokenizationRules) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - tokenizationRules, "tokenizationRules cannot be null"); - if (this.tokenizationRules == null) { - this.tokenizationRules = new ArrayList(); - } - this.tokenizationRules.add(tokenizationRules); - return this; - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the CreateTokenizationDictionaryOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the CreateTokenizationDictionaryOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the tokenizationRules. Existing tokenizationRules will be replaced. - * - * @param tokenizationRules the tokenizationRules - * @return the CreateTokenizationDictionaryOptions builder - */ - public Builder tokenizationRules(List tokenizationRules) { - this.tokenizationRules = tokenizationRules; - return this; - } - } - - protected CreateTokenizationDictionaryOptions() {} - - protected CreateTokenizationDictionaryOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - tokenizationRules = builder.tokenizationRules; - } - - /** - * New builder. - * - * @return a CreateTokenizationDictionaryOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the tokenizationRules. - * - *

An array of tokenization rules. Each rule contains, the original `text` string, component - * `tokens`, any alternate character set `readings`, and which `part_of_speech` the text is from. - * - * @return the tokenizationRules - */ - public List tokenizationRules() { - return tokenizationRules; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTrainingExampleOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTrainingExampleOptions.java deleted file mode 100644 index 50c06254b5a..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CreateTrainingExampleOptions.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The createTrainingExample options. */ -public class CreateTrainingExampleOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String queryId; - protected String documentId; - protected String crossReference; - protected Long relevance; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String queryId; - private String documentId; - private String crossReference; - private Long relevance; - - /** - * Instantiates a new Builder from an existing CreateTrainingExampleOptions instance. - * - * @param createTrainingExampleOptions the instance to initialize the Builder with - */ - private Builder(CreateTrainingExampleOptions createTrainingExampleOptions) { - this.environmentId = createTrainingExampleOptions.environmentId; - this.collectionId = createTrainingExampleOptions.collectionId; - this.queryId = createTrainingExampleOptions.queryId; - this.documentId = createTrainingExampleOptions.documentId; - this.crossReference = createTrainingExampleOptions.crossReference; - this.relevance = createTrainingExampleOptions.relevance; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param queryId the queryId - */ - public Builder(String environmentId, String collectionId, String queryId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.queryId = queryId; - } - - /** - * Builds a CreateTrainingExampleOptions. - * - * @return the new CreateTrainingExampleOptions instance - */ - public CreateTrainingExampleOptions build() { - return new CreateTrainingExampleOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the CreateTrainingExampleOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the CreateTrainingExampleOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the queryId. - * - * @param queryId the queryId - * @return the CreateTrainingExampleOptions builder - */ - public Builder queryId(String queryId) { - this.queryId = queryId; - return this; - } - - /** - * Set the documentId. - * - * @param documentId the documentId - * @return the CreateTrainingExampleOptions builder - */ - public Builder documentId(String documentId) { - this.documentId = documentId; - return this; - } - - /** - * Set the crossReference. - * - * @param crossReference the crossReference - * @return the CreateTrainingExampleOptions builder - */ - public Builder crossReference(String crossReference) { - this.crossReference = crossReference; - return this; - } - - /** - * Set the relevance. - * - * @param relevance the relevance - * @return the CreateTrainingExampleOptions builder - */ - public Builder relevance(long relevance) { - this.relevance = relevance; - return this; - } - - /** - * Set the trainingExample. - * - * @param trainingExample the trainingExample - * @return the CreateTrainingExampleOptions builder - */ - public Builder trainingExample(TrainingExample trainingExample) { - this.documentId = trainingExample.documentId(); - this.crossReference = trainingExample.crossReference(); - this.relevance = trainingExample.relevance(); - return this; - } - } - - protected CreateTrainingExampleOptions() {} - - protected CreateTrainingExampleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, "queryId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - queryId = builder.queryId; - documentId = builder.documentId; - crossReference = builder.crossReference; - relevance = builder.relevance; - } - - /** - * New builder. - * - * @return a CreateTrainingExampleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the queryId. - * - *

The ID of the query used for training. - * - * @return the queryId - */ - public String queryId() { - return queryId; - } - - /** - * Gets the documentId. - * - *

The document ID associated with this training example. - * - * @return the documentId - */ - public String documentId() { - return documentId; - } - - /** - * Gets the crossReference. - * - *

The cross reference associated with this training example. - * - * @return the crossReference - */ - public String crossReference() { - return crossReference; - } - - /** - * Gets the relevance. - * - *

The relevance of the training example. - * - * @return the relevance - */ - public Long relevance() { - return relevance; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java deleted file mode 100644 index 0cce6cc5bde..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialDetails.java +++ /dev/null @@ -1,662 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Object containing details of the stored credentials. - * - *

Obtain credentials for your source from the administrator of the source. - */ -public class CredentialDetails extends GenericModel { - - /** - * The authentication method for this credentials definition. The **credential_type** specified - * must be supported by the **source_type**. The following combinations are possible: - * - *

- `"source_type": "box"` - valid `credential_type`s: `oauth2` - `"source_type": - * "salesforce"` - valid `credential_type`s: `username_password` - `"source_type": "sharepoint"` - - * valid `credential_type`s: `saml` with **source_version** of `online`, or `ntlm_v1` with - * **source_version** of `2016` - `"source_type": "web_crawl"` - valid `credential_type`s: - * `noauth` or `basic` - "source_type": "cloud_object_storage"` - valid `credential_type`s: - * `aws4_hmac`. - */ - public interface CredentialType { - /** oauth2. */ - String OAUTH2 = "oauth2"; - /** saml. */ - String SAML = "saml"; - /** username_password. */ - String USERNAME_PASSWORD = "username_password"; - /** noauth. */ - String NOAUTH = "noauth"; - /** basic. */ - String BASIC = "basic"; - /** ntlm_v1. */ - String NTLM_V1 = "ntlm_v1"; - /** aws4_hmac. */ - String AWS4_HMAC = "aws4_hmac"; - } - - /** - * The type of Sharepoint repository to connect to. Only valid, and required, with a - * **source_type** of `sharepoint`. - */ - public interface SourceVersion { - /** online. */ - String ONLINE = "online"; - } - - @SerializedName("credential_type") - protected String credentialType; - - @SerializedName("client_id") - protected String clientId; - - @SerializedName("enterprise_id") - protected String enterpriseId; - - protected String url; - protected String username; - - @SerializedName("organization_url") - protected String organizationUrl; - - @SerializedName("site_collection.path") - protected String siteCollectionPath; - - @SerializedName("client_secret") - protected String clientSecret; - - @SerializedName("public_key_id") - protected String publicKeyId; - - @SerializedName("private_key") - protected String privateKey; - - protected String passphrase; - protected String password; - - @SerializedName("gateway_id") - protected String gatewayId; - - @SerializedName("source_version") - protected String sourceVersion; - - @SerializedName("web_application_url") - protected String webApplicationUrl; - - protected String domain; - protected String endpoint; - - @SerializedName("access_key_id") - protected String accessKeyId; - - @SerializedName("secret_access_key") - protected String secretAccessKey; - - /** Builder. */ - public static class Builder { - private String credentialType; - private String clientId; - private String enterpriseId; - private String url; - private String username; - private String organizationUrl; - private String siteCollectionPath; - private String clientSecret; - private String publicKeyId; - private String privateKey; - private String passphrase; - private String password; - private String gatewayId; - private String sourceVersion; - private String webApplicationUrl; - private String domain; - private String endpoint; - private String accessKeyId; - private String secretAccessKey; - - /** - * Instantiates a new Builder from an existing CredentialDetails instance. - * - * @param credentialDetails the instance to initialize the Builder with - */ - private Builder(CredentialDetails credentialDetails) { - this.credentialType = credentialDetails.credentialType; - this.clientId = credentialDetails.clientId; - this.enterpriseId = credentialDetails.enterpriseId; - this.url = credentialDetails.url; - this.username = credentialDetails.username; - this.organizationUrl = credentialDetails.organizationUrl; - this.siteCollectionPath = credentialDetails.siteCollectionPath; - this.clientSecret = credentialDetails.clientSecret; - this.publicKeyId = credentialDetails.publicKeyId; - this.privateKey = credentialDetails.privateKey; - this.passphrase = credentialDetails.passphrase; - this.password = credentialDetails.password; - this.gatewayId = credentialDetails.gatewayId; - this.sourceVersion = credentialDetails.sourceVersion; - this.webApplicationUrl = credentialDetails.webApplicationUrl; - this.domain = credentialDetails.domain; - this.endpoint = credentialDetails.endpoint; - this.accessKeyId = credentialDetails.accessKeyId; - this.secretAccessKey = credentialDetails.secretAccessKey; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a CredentialDetails. - * - * @return the new CredentialDetails instance - */ - public CredentialDetails build() { - return new CredentialDetails(this); - } - - /** - * Set the credentialType. - * - * @param credentialType the credentialType - * @return the CredentialDetails builder - */ - public Builder credentialType(String credentialType) { - this.credentialType = credentialType; - return this; - } - - /** - * Set the clientId. - * - * @param clientId the clientId - * @return the CredentialDetails builder - */ - public Builder clientId(String clientId) { - this.clientId = clientId; - return this; - } - - /** - * Set the enterpriseId. - * - * @param enterpriseId the enterpriseId - * @return the CredentialDetails builder - */ - public Builder enterpriseId(String enterpriseId) { - this.enterpriseId = enterpriseId; - return this; - } - - /** - * Set the url. - * - * @param url the url - * @return the CredentialDetails builder - */ - public Builder url(String url) { - this.url = url; - return this; - } - - /** - * Set the username. - * - * @param username the username - * @return the CredentialDetails builder - */ - public Builder username(String username) { - this.username = username; - return this; - } - - /** - * Set the organizationUrl. - * - * @param organizationUrl the organizationUrl - * @return the CredentialDetails builder - */ - public Builder organizationUrl(String organizationUrl) { - this.organizationUrl = organizationUrl; - return this; - } - - /** - * Set the siteCollectionPath. - * - * @param siteCollectionPath the siteCollectionPath - * @return the CredentialDetails builder - */ - public Builder siteCollectionPath(String siteCollectionPath) { - this.siteCollectionPath = siteCollectionPath; - return this; - } - - /** - * Set the clientSecret. - * - * @param clientSecret the clientSecret - * @return the CredentialDetails builder - */ - public Builder clientSecret(String clientSecret) { - this.clientSecret = clientSecret; - return this; - } - - /** - * Set the publicKeyId. - * - * @param publicKeyId the publicKeyId - * @return the CredentialDetails builder - */ - public Builder publicKeyId(String publicKeyId) { - this.publicKeyId = publicKeyId; - return this; - } - - /** - * Set the privateKey. - * - * @param privateKey the privateKey - * @return the CredentialDetails builder - */ - public Builder privateKey(String privateKey) { - this.privateKey = privateKey; - return this; - } - - /** - * Set the passphrase. - * - * @param passphrase the passphrase - * @return the CredentialDetails builder - */ - public Builder passphrase(String passphrase) { - this.passphrase = passphrase; - return this; - } - - /** - * Set the password. - * - * @param password the password - * @return the CredentialDetails builder - */ - public Builder password(String password) { - this.password = password; - return this; - } - - /** - * Set the gatewayId. - * - * @param gatewayId the gatewayId - * @return the CredentialDetails builder - */ - public Builder gatewayId(String gatewayId) { - this.gatewayId = gatewayId; - return this; - } - - /** - * Set the sourceVersion. - * - * @param sourceVersion the sourceVersion - * @return the CredentialDetails builder - */ - public Builder sourceVersion(String sourceVersion) { - this.sourceVersion = sourceVersion; - return this; - } - - /** - * Set the webApplicationUrl. - * - * @param webApplicationUrl the webApplicationUrl - * @return the CredentialDetails builder - */ - public Builder webApplicationUrl(String webApplicationUrl) { - this.webApplicationUrl = webApplicationUrl; - return this; - } - - /** - * Set the domain. - * - * @param domain the domain - * @return the CredentialDetails builder - */ - public Builder domain(String domain) { - this.domain = domain; - return this; - } - - /** - * Set the endpoint. - * - * @param endpoint the endpoint - * @return the CredentialDetails builder - */ - public Builder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /** - * Set the accessKeyId. - * - * @param accessKeyId the accessKeyId - * @return the CredentialDetails builder - */ - public Builder accessKeyId(String accessKeyId) { - this.accessKeyId = accessKeyId; - return this; - } - - /** - * Set the secretAccessKey. - * - * @param secretAccessKey the secretAccessKey - * @return the CredentialDetails builder - */ - public Builder secretAccessKey(String secretAccessKey) { - this.secretAccessKey = secretAccessKey; - return this; - } - } - - protected CredentialDetails() {} - - protected CredentialDetails(Builder builder) { - credentialType = builder.credentialType; - clientId = builder.clientId; - enterpriseId = builder.enterpriseId; - url = builder.url; - username = builder.username; - organizationUrl = builder.organizationUrl; - siteCollectionPath = builder.siteCollectionPath; - clientSecret = builder.clientSecret; - publicKeyId = builder.publicKeyId; - privateKey = builder.privateKey; - passphrase = builder.passphrase; - password = builder.password; - gatewayId = builder.gatewayId; - sourceVersion = builder.sourceVersion; - webApplicationUrl = builder.webApplicationUrl; - domain = builder.domain; - endpoint = builder.endpoint; - accessKeyId = builder.accessKeyId; - secretAccessKey = builder.secretAccessKey; - } - - /** - * New builder. - * - * @return a CredentialDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the credentialType. - * - *

The authentication method for this credentials definition. The **credential_type** specified - * must be supported by the **source_type**. The following combinations are possible: - * - *

- `"source_type": "box"` - valid `credential_type`s: `oauth2` - `"source_type": - * "salesforce"` - valid `credential_type`s: `username_password` - `"source_type": "sharepoint"` - - * valid `credential_type`s: `saml` with **source_version** of `online`, or `ntlm_v1` with - * **source_version** of `2016` - `"source_type": "web_crawl"` - valid `credential_type`s: - * `noauth` or `basic` - "source_type": "cloud_object_storage"` - valid `credential_type`s: - * `aws4_hmac`. - * - * @return the credentialType - */ - public String credentialType() { - return credentialType; - } - - /** - * Gets the clientId. - * - *

The **client_id** of the source that these credentials connect to. Only valid, and required, - * with a **credential_type** of `oauth2`. - * - * @return the clientId - */ - public String clientId() { - return clientId; - } - - /** - * Gets the enterpriseId. - * - *

The **enterprise_id** of the Box site that these credentials connect to. Only valid, and - * required, with a **source_type** of `box`. - * - * @return the enterpriseId - */ - public String enterpriseId() { - return enterpriseId; - } - - /** - * Gets the url. - * - *

The **url** of the source that these credentials connect to. Only valid, and required, with - * a **credential_type** of `username_password`, `noauth`, and `basic`. - * - * @return the url - */ - public String url() { - return url; - } - - /** - * Gets the username. - * - *

The **username** of the source that these credentials connect to. Only valid, and required, - * with a **credential_type** of `saml`, `username_password`, `basic`, or `ntlm_v1`. - * - * @return the username - */ - public String username() { - return username; - } - - /** - * Gets the organizationUrl. - * - *

The **organization_url** of the source that these credentials connect to. Only valid, and - * required, with a **credential_type** of `saml`. - * - * @return the organizationUrl - */ - public String organizationUrl() { - return organizationUrl; - } - - /** - * Gets the siteCollectionPath. - * - *

The **site_collection.path** of the source that these credentials connect to. Only valid, - * and required, with a **source_type** of `sharepoint`. - * - * @return the siteCollectionPath - */ - public String siteCollectionPath() { - return siteCollectionPath; - } - - /** - * Gets the clientSecret. - * - *

The **client_secret** of the source that these credentials connect to. Only valid, and - * required, with a **credential_type** of `oauth2`. This value is never returned and is only used - * when creating or modifying **credentials**. - * - * @return the clientSecret - */ - public String clientSecret() { - return clientSecret; - } - - /** - * Gets the publicKeyId. - * - *

The **public_key_id** of the source that these credentials connect to. Only valid, and - * required, with a **credential_type** of `oauth2`. This value is never returned and is only used - * when creating or modifying **credentials**. - * - * @return the publicKeyId - */ - public String publicKeyId() { - return publicKeyId; - } - - /** - * Gets the privateKey. - * - *

The **private_key** of the source that these credentials connect to. Only valid, and - * required, with a **credential_type** of `oauth2`. This value is never returned and is only used - * when creating or modifying **credentials**. - * - * @return the privateKey - */ - public String privateKey() { - return privateKey; - } - - /** - * Gets the passphrase. - * - *

The **passphrase** of the source that these credentials connect to. Only valid, and - * required, with a **credential_type** of `oauth2`. This value is never returned and is only used - * when creating or modifying **credentials**. - * - * @return the passphrase - */ - public String passphrase() { - return passphrase; - } - - /** - * Gets the password. - * - *

The **password** of the source that these credentials connect to. Only valid, and required, - * with **credential_type**s of `saml`, `username_password`, `basic`, or `ntlm_v1`. - * - *

**Note:** When used with a **source_type** of `salesforce`, the password consists of the - * Salesforce password and a valid Salesforce security token concatenated. This value is never - * returned and is only used when creating or modifying **credentials**. - * - * @return the password - */ - public String password() { - return password; - } - - /** - * Gets the gatewayId. - * - *

The ID of the **gateway** to be connected through (when connecting to intranet sites). Only - * valid with a **credential_type** of `noauth`, `basic`, or `ntlm_v1`. Gateways are created using - * the `/v1/environments/{environment_id}/gateways` methods. - * - * @return the gatewayId - */ - public String gatewayId() { - return gatewayId; - } - - /** - * Gets the sourceVersion. - * - *

The type of Sharepoint repository to connect to. Only valid, and required, with a - * **source_type** of `sharepoint`. - * - * @return the sourceVersion - */ - public String sourceVersion() { - return sourceVersion; - } - - /** - * Gets the webApplicationUrl. - * - *

SharePoint OnPrem WebApplication URL. Only valid, and required, with a **source_version** of - * `2016`. If a port is not supplied, the default to port `80` for http and port `443` for https - * connections are used. - * - * @return the webApplicationUrl - */ - public String webApplicationUrl() { - return webApplicationUrl; - } - - /** - * Gets the domain. - * - *

The domain used to log in to your OnPrem SharePoint account. Only valid, and required, with - * a **source_version** of `2016`. - * - * @return the domain - */ - public String domain() { - return domain; - } - - /** - * Gets the endpoint. - * - *

The endpoint associated with the cloud object store that your are connecting to. Only valid, - * and required, with a **credential_type** of `aws4_hmac`. - * - * @return the endpoint - */ - public String endpoint() { - return endpoint; - } - - /** - * Gets the accessKeyId. - * - *

The access key ID associated with the cloud object store. Only valid, and required, with a - * **credential_type** of `aws4_hmac`. This value is never returned and is only used when creating - * or modifying **credentials**. For more infomation, see the [cloud object store - * documentation](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). - * - * @return the accessKeyId - */ - public String accessKeyId() { - return accessKeyId; - } - - /** - * Gets the secretAccessKey. - * - *

The secret access key associated with the cloud object store. Only valid, and required, with - * a **credential_type** of `aws4_hmac`. This value is never returned and is only used when - * creating or modifying **credentials**. For more infomation, see the [cloud object store - * documentation](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-using-hmac-credentials#using-hmac-credentials). - * - * @return the secretAccessKey - */ - public String secretAccessKey() { - return secretAccessKey; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Credentials.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Credentials.java deleted file mode 100644 index f4096547008..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Credentials.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object containing credential information. */ -public class Credentials extends GenericModel { - - /** - * The source that this credentials object connects to. - `box` indicates the credentials are used - * to connect an instance of Enterprise Box. - `salesforce` indicates the credentials are used to - * connect to Salesforce. - `sharepoint` indicates the credentials are used to connect to - * Microsoft SharePoint Online. - `web_crawl` indicates the credentials are used to perform a web - * crawl. = `cloud_object_storage` indicates the credentials are used to connect to an IBM Cloud - * Object Store. - */ - public interface SourceType { - /** box. */ - String BOX = "box"; - /** salesforce. */ - String SALESFORCE = "salesforce"; - /** sharepoint. */ - String SHAREPOINT = "sharepoint"; - /** web_crawl. */ - String WEB_CRAWL = "web_crawl"; - /** cloud_object_storage. */ - String CLOUD_OBJECT_STORAGE = "cloud_object_storage"; - } - - @SerializedName("credential_id") - protected String credentialId; - - @SerializedName("source_type") - protected String sourceType; - - @SerializedName("credential_details") - protected CredentialDetails credentialDetails; - - protected StatusDetails status; - - /** Builder. */ - public static class Builder { - private String sourceType; - private CredentialDetails credentialDetails; - private StatusDetails status; - - /** - * Instantiates a new Builder from an existing Credentials instance. - * - * @param credentials the instance to initialize the Builder with - */ - private Builder(Credentials credentials) { - this.sourceType = credentials.sourceType; - this.credentialDetails = credentials.credentialDetails; - this.status = credentials.status; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a Credentials. - * - * @return the new Credentials instance - */ - public Credentials build() { - return new Credentials(this); - } - - /** - * Set the sourceType. - * - * @param sourceType the sourceType - * @return the Credentials builder - */ - public Builder sourceType(String sourceType) { - this.sourceType = sourceType; - return this; - } - - /** - * Set the credentialDetails. - * - * @param credentialDetails the credentialDetails - * @return the Credentials builder - */ - public Builder credentialDetails(CredentialDetails credentialDetails) { - this.credentialDetails = credentialDetails; - return this; - } - - /** - * Set the status. - * - * @param status the status - * @return the Credentials builder - */ - public Builder status(StatusDetails status) { - this.status = status; - return this; - } - } - - protected Credentials() {} - - protected Credentials(Builder builder) { - sourceType = builder.sourceType; - credentialDetails = builder.credentialDetails; - status = builder.status; - } - - /** - * New builder. - * - * @return a Credentials builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the credentialId. - * - *

Unique identifier for this set of credentials. - * - * @return the credentialId - */ - public String credentialId() { - return credentialId; - } - - /** - * Gets the sourceType. - * - *

The source that this credentials object connects to. - `box` indicates the credentials are - * used to connect an instance of Enterprise Box. - `salesforce` indicates the credentials are - * used to connect to Salesforce. - `sharepoint` indicates the credentials are used to connect to - * Microsoft SharePoint Online. - `web_crawl` indicates the credentials are used to perform a web - * crawl. = `cloud_object_storage` indicates the credentials are used to connect to an IBM Cloud - * Object Store. - * - * @return the sourceType - */ - public String sourceType() { - return sourceType; - } - - /** - * Gets the credentialDetails. - * - *

Object containing details of the stored credentials. - * - *

Obtain credentials for your source from the administrator of the source. - * - * @return the credentialDetails - */ - public CredentialDetails credentialDetails() { - return credentialDetails; - } - - /** - * Gets the status. - * - *

Object that contains details about the status of the authentication process. - * - * @return the status - */ - public StatusDetails status() { - return status; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialsList.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialsList.java deleted file mode 100644 index 6db9646c4f5..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/CredentialsList.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Object containing array of credential definitions. */ -public class CredentialsList extends GenericModel { - - protected List credentials; - - protected CredentialsList() {} - - /** - * Gets the credentials. - * - *

An array of credential definitions that were created for this instance. - * - * @return the credentials - */ - public List getCredentials() { - return credentials; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteAllTrainingDataOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteAllTrainingDataOptions.java deleted file mode 100644 index f8256508c57..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteAllTrainingDataOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The deleteAllTrainingData options. */ -public class DeleteAllTrainingDataOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - - /** - * Instantiates a new Builder from an existing DeleteAllTrainingDataOptions instance. - * - * @param deleteAllTrainingDataOptions the instance to initialize the Builder with - */ - private Builder(DeleteAllTrainingDataOptions deleteAllTrainingDataOptions) { - this.environmentId = deleteAllTrainingDataOptions.environmentId; - this.collectionId = deleteAllTrainingDataOptions.collectionId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a DeleteAllTrainingDataOptions. - * - * @return the new DeleteAllTrainingDataOptions instance - */ - public DeleteAllTrainingDataOptions build() { - return new DeleteAllTrainingDataOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the DeleteAllTrainingDataOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the DeleteAllTrainingDataOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - } - - protected DeleteAllTrainingDataOptions() {} - - protected DeleteAllTrainingDataOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - } - - /** - * New builder. - * - * @return a DeleteAllTrainingDataOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionOptions.java deleted file mode 100644 index d7d5b52e681..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The deleteCollection options. */ -public class DeleteCollectionOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - - /** - * Instantiates a new Builder from an existing DeleteCollectionOptions instance. - * - * @param deleteCollectionOptions the instance to initialize the Builder with - */ - private Builder(DeleteCollectionOptions deleteCollectionOptions) { - this.environmentId = deleteCollectionOptions.environmentId; - this.collectionId = deleteCollectionOptions.collectionId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a DeleteCollectionOptions. - * - * @return the new DeleteCollectionOptions instance - */ - public DeleteCollectionOptions build() { - return new DeleteCollectionOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the DeleteCollectionOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the DeleteCollectionOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - } - - protected DeleteCollectionOptions() {} - - protected DeleteCollectionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - } - - /** - * New builder. - * - * @return a DeleteCollectionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionResponse.java deleted file mode 100644 index ead3c6d7f16..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCollectionResponse.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Response object returned when deleting a colleciton. */ -public class DeleteCollectionResponse extends GenericModel { - - /** The status of the collection. The status of a successful deletion operation is `deleted`. */ - public interface Status { - /** deleted. */ - String DELETED = "deleted"; - } - - @SerializedName("collection_id") - protected String collectionId; - - protected String status; - - protected DeleteCollectionResponse() {} - - /** - * Gets the collectionId. - * - *

The unique identifier of the collection that is being deleted. - * - * @return the collectionId - */ - public String getCollectionId() { - return collectionId; - } - - /** - * Gets the status. - * - *

The status of the collection. The status of a successful deletion operation is `deleted`. - * - * @return the status - */ - public String getStatus() { - return status; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationOptions.java deleted file mode 100644 index 1792e033f87..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The deleteConfiguration options. */ -public class DeleteConfigurationOptions extends GenericModel { - - protected String environmentId; - protected String configurationId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String configurationId; - - /** - * Instantiates a new Builder from an existing DeleteConfigurationOptions instance. - * - * @param deleteConfigurationOptions the instance to initialize the Builder with - */ - private Builder(DeleteConfigurationOptions deleteConfigurationOptions) { - this.environmentId = deleteConfigurationOptions.environmentId; - this.configurationId = deleteConfigurationOptions.configurationId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param configurationId the configurationId - */ - public Builder(String environmentId, String configurationId) { - this.environmentId = environmentId; - this.configurationId = configurationId; - } - - /** - * Builds a DeleteConfigurationOptions. - * - * @return the new DeleteConfigurationOptions instance - */ - public DeleteConfigurationOptions build() { - return new DeleteConfigurationOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the DeleteConfigurationOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the configurationId. - * - * @param configurationId the configurationId - * @return the DeleteConfigurationOptions builder - */ - public Builder configurationId(String configurationId) { - this.configurationId = configurationId; - return this; - } - } - - protected DeleteConfigurationOptions() {} - - protected DeleteConfigurationOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.configurationId, "configurationId cannot be empty"); - environmentId = builder.environmentId; - configurationId = builder.configurationId; - } - - /** - * New builder. - * - * @return a DeleteConfigurationOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the configurationId. - * - *

The ID of the configuration. - * - * @return the configurationId - */ - public String configurationId() { - return configurationId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationResponse.java deleted file mode 100644 index f16984f80fb..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationResponse.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Information returned when a configuration is deleted. */ -public class DeleteConfigurationResponse extends GenericModel { - - /** Status of the configuration. A deleted configuration has the status deleted. */ - public interface Status { - /** deleted. */ - String DELETED = "deleted"; - } - - @SerializedName("configuration_id") - protected String configurationId; - - protected String status; - protected List notices; - - protected DeleteConfigurationResponse() {} - - /** - * Gets the configurationId. - * - *

The unique identifier for the configuration. - * - * @return the configurationId - */ - public String getConfigurationId() { - return configurationId; - } - - /** - * Gets the status. - * - *

Status of the configuration. A deleted configuration has the status deleted. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the notices. - * - *

An array of notice messages, if any. - * - * @return the notices - */ - public List getNotices() { - return notices; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentials.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentials.java deleted file mode 100644 index 6e2ed33ff4c..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentials.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object returned after credentials are deleted. */ -public class DeleteCredentials extends GenericModel { - - /** The status of the deletion request. */ - public interface Status { - /** deleted. */ - String DELETED = "deleted"; - } - - @SerializedName("credential_id") - protected String credentialId; - - protected String status; - - protected DeleteCredentials() {} - - /** - * Gets the credentialId. - * - *

The unique identifier of the credentials that have been deleted. - * - * @return the credentialId - */ - public String getCredentialId() { - return credentialId; - } - - /** - * Gets the status. - * - *

The status of the deletion request. - * - * @return the status - */ - public String getStatus() { - return status; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentialsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentialsOptions.java deleted file mode 100644 index 81f261e93aa..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteCredentialsOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The deleteCredentials options. */ -public class DeleteCredentialsOptions extends GenericModel { - - protected String environmentId; - protected String credentialId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String credentialId; - - /** - * Instantiates a new Builder from an existing DeleteCredentialsOptions instance. - * - * @param deleteCredentialsOptions the instance to initialize the Builder with - */ - private Builder(DeleteCredentialsOptions deleteCredentialsOptions) { - this.environmentId = deleteCredentialsOptions.environmentId; - this.credentialId = deleteCredentialsOptions.credentialId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param credentialId the credentialId - */ - public Builder(String environmentId, String credentialId) { - this.environmentId = environmentId; - this.credentialId = credentialId; - } - - /** - * Builds a DeleteCredentialsOptions. - * - * @return the new DeleteCredentialsOptions instance - */ - public DeleteCredentialsOptions build() { - return new DeleteCredentialsOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the DeleteCredentialsOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the credentialId. - * - * @param credentialId the credentialId - * @return the DeleteCredentialsOptions builder - */ - public Builder credentialId(String credentialId) { - this.credentialId = credentialId; - return this; - } - } - - protected DeleteCredentialsOptions() {} - - protected DeleteCredentialsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.credentialId, "credentialId cannot be empty"); - environmentId = builder.environmentId; - credentialId = builder.credentialId; - } - - /** - * New builder. - * - * @return a DeleteCredentialsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the credentialId. - * - *

The unique identifier for a set of source credentials. - * - * @return the credentialId - */ - public String credentialId() { - return credentialId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentOptions.java deleted file mode 100644 index 7b2487e1011..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentOptions.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The deleteDocument options. */ -public class DeleteDocumentOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String documentId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String documentId; - - /** - * Instantiates a new Builder from an existing DeleteDocumentOptions instance. - * - * @param deleteDocumentOptions the instance to initialize the Builder with - */ - private Builder(DeleteDocumentOptions deleteDocumentOptions) { - this.environmentId = deleteDocumentOptions.environmentId; - this.collectionId = deleteDocumentOptions.collectionId; - this.documentId = deleteDocumentOptions.documentId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param documentId the documentId - */ - public Builder(String environmentId, String collectionId, String documentId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.documentId = documentId; - } - - /** - * Builds a DeleteDocumentOptions. - * - * @return the new DeleteDocumentOptions instance - */ - public DeleteDocumentOptions build() { - return new DeleteDocumentOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the DeleteDocumentOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the DeleteDocumentOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the documentId. - * - * @param documentId the documentId - * @return the DeleteDocumentOptions builder - */ - public Builder documentId(String documentId) { - this.documentId = documentId; - return this; - } - } - - protected DeleteDocumentOptions() {} - - protected DeleteDocumentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.documentId, "documentId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - documentId = builder.documentId; - } - - /** - * New builder. - * - * @return a DeleteDocumentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the documentId. - * - *

The ID of the document. - * - * @return the documentId - */ - public String documentId() { - return documentId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentResponse.java deleted file mode 100644 index d6607604164..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteDocumentResponse.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Information returned when a document is deleted. */ -public class DeleteDocumentResponse extends GenericModel { - - /** Status of the document. A deleted document has the status deleted. */ - public interface Status { - /** deleted. */ - String DELETED = "deleted"; - } - - @SerializedName("document_id") - protected String documentId; - - protected String status; - - protected DeleteDocumentResponse() {} - - /** - * Gets the documentId. - * - *

The unique identifier of the document. - * - * @return the documentId - */ - public String getDocumentId() { - return documentId; - } - - /** - * Gets the status. - * - *

Status of the document. A deleted document has the status deleted. - * - * @return the status - */ - public String getStatus() { - return status; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentOptions.java deleted file mode 100644 index d9e3544241c..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentOptions.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The deleteEnvironment options. */ -public class DeleteEnvironmentOptions extends GenericModel { - - protected String environmentId; - - /** Builder. */ - public static class Builder { - private String environmentId; - - /** - * Instantiates a new Builder from an existing DeleteEnvironmentOptions instance. - * - * @param deleteEnvironmentOptions the instance to initialize the Builder with - */ - private Builder(DeleteEnvironmentOptions deleteEnvironmentOptions) { - this.environmentId = deleteEnvironmentOptions.environmentId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - */ - public Builder(String environmentId) { - this.environmentId = environmentId; - } - - /** - * Builds a DeleteEnvironmentOptions. - * - * @return the new DeleteEnvironmentOptions instance - */ - public DeleteEnvironmentOptions build() { - return new DeleteEnvironmentOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the DeleteEnvironmentOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - } - - protected DeleteEnvironmentOptions() {} - - protected DeleteEnvironmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - environmentId = builder.environmentId; - } - - /** - * New builder. - * - * @return a DeleteEnvironmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentResponse.java deleted file mode 100644 index b5afc6872fe..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentResponse.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Response object returned when deleting an environment. */ -public class DeleteEnvironmentResponse extends GenericModel { - - /** Status of the environment. */ - public interface Status { - /** deleted. */ - String DELETED = "deleted"; - } - - @SerializedName("environment_id") - protected String environmentId; - - protected String status; - - protected DeleteEnvironmentResponse() {} - - /** - * Gets the environmentId. - * - *

The unique identifier for the environment. - * - * @return the environmentId - */ - public String getEnvironmentId() { - return environmentId; - } - - /** - * Gets the status. - * - *

Status of the environment. - * - * @return the status - */ - public String getStatus() { - return status; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteExpansionsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteExpansionsOptions.java deleted file mode 100644 index 1cd06cbd364..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteExpansionsOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The deleteExpansions options. */ -public class DeleteExpansionsOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - - /** - * Instantiates a new Builder from an existing DeleteExpansionsOptions instance. - * - * @param deleteExpansionsOptions the instance to initialize the Builder with - */ - private Builder(DeleteExpansionsOptions deleteExpansionsOptions) { - this.environmentId = deleteExpansionsOptions.environmentId; - this.collectionId = deleteExpansionsOptions.collectionId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a DeleteExpansionsOptions. - * - * @return the new DeleteExpansionsOptions instance - */ - public DeleteExpansionsOptions build() { - return new DeleteExpansionsOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the DeleteExpansionsOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the DeleteExpansionsOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - } - - protected DeleteExpansionsOptions() {} - - protected DeleteExpansionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - } - - /** - * New builder. - * - * @return a DeleteExpansionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteGatewayOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteGatewayOptions.java deleted file mode 100644 index bbed8ee58bc..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteGatewayOptions.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The deleteGateway options. */ -public class DeleteGatewayOptions extends GenericModel { - - protected String environmentId; - protected String gatewayId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String gatewayId; - - /** - * Instantiates a new Builder from an existing DeleteGatewayOptions instance. - * - * @param deleteGatewayOptions the instance to initialize the Builder with - */ - private Builder(DeleteGatewayOptions deleteGatewayOptions) { - this.environmentId = deleteGatewayOptions.environmentId; - this.gatewayId = deleteGatewayOptions.gatewayId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param gatewayId the gatewayId - */ - public Builder(String environmentId, String gatewayId) { - this.environmentId = environmentId; - this.gatewayId = gatewayId; - } - - /** - * Builds a DeleteGatewayOptions. - * - * @return the new DeleteGatewayOptions instance - */ - public DeleteGatewayOptions build() { - return new DeleteGatewayOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the DeleteGatewayOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the gatewayId. - * - * @param gatewayId the gatewayId - * @return the DeleteGatewayOptions builder - */ - public Builder gatewayId(String gatewayId) { - this.gatewayId = gatewayId; - return this; - } - } - - protected DeleteGatewayOptions() {} - - protected DeleteGatewayOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.gatewayId, "gatewayId cannot be empty"); - environmentId = builder.environmentId; - gatewayId = builder.gatewayId; - } - - /** - * New builder. - * - * @return a DeleteGatewayOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the gatewayId. - * - *

The requested gateway ID. - * - * @return the gatewayId - */ - public String gatewayId() { - return gatewayId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteStopwordListOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteStopwordListOptions.java deleted file mode 100644 index 02ef1228583..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteStopwordListOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The deleteStopwordList options. */ -public class DeleteStopwordListOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - - /** - * Instantiates a new Builder from an existing DeleteStopwordListOptions instance. - * - * @param deleteStopwordListOptions the instance to initialize the Builder with - */ - private Builder(DeleteStopwordListOptions deleteStopwordListOptions) { - this.environmentId = deleteStopwordListOptions.environmentId; - this.collectionId = deleteStopwordListOptions.collectionId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a DeleteStopwordListOptions. - * - * @return the new DeleteStopwordListOptions instance - */ - public DeleteStopwordListOptions build() { - return new DeleteStopwordListOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the DeleteStopwordListOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the DeleteStopwordListOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - } - - protected DeleteStopwordListOptions() {} - - protected DeleteStopwordListOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - } - - /** - * New builder. - * - * @return a DeleteStopwordListOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTokenizationDictionaryOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTokenizationDictionaryOptions.java deleted file mode 100644 index b37ba0ffe64..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTokenizationDictionaryOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The deleteTokenizationDictionary options. */ -public class DeleteTokenizationDictionaryOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - - /** - * Instantiates a new Builder from an existing DeleteTokenizationDictionaryOptions instance. - * - * @param deleteTokenizationDictionaryOptions the instance to initialize the Builder with - */ - private Builder(DeleteTokenizationDictionaryOptions deleteTokenizationDictionaryOptions) { - this.environmentId = deleteTokenizationDictionaryOptions.environmentId; - this.collectionId = deleteTokenizationDictionaryOptions.collectionId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a DeleteTokenizationDictionaryOptions. - * - * @return the new DeleteTokenizationDictionaryOptions instance - */ - public DeleteTokenizationDictionaryOptions build() { - return new DeleteTokenizationDictionaryOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the DeleteTokenizationDictionaryOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the DeleteTokenizationDictionaryOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - } - - protected DeleteTokenizationDictionaryOptions() {} - - protected DeleteTokenizationDictionaryOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - } - - /** - * New builder. - * - * @return a DeleteTokenizationDictionaryOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingDataOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingDataOptions.java deleted file mode 100644 index 2f9e334ca56..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingDataOptions.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The deleteTrainingData options. */ -public class DeleteTrainingDataOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String queryId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String queryId; - - /** - * Instantiates a new Builder from an existing DeleteTrainingDataOptions instance. - * - * @param deleteTrainingDataOptions the instance to initialize the Builder with - */ - private Builder(DeleteTrainingDataOptions deleteTrainingDataOptions) { - this.environmentId = deleteTrainingDataOptions.environmentId; - this.collectionId = deleteTrainingDataOptions.collectionId; - this.queryId = deleteTrainingDataOptions.queryId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param queryId the queryId - */ - public Builder(String environmentId, String collectionId, String queryId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.queryId = queryId; - } - - /** - * Builds a DeleteTrainingDataOptions. - * - * @return the new DeleteTrainingDataOptions instance - */ - public DeleteTrainingDataOptions build() { - return new DeleteTrainingDataOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the DeleteTrainingDataOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the DeleteTrainingDataOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the queryId. - * - * @param queryId the queryId - * @return the DeleteTrainingDataOptions builder - */ - public Builder queryId(String queryId) { - this.queryId = queryId; - return this; - } - } - - protected DeleteTrainingDataOptions() {} - - protected DeleteTrainingDataOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, "queryId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - queryId = builder.queryId; - } - - /** - * New builder. - * - * @return a DeleteTrainingDataOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the queryId. - * - *

The ID of the query used for training. - * - * @return the queryId - */ - public String queryId() { - return queryId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingExampleOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingExampleOptions.java deleted file mode 100644 index a8d2497b333..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteTrainingExampleOptions.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The deleteTrainingExample options. */ -public class DeleteTrainingExampleOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String queryId; - protected String exampleId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String queryId; - private String exampleId; - - /** - * Instantiates a new Builder from an existing DeleteTrainingExampleOptions instance. - * - * @param deleteTrainingExampleOptions the instance to initialize the Builder with - */ - private Builder(DeleteTrainingExampleOptions deleteTrainingExampleOptions) { - this.environmentId = deleteTrainingExampleOptions.environmentId; - this.collectionId = deleteTrainingExampleOptions.collectionId; - this.queryId = deleteTrainingExampleOptions.queryId; - this.exampleId = deleteTrainingExampleOptions.exampleId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param queryId the queryId - * @param exampleId the exampleId - */ - public Builder(String environmentId, String collectionId, String queryId, String exampleId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.queryId = queryId; - this.exampleId = exampleId; - } - - /** - * Builds a DeleteTrainingExampleOptions. - * - * @return the new DeleteTrainingExampleOptions instance - */ - public DeleteTrainingExampleOptions build() { - return new DeleteTrainingExampleOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the DeleteTrainingExampleOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the DeleteTrainingExampleOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the queryId. - * - * @param queryId the queryId - * @return the DeleteTrainingExampleOptions builder - */ - public Builder queryId(String queryId) { - this.queryId = queryId; - return this; - } - - /** - * Set the exampleId. - * - * @param exampleId the exampleId - * @return the DeleteTrainingExampleOptions builder - */ - public Builder exampleId(String exampleId) { - this.exampleId = exampleId; - return this; - } - } - - protected DeleteTrainingExampleOptions() {} - - protected DeleteTrainingExampleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, "queryId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.exampleId, "exampleId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - queryId = builder.queryId; - exampleId = builder.exampleId; - } - - /** - * New builder. - * - * @return a DeleteTrainingExampleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the queryId. - * - *

The ID of the query used for training. - * - * @return the queryId - */ - public String queryId() { - return queryId; - } - - /** - * Gets the exampleId. - * - *

The ID of the document as it is indexed. - * - * @return the exampleId - */ - public String exampleId() { - return exampleId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteUserDataOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteUserDataOptions.java deleted file mode 100644 index eea50014f4e..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DeleteUserDataOptions.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The deleteUserData options. */ -public class DeleteUserDataOptions extends GenericModel { - - protected String customerId; - - /** Builder. */ - public static class Builder { - private String customerId; - - /** - * Instantiates a new Builder from an existing DeleteUserDataOptions instance. - * - * @param deleteUserDataOptions the instance to initialize the Builder with - */ - private Builder(DeleteUserDataOptions deleteUserDataOptions) { - this.customerId = deleteUserDataOptions.customerId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param customerId the customerId - */ - public Builder(String customerId) { - this.customerId = customerId; - } - - /** - * Builds a DeleteUserDataOptions. - * - * @return the new DeleteUserDataOptions instance - */ - public DeleteUserDataOptions build() { - return new DeleteUserDataOptions(this); - } - - /** - * Set the customerId. - * - * @param customerId the customerId - * @return the DeleteUserDataOptions builder - */ - public Builder customerId(String customerId) { - this.customerId = customerId; - return this; - } - } - - protected DeleteUserDataOptions() {} - - protected DeleteUserDataOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.customerId, "customerId cannot be null"); - customerId = builder.customerId; - } - - /** - * New builder. - * - * @return a DeleteUserDataOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the customerId. - * - *

The customer ID for which all data is to be deleted. - * - * @return the customerId - */ - public String customerId() { - return customerId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DiskUsage.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DiskUsage.java deleted file mode 100644 index baf6f1e2383..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DiskUsage.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Summary of the disk usage statistics for the environment. */ -public class DiskUsage extends GenericModel { - - @SerializedName("used_bytes") - protected Long usedBytes; - - @SerializedName("maximum_allowed_bytes") - protected Long maximumAllowedBytes; - - protected DiskUsage() {} - - /** - * Gets the usedBytes. - * - *

Number of bytes within the environment's disk capacity that are currently used to store - * data. - * - * @return the usedBytes - */ - public Long getUsedBytes() { - return usedBytes; - } - - /** - * Gets the maximumAllowedBytes. - * - *

Total number of bytes available in the environment's disk capacity. - * - * @return the maximumAllowedBytes - */ - public Long getMaximumAllowedBytes() { - return maximumAllowedBytes; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentAccepted.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentAccepted.java deleted file mode 100644 index d5c19bc6f2e..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentAccepted.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Information returned after an uploaded document is accepted. */ -public class DocumentAccepted extends GenericModel { - - /** - * Status of the document in the ingestion process. A status of `processing` is returned for - * documents that are ingested with a *version* date before `2019-01-01`. The `pending` status is - * returned for all others. - */ - public interface Status { - /** processing. */ - String PROCESSING = "processing"; - /** pending. */ - String PENDING = "pending"; - } - - @SerializedName("document_id") - protected String documentId; - - protected String status; - protected List notices; - - protected DocumentAccepted() {} - - /** - * Gets the documentId. - * - *

The unique identifier of the ingested document. - * - * @return the documentId - */ - public String getDocumentId() { - return documentId; - } - - /** - * Gets the status. - * - *

Status of the document in the ingestion process. A status of `processing` is returned for - * documents that are ingested with a *version* date before `2019-01-01`. The `pending` status is - * returned for all others. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the notices. - * - *

Array of notices produced by the document-ingestion process. - * - * @return the notices - */ - public List getNotices() { - return notices; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentCounts.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentCounts.java deleted file mode 100644 index cfff490ae7b..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentCounts.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object containing collection document count information. */ -public class DocumentCounts extends GenericModel { - - protected Long available; - protected Long processing; - protected Long failed; - protected Long pending; - - protected DocumentCounts() {} - - /** - * Gets the available. - * - *

The total number of available documents in the collection. - * - * @return the available - */ - public Long getAvailable() { - return available; - } - - /** - * Gets the processing. - * - *

The number of documents in the collection that are currently being processed. - * - * @return the processing - */ - public Long getProcessing() { - return processing; - } - - /** - * Gets the failed. - * - *

The number of documents in the collection that failed to be ingested. - * - * @return the failed - */ - public Long getFailed() { - return failed; - } - - /** - * Gets the pending. - * - *

The number of documents that have been uploaded to the collection, but have not yet started - * processing. - * - * @return the pending - */ - public Long getPending() { - return pending; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentStatus.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentStatus.java deleted file mode 100644 index dc925030519..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/DocumentStatus.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Status information about a submitted document. */ -public class DocumentStatus extends GenericModel { - - /** Status of the document in the ingestion process. */ - public interface Status { - /** available. */ - String AVAILABLE = "available"; - /** available with notices. */ - String AVAILABLE_WITH_NOTICES = "available with notices"; - /** failed. */ - String FAILED = "failed"; - /** processing. */ - String PROCESSING = "processing"; - /** pending. */ - String PENDING = "pending"; - } - - /** The type of the original source file. */ - public interface FileType { - /** pdf. */ - String PDF = "pdf"; - /** html. */ - String HTML = "html"; - /** word. */ - String WORD = "word"; - /** json. */ - String JSON = "json"; - } - - @SerializedName("document_id") - protected String documentId; - - @SerializedName("configuration_id") - protected String configurationId; - - protected String status; - - @SerializedName("status_description") - protected String statusDescription; - - protected String filename; - - @SerializedName("file_type") - protected String fileType; - - protected String sha1; - protected List notices; - - protected DocumentStatus() {} - - /** - * Gets the documentId. - * - *

The unique identifier of the document. - * - * @return the documentId - */ - public String getDocumentId() { - return documentId; - } - - /** - * Gets the configurationId. - * - *

The unique identifier for the configuration. - * - * @return the configurationId - */ - public String getConfigurationId() { - return configurationId; - } - - /** - * Gets the status. - * - *

Status of the document in the ingestion process. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the statusDescription. - * - *

Description of the document status. - * - * @return the statusDescription - */ - public String getStatusDescription() { - return statusDescription; - } - - /** - * Gets the filename. - * - *

Name of the original source file (if available). - * - * @return the filename - */ - public String getFilename() { - return filename; - } - - /** - * Gets the fileType. - * - *

The type of the original source file. - * - * @return the fileType - */ - public String getFileType() { - return fileType; - } - - /** - * Gets the sha1. - * - *

The SHA-1 hash of the original source file (formatted as a hexadecimal string). - * - * @return the sha1 - */ - public String getSha1() { - return sha1; - } - - /** - * Gets the notices. - * - *

Array of notices produced by the document-ingestion process. - * - * @return the notices - */ - public List getNotices() { - return notices; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Enrichment.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Enrichment.java deleted file mode 100644 index d117e8420a3..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Enrichment.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Enrichment step to perform on the document. Each enrichment is performed on the specified field - * in the order that they are listed in the configuration. - */ -public class Enrichment extends GenericModel { - - protected String description; - - @SerializedName("destination_field") - protected String destinationField; - - @SerializedName("source_field") - protected String sourceField; - - protected Boolean overwrite; - protected String enrichment; - - @SerializedName("ignore_downstream_errors") - protected Boolean ignoreDownstreamErrors; - - protected EnrichmentOptions options; - - /** Builder. */ - public static class Builder { - private String description; - private String destinationField; - private String sourceField; - private Boolean overwrite; - private String enrichment; - private Boolean ignoreDownstreamErrors; - private EnrichmentOptions options; - - /** - * Instantiates a new Builder from an existing Enrichment instance. - * - * @param enrichment the instance to initialize the Builder with - */ - private Builder(Enrichment enrichment) { - this.description = enrichment.description; - this.destinationField = enrichment.destinationField; - this.sourceField = enrichment.sourceField; - this.overwrite = enrichment.overwrite; - this.enrichment = enrichment.enrichment; - this.ignoreDownstreamErrors = enrichment.ignoreDownstreamErrors; - this.options = enrichment.options; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param destinationField the destinationField - * @param sourceField the sourceField - * @param enrichment the enrichment - */ - public Builder(String destinationField, String sourceField, String enrichment) { - this.destinationField = destinationField; - this.sourceField = sourceField; - this.enrichment = enrichment; - } - - /** - * Builds a Enrichment. - * - * @return the new Enrichment instance - */ - public Enrichment build() { - return new Enrichment(this); - } - - /** - * Set the description. - * - * @param description the description - * @return the Enrichment builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the destinationField. - * - * @param destinationField the destinationField - * @return the Enrichment builder - */ - public Builder destinationField(String destinationField) { - this.destinationField = destinationField; - return this; - } - - /** - * Set the sourceField. - * - * @param sourceField the sourceField - * @return the Enrichment builder - */ - public Builder sourceField(String sourceField) { - this.sourceField = sourceField; - return this; - } - - /** - * Set the overwrite. - * - * @param overwrite the overwrite - * @return the Enrichment builder - */ - public Builder overwrite(Boolean overwrite) { - this.overwrite = overwrite; - return this; - } - - /** - * Set the enrichment. - * - * @param enrichment the enrichment - * @return the Enrichment builder - */ - public Builder enrichment(String enrichment) { - this.enrichment = enrichment; - return this; - } - - /** - * Set the ignoreDownstreamErrors. - * - * @param ignoreDownstreamErrors the ignoreDownstreamErrors - * @return the Enrichment builder - */ - public Builder ignoreDownstreamErrors(Boolean ignoreDownstreamErrors) { - this.ignoreDownstreamErrors = ignoreDownstreamErrors; - return this; - } - - /** - * Set the options. - * - * @param options the options - * @return the Enrichment builder - */ - public Builder options(EnrichmentOptions options) { - this.options = options; - return this; - } - } - - protected Enrichment() {} - - protected Enrichment(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.destinationField, "destinationField cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.sourceField, "sourceField cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.enrichment, "enrichment cannot be null"); - description = builder.description; - destinationField = builder.destinationField; - sourceField = builder.sourceField; - overwrite = builder.overwrite; - enrichment = builder.enrichment; - ignoreDownstreamErrors = builder.ignoreDownstreamErrors; - options = builder.options; - } - - /** - * New builder. - * - * @return a Enrichment builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the description. - * - *

Describes what the enrichment step does. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the destinationField. - * - *

Field where enrichments will be stored. This field must already exist or be at most 1 level - * deeper than an existing field. For example, if `text` is a top-level field with no sub-fields, - * `text.foo` is a valid destination but `text.foo.bar` is not. - * - * @return the destinationField - */ - public String destinationField() { - return destinationField; - } - - /** - * Gets the sourceField. - * - *

Field to be enriched. - * - *

Arrays can be specified as the **source_field** if the **enrichment** service for this - * enrichment is set to `natural_language_undstanding`. - * - * @return the sourceField - */ - public String sourceField() { - return sourceField; - } - - /** - * Gets the overwrite. - * - *

Indicates that the enrichments will overwrite the destination_field field if it already - * exists. - * - * @return the overwrite - */ - public Boolean overwrite() { - return overwrite; - } - - /** - * Gets the enrichment. - * - *

Name of the enrichment service to call. The only supported option is - * `natural_language_understanding`. The `elements` option is deprecated and support ended on 10 - * July 2020. - * - *

The **options** object must contain Natural Language Understanding options. - * - * @return the enrichment - */ - public String enrichment() { - return enrichment; - } - - /** - * Gets the ignoreDownstreamErrors. - * - *

If true, then most errors generated during the enrichment process will be treated as - * warnings and will not cause the document to fail processing. - * - * @return the ignoreDownstreamErrors - */ - public Boolean ignoreDownstreamErrors() { - return ignoreDownstreamErrors; - } - - /** - * Gets the options. - * - *

Options that are specific to a particular enrichment. - * - *

The `elements` enrichment type is deprecated. Use the [Create a - * project](https://cloud.ibm.com/apidocs/discovery-data#createproject) method of the Discovery v2 - * API to create a `content_intelligence` project type instead. - * - * @return the options - */ - public EnrichmentOptions options() { - return options; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnrichmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnrichmentOptions.java deleted file mode 100644 index 3ededcc730b..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnrichmentOptions.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Options that are specific to a particular enrichment. - * - *

The `elements` enrichment type is deprecated. Use the [Create a - * project](https://cloud.ibm.com/apidocs/discovery-data#createproject) method of the Discovery v2 - * API to create a `content_intelligence` project type instead. - */ -public class EnrichmentOptions extends GenericModel { - - /** - * ISO 639-1 code indicating the language to use for the analysis. This code overrides the - * automatic language detection performed by the service. Valid codes are `ar` (Arabic), `en` - * (English), `fr` (French), `de` (German), `it` (Italian), `pt` (Portuguese), `ru` (Russian), - * `es` (Spanish), and `sv` (Swedish). **Note:** Not all features support all languages, automatic - * detection is recommended. - */ - public interface Language { - /** ar. */ - String AR = "ar"; - /** en. */ - String EN = "en"; - /** fr. */ - String FR = "fr"; - /** de. */ - String DE = "de"; - /** it. */ - String IT = "it"; - /** pt. */ - String PT = "pt"; - /** ru. */ - String RU = "ru"; - /** es. */ - String ES = "es"; - /** sv. */ - String SV = "sv"; - } - - protected NluEnrichmentFeatures features; - protected String language; - protected String model; - - /** Builder. */ - public static class Builder { - private NluEnrichmentFeatures features; - private String language; - private String model; - - /** - * Instantiates a new Builder from an existing EnrichmentOptions instance. - * - * @param enrichmentOptions the instance to initialize the Builder with - */ - private Builder(EnrichmentOptions enrichmentOptions) { - this.features = enrichmentOptions.features; - this.language = enrichmentOptions.language; - this.model = enrichmentOptions.model; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a EnrichmentOptions. - * - * @return the new EnrichmentOptions instance - */ - public EnrichmentOptions build() { - return new EnrichmentOptions(this); - } - - /** - * Set the features. - * - * @param features the features - * @return the EnrichmentOptions builder - */ - public Builder features(NluEnrichmentFeatures features) { - this.features = features; - return this; - } - - /** - * Set the language. - * - * @param language the language - * @return the EnrichmentOptions builder - */ - public Builder language(String language) { - this.language = language; - return this; - } - - /** - * Set the model. - * - * @param model the model - * @return the EnrichmentOptions builder - * @deprecated this method is deprecated and may be removed in a future release - */ - @Deprecated - public Builder model(String model) { - this.model = model; - return this; - } - } - - protected EnrichmentOptions() {} - - protected EnrichmentOptions(Builder builder) { - features = builder.features; - language = builder.language; - model = builder.model; - } - - /** - * New builder. - * - * @return a EnrichmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the features. - * - *

Object containing Natural Language Understanding features to be used. - * - * @return the features - */ - public NluEnrichmentFeatures features() { - return features; - } - - /** - * Gets the language. - * - *

ISO 639-1 code indicating the language to use for the analysis. This code overrides the - * automatic language detection performed by the service. Valid codes are `ar` (Arabic), `en` - * (English), `fr` (French), `de` (German), `it` (Italian), `pt` (Portuguese), `ru` (Russian), - * `es` (Spanish), and `sv` (Swedish). **Note:** Not all features support all languages, automatic - * detection is recommended. - * - * @return the language - */ - public String language() { - return language; - } - - /** - * Gets the model. - * - *

The element extraction model to use, which can be `contract` only. The `elements` enrichment - * is deprecated. - * - * @return the model - * @deprecated this method is deprecated and may be removed in a future release - */ - @Deprecated - public String model() { - return model; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Environment.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Environment.java deleted file mode 100644 index 625c8a0527b..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Environment.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Date; - -/** Details about an environment. */ -public class Environment extends GenericModel { - - /** - * Current status of the environment. `resizing` is displayed when a request to increase the - * environment size has been made, but is still in the process of being completed. - */ - public interface Status { - /** active. */ - String ACTIVE = "active"; - /** pending. */ - String PENDING = "pending"; - /** maintenance. */ - String MAINTENANCE = "maintenance"; - /** resizing. */ - String RESIZING = "resizing"; - } - - /** Current size of the environment. */ - public interface Size { - /** LT. */ - String LT = "LT"; - /** XS. */ - String XS = "XS"; - /** S. */ - String S = "S"; - /** MS. */ - String MS = "MS"; - /** M. */ - String M = "M"; - /** ML. */ - String ML = "ML"; - /** L. */ - String L = "L"; - /** XL. */ - String XL = "XL"; - /** XXL. */ - String XXL = "XXL"; - /** XXXL. */ - String XXXL = "XXXL"; - } - - @SerializedName("environment_id") - protected String environmentId; - - protected String name; - protected String description; - protected Date created; - protected Date updated; - protected String status; - - @SerializedName("read_only") - protected Boolean readOnly; - - protected String size; - - @SerializedName("requested_size") - protected String requestedSize; - - @SerializedName("index_capacity") - protected IndexCapacity indexCapacity; - - @SerializedName("search_status") - protected SearchStatus searchStatus; - - protected Environment() {} - - /** - * Gets the environmentId. - * - *

Unique identifier for the environment. - * - * @return the environmentId - */ - public String getEnvironmentId() { - return environmentId; - } - - /** - * Gets the name. - * - *

Name that identifies the environment. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the description. - * - *

Description of the environment. - * - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * Gets the created. - * - *

Creation date of the environment, in the format `yyyy-MM-dd'T'HH:mm:ss.SSS'Z'`. - * - * @return the created - */ - public Date getCreated() { - return created; - } - - /** - * Gets the updated. - * - *

Date of most recent environment update, in the format `yyyy-MM-dd'T'HH:mm:ss.SSS'Z'`. - * - * @return the updated - */ - public Date getUpdated() { - return updated; - } - - /** - * Gets the status. - * - *

Current status of the environment. `resizing` is displayed when a request to increase the - * environment size has been made, but is still in the process of being completed. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the readOnly. - * - *

If `true`, the environment contains read-only collections that are maintained by IBM. - * - * @return the readOnly - */ - public Boolean isReadOnly() { - return readOnly; - } - - /** - * Gets the size. - * - *

Current size of the environment. - * - * @return the size - */ - public String getSize() { - return size; - } - - /** - * Gets the requestedSize. - * - *

The new size requested for this environment. Only returned when the environment *status* is - * `resizing`. - * - *

*Note:* Querying and indexing can still be performed during an environment upsize. - * - * @return the requestedSize - */ - public String getRequestedSize() { - return requestedSize; - } - - /** - * Gets the indexCapacity. - * - *

Details about the resource usage and capacity of the environment. - * - * @return the indexCapacity - */ - public IndexCapacity getIndexCapacity() { - return indexCapacity; - } - - /** - * Gets the searchStatus. - * - *

Information about the Continuous Relevancy Training for this environment. - * - * @return the searchStatus - */ - public SearchStatus getSearchStatus() { - return searchStatus; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnvironmentDocuments.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnvironmentDocuments.java deleted file mode 100644 index 21f8629e4bf..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EnvironmentDocuments.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Summary of the document usage statistics for the environment. */ -public class EnvironmentDocuments extends GenericModel { - - protected Long available; - - @SerializedName("maximum_allowed") - protected Long maximumAllowed; - - protected EnvironmentDocuments() {} - - /** - * Gets the available. - * - *

Number of documents indexed for the environment. - * - * @return the available - */ - public Long getAvailable() { - return available; - } - - /** - * Gets the maximumAllowed. - * - *

Total number of documents allowed in the environment's capacity. - * - * @return the maximumAllowed - */ - public Long getMaximumAllowed() { - return maximumAllowed; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EventData.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EventData.java deleted file mode 100644 index 84012c15bbe..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/EventData.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Date; - -/** Query event data object. */ -public class EventData extends GenericModel { - - @SerializedName("environment_id") - protected String environmentId; - - @SerializedName("session_token") - protected String sessionToken; - - @SerializedName("client_timestamp") - protected Date clientTimestamp; - - @SerializedName("display_rank") - protected Long displayRank; - - @SerializedName("collection_id") - protected String collectionId; - - @SerializedName("document_id") - protected String documentId; - - @SerializedName("query_id") - protected String queryId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String sessionToken; - private Date clientTimestamp; - private Long displayRank; - private String collectionId; - private String documentId; - - /** - * Instantiates a new Builder from an existing EventData instance. - * - * @param eventData the instance to initialize the Builder with - */ - private Builder(EventData eventData) { - this.environmentId = eventData.environmentId; - this.sessionToken = eventData.sessionToken; - this.clientTimestamp = eventData.clientTimestamp; - this.displayRank = eventData.displayRank; - this.collectionId = eventData.collectionId; - this.documentId = eventData.documentId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param sessionToken the sessionToken - * @param collectionId the collectionId - * @param documentId the documentId - */ - public Builder( - String environmentId, String sessionToken, String collectionId, String documentId) { - this.environmentId = environmentId; - this.sessionToken = sessionToken; - this.collectionId = collectionId; - this.documentId = documentId; - } - - /** - * Builds a EventData. - * - * @return the new EventData instance - */ - public EventData build() { - return new EventData(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the EventData builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the sessionToken. - * - * @param sessionToken the sessionToken - * @return the EventData builder - */ - public Builder sessionToken(String sessionToken) { - this.sessionToken = sessionToken; - return this; - } - - /** - * Set the clientTimestamp. - * - * @param clientTimestamp the clientTimestamp - * @return the EventData builder - */ - public Builder clientTimestamp(Date clientTimestamp) { - this.clientTimestamp = clientTimestamp; - return this; - } - - /** - * Set the displayRank. - * - * @param displayRank the displayRank - * @return the EventData builder - */ - public Builder displayRank(long displayRank) { - this.displayRank = displayRank; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the EventData builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the documentId. - * - * @param documentId the documentId - * @return the EventData builder - */ - public Builder documentId(String documentId) { - this.documentId = documentId; - return this; - } - } - - protected EventData() {} - - protected EventData(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.environmentId, "environmentId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.sessionToken, "sessionToken cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.collectionId, "collectionId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.documentId, "documentId cannot be null"); - environmentId = builder.environmentId; - sessionToken = builder.sessionToken; - clientTimestamp = builder.clientTimestamp; - displayRank = builder.displayRank; - collectionId = builder.collectionId; - documentId = builder.documentId; - } - - /** - * New builder. - * - * @return a EventData builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The **environment_id** associated with the query that the event is associated with. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the sessionToken. - * - *

The session token that was returned as part of the query results that this event is - * associated with. - * - * @return the sessionToken - */ - public String sessionToken() { - return sessionToken; - } - - /** - * Gets the clientTimestamp. - * - *

The optional timestamp for the event that was created. If not provided, the time that the - * event was created in the log was used. - * - * @return the clientTimestamp - */ - public Date clientTimestamp() { - return clientTimestamp; - } - - /** - * Gets the displayRank. - * - *

The rank of the result item which the event is associated with. - * - * @return the displayRank - */ - public Long displayRank() { - return displayRank; - } - - /** - * Gets the collectionId. - * - *

The **collection_id** of the document that this event is associated with. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the documentId. - * - *

The **document_id** of the document that this event is associated with. - * - * @return the documentId - */ - public String documentId() { - return documentId; - } - - /** - * Gets the queryId. - * - *

The query identifier stored in the log. The query and any events associated with that query - * are stored with the same **query_id**. - * - * @return the queryId - */ - public String queryId() { - return queryId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansion.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansion.java deleted file mode 100644 index 0bdaf75e62d..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansion.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** - * An expansion definition. Each object respresents one set of expandable strings. For example, you - * could have expansions for the word `hot` in one object, and expansions for the word `cold` in - * another. - */ -public class Expansion extends GenericModel { - - @SerializedName("input_terms") - protected List inputTerms; - - @SerializedName("expanded_terms") - protected List expandedTerms; - - /** Builder. */ - public static class Builder { - private List inputTerms; - private List expandedTerms; - - /** - * Instantiates a new Builder from an existing Expansion instance. - * - * @param expansion the instance to initialize the Builder with - */ - private Builder(Expansion expansion) { - this.inputTerms = expansion.inputTerms; - this.expandedTerms = expansion.expandedTerms; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param expandedTerms the expandedTerms - */ - public Builder(List expandedTerms) { - this.expandedTerms = expandedTerms; - } - - /** - * Builds a Expansion. - * - * @return the new Expansion instance - */ - public Expansion build() { - return new Expansion(this); - } - - /** - * Adds a new element to inputTerms. - * - * @param inputTerms the new element to be added - * @return the Expansion builder - */ - public Builder addInputTerms(String inputTerms) { - com.ibm.cloud.sdk.core.util.Validator.notNull(inputTerms, "inputTerms cannot be null"); - if (this.inputTerms == null) { - this.inputTerms = new ArrayList(); - } - this.inputTerms.add(inputTerms); - return this; - } - - /** - * Adds a new element to expandedTerms. - * - * @param expandedTerms the new element to be added - * @return the Expansion builder - */ - public Builder addExpandedTerms(String expandedTerms) { - com.ibm.cloud.sdk.core.util.Validator.notNull(expandedTerms, "expandedTerms cannot be null"); - if (this.expandedTerms == null) { - this.expandedTerms = new ArrayList(); - } - this.expandedTerms.add(expandedTerms); - return this; - } - - /** - * Set the inputTerms. Existing inputTerms will be replaced. - * - * @param inputTerms the inputTerms - * @return the Expansion builder - */ - public Builder inputTerms(List inputTerms) { - this.inputTerms = inputTerms; - return this; - } - - /** - * Set the expandedTerms. Existing expandedTerms will be replaced. - * - * @param expandedTerms the expandedTerms - * @return the Expansion builder - */ - public Builder expandedTerms(List expandedTerms) { - this.expandedTerms = expandedTerms; - return this; - } - } - - protected Expansion() {} - - protected Expansion(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.expandedTerms, "expandedTerms cannot be null"); - inputTerms = builder.inputTerms; - expandedTerms = builder.expandedTerms; - } - - /** - * New builder. - * - * @return a Expansion builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the inputTerms. - * - *

A list of terms that will be expanded for this expansion. If specified, only the items in - * this list are expanded. - * - * @return the inputTerms - */ - public List inputTerms() { - return inputTerms; - } - - /** - * Gets the expandedTerms. - * - *

A list of terms that this expansion will be expanded to. If specified without - * **input_terms**, it also functions as the input term list. - * - * @return the expandedTerms - */ - public List expandedTerms() { - return expandedTerms; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansions.java deleted file mode 100644 index c31cdf32d63..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Expansions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** The query expansion definitions for the specified collection. */ -public class Expansions extends GenericModel { - - protected List expansions; - - /** Builder. */ - public static class Builder { - private List expansions; - - /** - * Instantiates a new Builder from an existing Expansions instance. - * - * @param expansions the instance to initialize the Builder with - */ - private Builder(Expansions expansions) { - this.expansions = expansions.expansions; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param expansions the expansions - */ - public Builder(List expansions) { - this.expansions = expansions; - } - - /** - * Builds a Expansions. - * - * @return the new Expansions instance - */ - public Expansions build() { - return new Expansions(this); - } - - /** - * Adds a new element to expansions. - * - * @param expansions the new element to be added - * @return the Expansions builder - */ - public Builder addExpansions(Expansion expansions) { - com.ibm.cloud.sdk.core.util.Validator.notNull(expansions, "expansions cannot be null"); - if (this.expansions == null) { - this.expansions = new ArrayList(); - } - this.expansions.add(expansions); - return this; - } - - /** - * Set the expansions. Existing expansions will be replaced. - * - * @param expansions the expansions - * @return the Expansions builder - */ - public Builder expansions(List expansions) { - this.expansions = expansions; - return this; - } - } - - protected Expansions() {} - - protected Expansions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.expansions, "expansions cannot be null"); - expansions = builder.expansions; - } - - /** - * New builder. - * - * @return a Expansions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the expansions. - * - *

An array of query expansion definitions. - * - *

Each object in the **expansions** array represents a term or set of terms that will be - * expanded into other terms. Each expansion object can be configured as bidirectional or - * unidirectional. Bidirectional means that all terms are expanded to all other terms in the - * object. Unidirectional means that a set list of terms can be expanded into a second list of - * terms. - * - *

To create a bi-directional expansion specify an **expanded_terms** array. When found in a - * query, all items in the **expanded_terms** array are then expanded to the other items in the - * same array. - * - *

To create a uni-directional expansion, specify both an array of **input_terms** and an array - * of **expanded_terms**. When items in the **input_terms** array are present in a query, they are - * expanded using the items listed in the **expanded_terms** array. - * - * @return the expansions - */ - public List expansions() { - return expansions; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptions.java deleted file mode 100644 index 3314da775a1..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptions.java +++ /dev/null @@ -1,560 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** The federatedQueryNotices options. */ -public class FederatedQueryNoticesOptions extends GenericModel { - - protected String environmentId; - protected List collectionIds; - protected String filter; - protected String query; - protected String naturalLanguageQuery; - protected String aggregation; - protected Long count; - protected List xReturn; - protected Long offset; - protected List sort; - protected Boolean highlight; - protected String deduplicateField; - protected Boolean similar; - protected List similarDocumentIds; - protected List similarFields; - - /** Builder. */ - public static class Builder { - private String environmentId; - private List collectionIds; - private String filter; - private String query; - private String naturalLanguageQuery; - private String aggregation; - private Long count; - private List xReturn; - private Long offset; - private List sort; - private Boolean highlight; - private String deduplicateField; - private Boolean similar; - private List similarDocumentIds; - private List similarFields; - - /** - * Instantiates a new Builder from an existing FederatedQueryNoticesOptions instance. - * - * @param federatedQueryNoticesOptions the instance to initialize the Builder with - */ - private Builder(FederatedQueryNoticesOptions federatedQueryNoticesOptions) { - this.environmentId = federatedQueryNoticesOptions.environmentId; - this.collectionIds = federatedQueryNoticesOptions.collectionIds; - this.filter = federatedQueryNoticesOptions.filter; - this.query = federatedQueryNoticesOptions.query; - this.naturalLanguageQuery = federatedQueryNoticesOptions.naturalLanguageQuery; - this.aggregation = federatedQueryNoticesOptions.aggregation; - this.count = federatedQueryNoticesOptions.count; - this.xReturn = federatedQueryNoticesOptions.xReturn; - this.offset = federatedQueryNoticesOptions.offset; - this.sort = federatedQueryNoticesOptions.sort; - this.highlight = federatedQueryNoticesOptions.highlight; - this.deduplicateField = federatedQueryNoticesOptions.deduplicateField; - this.similar = federatedQueryNoticesOptions.similar; - this.similarDocumentIds = federatedQueryNoticesOptions.similarDocumentIds; - this.similarFields = federatedQueryNoticesOptions.similarFields; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionIds the collectionIds - */ - public Builder(String environmentId, List collectionIds) { - this.environmentId = environmentId; - this.collectionIds = collectionIds; - } - - /** - * Builds a FederatedQueryNoticesOptions. - * - * @return the new FederatedQueryNoticesOptions instance - */ - public FederatedQueryNoticesOptions build() { - return new FederatedQueryNoticesOptions(this); - } - - /** - * Adds a new element to collectionIds. - * - * @param collectionIds the new element to be added - * @return the FederatedQueryNoticesOptions builder - */ - public Builder addCollectionIds(String collectionIds) { - com.ibm.cloud.sdk.core.util.Validator.notNull(collectionIds, "collectionIds cannot be null"); - if (this.collectionIds == null) { - this.collectionIds = new ArrayList(); - } - this.collectionIds.add(collectionIds); - return this; - } - - /** - * Adds a new element to xReturn. - * - * @param returnField the new element to be added - * @return the FederatedQueryNoticesOptions builder - */ - public Builder addReturnField(String returnField) { - com.ibm.cloud.sdk.core.util.Validator.notNull(returnField, "returnField cannot be null"); - if (this.xReturn == null) { - this.xReturn = new ArrayList(); - } - this.xReturn.add(returnField); - return this; - } - - /** - * Adds a new element to sort. - * - * @param sort the new element to be added - * @return the FederatedQueryNoticesOptions builder - */ - public Builder addSort(String sort) { - com.ibm.cloud.sdk.core.util.Validator.notNull(sort, "sort cannot be null"); - if (this.sort == null) { - this.sort = new ArrayList(); - } - this.sort.add(sort); - return this; - } - - /** - * Adds a new element to similarDocumentIds. - * - * @param similarDocumentIds the new element to be added - * @return the FederatedQueryNoticesOptions builder - */ - public Builder addSimilarDocumentIds(String similarDocumentIds) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - similarDocumentIds, "similarDocumentIds cannot be null"); - if (this.similarDocumentIds == null) { - this.similarDocumentIds = new ArrayList(); - } - this.similarDocumentIds.add(similarDocumentIds); - return this; - } - - /** - * Adds a new element to similarFields. - * - * @param similarFields the new element to be added - * @return the FederatedQueryNoticesOptions builder - */ - public Builder addSimilarFields(String similarFields) { - com.ibm.cloud.sdk.core.util.Validator.notNull(similarFields, "similarFields cannot be null"); - if (this.similarFields == null) { - this.similarFields = new ArrayList(); - } - this.similarFields.add(similarFields); - return this; - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the FederatedQueryNoticesOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionIds. Existing collectionIds will be replaced. - * - * @param collectionIds the collectionIds - * @return the FederatedQueryNoticesOptions builder - */ - public Builder collectionIds(List collectionIds) { - this.collectionIds = collectionIds; - return this; - } - - /** - * Set the filter. - * - * @param filter the filter - * @return the FederatedQueryNoticesOptions builder - */ - public Builder filter(String filter) { - this.filter = filter; - return this; - } - - /** - * Set the query. - * - * @param query the query - * @return the FederatedQueryNoticesOptions builder - */ - public Builder query(String query) { - this.query = query; - return this; - } - - /** - * Set the naturalLanguageQuery. - * - * @param naturalLanguageQuery the naturalLanguageQuery - * @return the FederatedQueryNoticesOptions builder - */ - public Builder naturalLanguageQuery(String naturalLanguageQuery) { - this.naturalLanguageQuery = naturalLanguageQuery; - return this; - } - - /** - * Set the aggregation. - * - * @param aggregation the aggregation - * @return the FederatedQueryNoticesOptions builder - */ - public Builder aggregation(String aggregation) { - this.aggregation = aggregation; - return this; - } - - /** - * Set the count. - * - * @param count the count - * @return the FederatedQueryNoticesOptions builder - */ - public Builder count(long count) { - this.count = count; - return this; - } - - /** - * Set the xReturn. Existing xReturn will be replaced. - * - * @param xReturn the xReturn - * @return the FederatedQueryNoticesOptions builder - */ - public Builder xReturn(List xReturn) { - this.xReturn = xReturn; - return this; - } - - /** - * Set the offset. - * - * @param offset the offset - * @return the FederatedQueryNoticesOptions builder - */ - public Builder offset(long offset) { - this.offset = offset; - return this; - } - - /** - * Set the sort. Existing sort will be replaced. - * - * @param sort the sort - * @return the FederatedQueryNoticesOptions builder - */ - public Builder sort(List sort) { - this.sort = sort; - return this; - } - - /** - * Set the highlight. - * - * @param highlight the highlight - * @return the FederatedQueryNoticesOptions builder - */ - public Builder highlight(Boolean highlight) { - this.highlight = highlight; - return this; - } - - /** - * Set the deduplicateField. - * - * @param deduplicateField the deduplicateField - * @return the FederatedQueryNoticesOptions builder - */ - public Builder deduplicateField(String deduplicateField) { - this.deduplicateField = deduplicateField; - return this; - } - - /** - * Set the similar. - * - * @param similar the similar - * @return the FederatedQueryNoticesOptions builder - */ - public Builder similar(Boolean similar) { - this.similar = similar; - return this; - } - - /** - * Set the similarDocumentIds. Existing similarDocumentIds will be replaced. - * - * @param similarDocumentIds the similarDocumentIds - * @return the FederatedQueryNoticesOptions builder - */ - public Builder similarDocumentIds(List similarDocumentIds) { - this.similarDocumentIds = similarDocumentIds; - return this; - } - - /** - * Set the similarFields. Existing similarFields will be replaced. - * - * @param similarFields the similarFields - * @return the FederatedQueryNoticesOptions builder - */ - public Builder similarFields(List similarFields) { - this.similarFields = similarFields; - return this; - } - } - - protected FederatedQueryNoticesOptions() {} - - protected FederatedQueryNoticesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.collectionIds, "collectionIds cannot be null"); - environmentId = builder.environmentId; - collectionIds = builder.collectionIds; - filter = builder.filter; - query = builder.query; - naturalLanguageQuery = builder.naturalLanguageQuery; - aggregation = builder.aggregation; - count = builder.count; - xReturn = builder.xReturn; - offset = builder.offset; - sort = builder.sort; - highlight = builder.highlight; - deduplicateField = builder.deduplicateField; - similar = builder.similar; - similarDocumentIds = builder.similarDocumentIds; - similarFields = builder.similarFields; - } - - /** - * New builder. - * - * @return a FederatedQueryNoticesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionIds. - * - *

A comma-separated list of collection IDs to be queried against. - * - * @return the collectionIds - */ - public List collectionIds() { - return collectionIds; - } - - /** - * Gets the filter. - * - *

A cacheable query that excludes documents that don't mention the query content. Filter - * searches are better for metadata-type searches and for assessing the concepts in the data set. - * - * @return the filter - */ - public String filter() { - return filter; - } - - /** - * Gets the query. - * - *

A query search returns all documents in your data set with full enrichments and full text, - * but with the most relevant documents listed first. - * - * @return the query - */ - public String query() { - return query; - } - - /** - * Gets the naturalLanguageQuery. - * - *

A natural language query that returns relevant documents by utilizing training data and - * natural language understanding. - * - * @return the naturalLanguageQuery - */ - public String naturalLanguageQuery() { - return naturalLanguageQuery; - } - - /** - * Gets the aggregation. - * - *

An aggregation search that returns an exact answer by combining query search with filters. - * Useful for applications to build lists, tables, and time series. For a full list of possible - * aggregations, see the Query reference. - * - * @return the aggregation - */ - public String aggregation() { - return aggregation; - } - - /** - * Gets the count. - * - *

Number of results to return. The maximum for the **count** and **offset** values together in - * any one query is **10000**. - * - * @return the count - */ - public Long count() { - return count; - } - - /** - * Gets the xReturn. - * - *

A comma-separated list of the portion of the document hierarchy to return. - * - * @return the xReturn - */ - public List xReturn() { - return xReturn; - } - - /** - * Gets the offset. - * - *

The number of query results to skip at the beginning. For example, if the total number of - * results that are returned is 10 and the offset is 8, it returns the last two results. The - * maximum for the **count** and **offset** values together in any one query is **10000**. - * - * @return the offset - */ - public Long offset() { - return offset; - } - - /** - * Gets the sort. - * - *

A comma-separated list of fields in the document to sort on. You can optionally specify a - * sort direction by prefixing the field with `-` for descending or `+` for ascending. Ascending - * is the default sort direction if no prefix is specified. - * - * @return the sort - */ - public List sort() { - return sort; - } - - /** - * Gets the highlight. - * - *

When true, a highlight field is returned for each result which contains the fields which - * match the query with `<em></em>` tags around the matching query terms. - * - * @return the highlight - */ - public Boolean highlight() { - return highlight; - } - - /** - * Gets the deduplicateField. - * - *

When specified, duplicate results based on the field specified are removed from the returned - * results. Duplicate comparison is limited to the current query only, **offset** is not - * considered. This parameter is currently Beta functionality. - * - * @return the deduplicateField - */ - public String deduplicateField() { - return deduplicateField; - } - - /** - * Gets the similar. - * - *

When `true`, results are returned based on their similarity to the document IDs specified in - * the **similar.document_ids** parameter. - * - * @return the similar - */ - public Boolean similar() { - return similar; - } - - /** - * Gets the similarDocumentIds. - * - *

A comma-separated list of document IDs to find similar documents. - * - *

**Tip:** Include the **natural_language_query** parameter to expand the scope of the - * document similarity search with the natural language query. Other query parameters, such as - * **filter** and **query**, are subsequently applied and reduce the scope. - * - * @return the similarDocumentIds - */ - public List similarDocumentIds() { - return similarDocumentIds; - } - - /** - * Gets the similarFields. - * - *

A comma-separated list of field names that are used as a basis for comparison to identify - * similar documents. If not specified, the entire document is used for comparison. - * - * @return the similarFields - */ - public List similarFields() { - return similarFields; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptions.java deleted file mode 100644 index b539321a90f..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptions.java +++ /dev/null @@ -1,673 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The federatedQuery options. */ -public class FederatedQueryOptions extends GenericModel { - - protected String environmentId; - protected String collectionIds; - protected String filter; - protected String query; - protected String naturalLanguageQuery; - protected Boolean passages; - protected String aggregation; - protected Long count; - protected String xReturn; - protected Long offset; - protected String sort; - protected Boolean highlight; - protected String passagesFields; - protected Long passagesCount; - protected Long passagesCharacters; - protected Boolean deduplicate; - protected String deduplicateField; - protected Boolean similar; - protected String similarDocumentIds; - protected String similarFields; - protected String bias; - protected Boolean xWatsonLoggingOptOut; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionIds; - private String filter; - private String query; - private String naturalLanguageQuery; - private Boolean passages; - private String aggregation; - private Long count; - private String xReturn; - private Long offset; - private String sort; - private Boolean highlight; - private String passagesFields; - private Long passagesCount; - private Long passagesCharacters; - private Boolean deduplicate; - private String deduplicateField; - private Boolean similar; - private String similarDocumentIds; - private String similarFields; - private String bias; - private Boolean xWatsonLoggingOptOut; - - /** - * Instantiates a new Builder from an existing FederatedQueryOptions instance. - * - * @param federatedQueryOptions the instance to initialize the Builder with - */ - private Builder(FederatedQueryOptions federatedQueryOptions) { - this.environmentId = federatedQueryOptions.environmentId; - this.collectionIds = federatedQueryOptions.collectionIds; - this.filter = federatedQueryOptions.filter; - this.query = federatedQueryOptions.query; - this.naturalLanguageQuery = federatedQueryOptions.naturalLanguageQuery; - this.passages = federatedQueryOptions.passages; - this.aggregation = federatedQueryOptions.aggregation; - this.count = federatedQueryOptions.count; - this.xReturn = federatedQueryOptions.xReturn; - this.offset = federatedQueryOptions.offset; - this.sort = federatedQueryOptions.sort; - this.highlight = federatedQueryOptions.highlight; - this.passagesFields = federatedQueryOptions.passagesFields; - this.passagesCount = federatedQueryOptions.passagesCount; - this.passagesCharacters = federatedQueryOptions.passagesCharacters; - this.deduplicate = federatedQueryOptions.deduplicate; - this.deduplicateField = federatedQueryOptions.deduplicateField; - this.similar = federatedQueryOptions.similar; - this.similarDocumentIds = federatedQueryOptions.similarDocumentIds; - this.similarFields = federatedQueryOptions.similarFields; - this.bias = federatedQueryOptions.bias; - this.xWatsonLoggingOptOut = federatedQueryOptions.xWatsonLoggingOptOut; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionIds the collectionIds - */ - public Builder(String environmentId, String collectionIds) { - this.environmentId = environmentId; - this.collectionIds = collectionIds; - } - - /** - * Builds a FederatedQueryOptions. - * - * @return the new FederatedQueryOptions instance - */ - public FederatedQueryOptions build() { - return new FederatedQueryOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the FederatedQueryOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionIds. - * - * @param collectionIds the collectionIds - * @return the FederatedQueryOptions builder - */ - public Builder collectionIds(String collectionIds) { - this.collectionIds = collectionIds; - return this; - } - - /** - * Set the filter. - * - * @param filter the filter - * @return the FederatedQueryOptions builder - */ - public Builder filter(String filter) { - this.filter = filter; - return this; - } - - /** - * Set the query. - * - * @param query the query - * @return the FederatedQueryOptions builder - */ - public Builder query(String query) { - this.query = query; - return this; - } - - /** - * Set the naturalLanguageQuery. - * - * @param naturalLanguageQuery the naturalLanguageQuery - * @return the FederatedQueryOptions builder - */ - public Builder naturalLanguageQuery(String naturalLanguageQuery) { - this.naturalLanguageQuery = naturalLanguageQuery; - return this; - } - - /** - * Set the passages. - * - * @param passages the passages - * @return the FederatedQueryOptions builder - */ - public Builder passages(Boolean passages) { - this.passages = passages; - return this; - } - - /** - * Set the aggregation. - * - * @param aggregation the aggregation - * @return the FederatedQueryOptions builder - */ - public Builder aggregation(String aggregation) { - this.aggregation = aggregation; - return this; - } - - /** - * Set the count. - * - * @param count the count - * @return the FederatedQueryOptions builder - */ - public Builder count(long count) { - this.count = count; - return this; - } - - /** - * Set the xReturn. - * - * @param xReturn the xReturn - * @return the FederatedQueryOptions builder - */ - public Builder xReturn(String xReturn) { - this.xReturn = xReturn; - return this; - } - - /** - * Set the offset. - * - * @param offset the offset - * @return the FederatedQueryOptions builder - */ - public Builder offset(long offset) { - this.offset = offset; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the FederatedQueryOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the highlight. - * - * @param highlight the highlight - * @return the FederatedQueryOptions builder - */ - public Builder highlight(Boolean highlight) { - this.highlight = highlight; - return this; - } - - /** - * Set the passagesFields. - * - * @param passagesFields the passagesFields - * @return the FederatedQueryOptions builder - */ - public Builder passagesFields(String passagesFields) { - this.passagesFields = passagesFields; - return this; - } - - /** - * Set the passagesCount. - * - * @param passagesCount the passagesCount - * @return the FederatedQueryOptions builder - */ - public Builder passagesCount(long passagesCount) { - this.passagesCount = passagesCount; - return this; - } - - /** - * Set the passagesCharacters. - * - * @param passagesCharacters the passagesCharacters - * @return the FederatedQueryOptions builder - */ - public Builder passagesCharacters(long passagesCharacters) { - this.passagesCharacters = passagesCharacters; - return this; - } - - /** - * Set the deduplicate. - * - * @param deduplicate the deduplicate - * @return the FederatedQueryOptions builder - */ - public Builder deduplicate(Boolean deduplicate) { - this.deduplicate = deduplicate; - return this; - } - - /** - * Set the deduplicateField. - * - * @param deduplicateField the deduplicateField - * @return the FederatedQueryOptions builder - */ - public Builder deduplicateField(String deduplicateField) { - this.deduplicateField = deduplicateField; - return this; - } - - /** - * Set the similar. - * - * @param similar the similar - * @return the FederatedQueryOptions builder - */ - public Builder similar(Boolean similar) { - this.similar = similar; - return this; - } - - /** - * Set the similarDocumentIds. - * - * @param similarDocumentIds the similarDocumentIds - * @return the FederatedQueryOptions builder - */ - public Builder similarDocumentIds(String similarDocumentIds) { - this.similarDocumentIds = similarDocumentIds; - return this; - } - - /** - * Set the similarFields. - * - * @param similarFields the similarFields - * @return the FederatedQueryOptions builder - */ - public Builder similarFields(String similarFields) { - this.similarFields = similarFields; - return this; - } - - /** - * Set the bias. - * - * @param bias the bias - * @return the FederatedQueryOptions builder - */ - public Builder bias(String bias) { - this.bias = bias; - return this; - } - - /** - * Set the xWatsonLoggingOptOut. - * - * @param xWatsonLoggingOptOut the xWatsonLoggingOptOut - * @return the FederatedQueryOptions builder - */ - public Builder xWatsonLoggingOptOut(Boolean xWatsonLoggingOptOut) { - this.xWatsonLoggingOptOut = xWatsonLoggingOptOut; - return this; - } - } - - protected FederatedQueryOptions() {} - - protected FederatedQueryOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.collectionIds, "collectionIds cannot be null"); - environmentId = builder.environmentId; - collectionIds = builder.collectionIds; - filter = builder.filter; - query = builder.query; - naturalLanguageQuery = builder.naturalLanguageQuery; - passages = builder.passages; - aggregation = builder.aggregation; - count = builder.count; - xReturn = builder.xReturn; - offset = builder.offset; - sort = builder.sort; - highlight = builder.highlight; - passagesFields = builder.passagesFields; - passagesCount = builder.passagesCount; - passagesCharacters = builder.passagesCharacters; - deduplicate = builder.deduplicate; - deduplicateField = builder.deduplicateField; - similar = builder.similar; - similarDocumentIds = builder.similarDocumentIds; - similarFields = builder.similarFields; - bias = builder.bias; - xWatsonLoggingOptOut = builder.xWatsonLoggingOptOut; - } - - /** - * New builder. - * - * @return a FederatedQueryOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionIds. - * - *

A comma-separated list of collection IDs to be queried against. - * - * @return the collectionIds - */ - public String collectionIds() { - return collectionIds; - } - - /** - * Gets the filter. - * - *

A cacheable query that excludes documents that don't mention the query content. Filter - * searches are better for metadata-type searches and for assessing the concepts in the data set. - * - * @return the filter - */ - public String filter() { - return filter; - } - - /** - * Gets the query. - * - *

A query search returns all documents in your data set with full enrichments and full text, - * but with the most relevant documents listed first. Use a query search when you want to find the - * most relevant search results. - * - * @return the query - */ - public String query() { - return query; - } - - /** - * Gets the naturalLanguageQuery. - * - *

A natural language query that returns relevant documents by utilizing training data and - * natural language understanding. - * - * @return the naturalLanguageQuery - */ - public String naturalLanguageQuery() { - return naturalLanguageQuery; - } - - /** - * Gets the passages. - * - *

A passages query that returns the most relevant passages from the results. - * - * @return the passages - */ - public Boolean passages() { - return passages; - } - - /** - * Gets the aggregation. - * - *

An aggregation search that returns an exact answer by combining query search with filters. - * Useful for applications to build lists, tables, and time series. For a full list of possible - * aggregations, see the Query reference. - * - * @return the aggregation - */ - public String aggregation() { - return aggregation; - } - - /** - * Gets the count. - * - *

Number of results to return. - * - * @return the count - */ - public Long count() { - return count; - } - - /** - * Gets the xReturn. - * - *

A comma-separated list of the portion of the document hierarchy to return. - * - * @return the xReturn - */ - public String xReturn() { - return xReturn; - } - - /** - * Gets the offset. - * - *

The number of query results to skip at the beginning. For example, if the total number of - * results that are returned is 10 and the offset is 8, it returns the last two results. - * - * @return the offset - */ - public Long offset() { - return offset; - } - - /** - * Gets the sort. - * - *

A comma-separated list of fields in the document to sort on. You can optionally specify a - * sort direction by prefixing the field with `-` for descending or `+` for ascending. Ascending - * is the default sort direction if no prefix is specified. This parameter cannot be used in the - * same query as the **bias** parameter. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the highlight. - * - *

When true, a highlight field is returned for each result which contains the fields which - * match the query with `<em></em>` tags around the matching query terms. - * - * @return the highlight - */ - public Boolean highlight() { - return highlight; - } - - /** - * Gets the passagesFields. - * - *

A comma-separated list of fields that passages are drawn from. If this parameter not - * specified, then all top-level fields are included. - * - * @return the passagesFields - */ - public String passagesFields() { - return passagesFields; - } - - /** - * Gets the passagesCount. - * - *

The maximum number of passages to return. The search returns fewer passages if the requested - * total is not found. The default is `10`. The maximum is `100`. - * - * @return the passagesCount - */ - public Long passagesCount() { - return passagesCount; - } - - /** - * Gets the passagesCharacters. - * - *

The approximate number of characters that any one passage will have. - * - * @return the passagesCharacters - */ - public Long passagesCharacters() { - return passagesCharacters; - } - - /** - * Gets the deduplicate. - * - *

When `true`, and used with a Watson Discovery News collection, duplicate results (based on - * the contents of the **title** field) are removed. Duplicate comparison is limited to the - * current query only; **offset** is not considered. This parameter is currently Beta - * functionality. - * - * @return the deduplicate - */ - public Boolean deduplicate() { - return deduplicate; - } - - /** - * Gets the deduplicateField. - * - *

When specified, duplicate results based on the field specified are removed from the returned - * results. Duplicate comparison is limited to the current query only, **offset** is not - * considered. This parameter is currently Beta functionality. - * - * @return the deduplicateField - */ - public String deduplicateField() { - return deduplicateField; - } - - /** - * Gets the similar. - * - *

When `true`, results are returned based on their similarity to the document IDs specified in - * the **similar.document_ids** parameter. - * - * @return the similar - */ - public Boolean similar() { - return similar; - } - - /** - * Gets the similarDocumentIds. - * - *

A comma-separated list of document IDs to find similar documents. - * - *

**Tip:** Include the **natural_language_query** parameter to expand the scope of the - * document similarity search with the natural language query. Other query parameters, such as - * **filter** and **query**, are subsequently applied and reduce the scope. - * - * @return the similarDocumentIds - */ - public String similarDocumentIds() { - return similarDocumentIds; - } - - /** - * Gets the similarFields. - * - *

A comma-separated list of field names that are used as a basis for comparison to identify - * similar documents. If not specified, the entire document is used for comparison. - * - * @return the similarFields - */ - public String similarFields() { - return similarFields; - } - - /** - * Gets the bias. - * - *

Field which the returned results will be biased against. The specified field must be either - * a **date** or **number** format. When a **date** type field is specified returned results are - * biased towards field values closer to the current date. When a **number** type field is - * specified, returned results are biased towards higher field values. This parameter cannot be - * used in the same query as the **sort** parameter. - * - * @return the bias - */ - public String bias() { - return bias; - } - - /** - * Gets the xWatsonLoggingOptOut. - * - *

If `true`, queries are not stored in the Discovery **Logs** endpoint. - * - * @return the xWatsonLoggingOptOut - */ - public Boolean xWatsonLoggingOptOut() { - return xWatsonLoggingOptOut; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Field.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Field.java deleted file mode 100644 index cfddb1db04d..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Field.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object containing field details. */ -public class Field extends GenericModel { - - /** The type of the field. */ - public interface Type { - /** nested. */ - String NESTED = "nested"; - /** string. */ - String STRING = "string"; - /** date. */ - String DATE = "date"; - /** long. */ - String X_LONG = "long"; - /** integer. */ - String INTEGER = "integer"; - /** short. */ - String X_SHORT = "short"; - /** byte. */ - String X_BYTE = "byte"; - /** double. */ - String X_DOUBLE = "double"; - /** float. */ - String X_FLOAT = "float"; - /** boolean. */ - String X_BOOLEAN = "boolean"; - /** binary. */ - String BINARY = "binary"; - } - - protected String field; - protected String type; - - protected Field() {} - - /** - * Gets the field. - * - *

The name of the field. - * - * @return the field - */ - public String getField() { - return field; - } - - /** - * Gets the type. - * - *

The type of the field. - * - * @return the type - */ - public String getType() { - return type; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FontSetting.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FontSetting.java deleted file mode 100644 index ac4216c9afd..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/FontSetting.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Font matching configuration. */ -public class FontSetting extends GenericModel { - - protected Long level; - - @SerializedName("min_size") - protected Long minSize; - - @SerializedName("max_size") - protected Long maxSize; - - protected Boolean bold; - protected Boolean italic; - protected String name; - - /** Builder. */ - public static class Builder { - private Long level; - private Long minSize; - private Long maxSize; - private Boolean bold; - private Boolean italic; - private String name; - - /** - * Instantiates a new Builder from an existing FontSetting instance. - * - * @param fontSetting the instance to initialize the Builder with - */ - private Builder(FontSetting fontSetting) { - this.level = fontSetting.level; - this.minSize = fontSetting.minSize; - this.maxSize = fontSetting.maxSize; - this.bold = fontSetting.bold; - this.italic = fontSetting.italic; - this.name = fontSetting.name; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a FontSetting. - * - * @return the new FontSetting instance - */ - public FontSetting build() { - return new FontSetting(this); - } - - /** - * Set the level. - * - * @param level the level - * @return the FontSetting builder - */ - public Builder level(long level) { - this.level = level; - return this; - } - - /** - * Set the minSize. - * - * @param minSize the minSize - * @return the FontSetting builder - */ - public Builder minSize(long minSize) { - this.minSize = minSize; - return this; - } - - /** - * Set the maxSize. - * - * @param maxSize the maxSize - * @return the FontSetting builder - */ - public Builder maxSize(long maxSize) { - this.maxSize = maxSize; - return this; - } - - /** - * Set the bold. - * - * @param bold the bold - * @return the FontSetting builder - */ - public Builder bold(Boolean bold) { - this.bold = bold; - return this; - } - - /** - * Set the italic. - * - * @param italic the italic - * @return the FontSetting builder - */ - public Builder italic(Boolean italic) { - this.italic = italic; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the FontSetting builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - } - - protected FontSetting() {} - - protected FontSetting(Builder builder) { - level = builder.level; - minSize = builder.minSize; - maxSize = builder.maxSize; - bold = builder.bold; - italic = builder.italic; - name = builder.name; - } - - /** - * New builder. - * - * @return a FontSetting builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the level. - * - *

The HTML heading level that any content with the matching font is converted to. - * - * @return the level - */ - public Long level() { - return level; - } - - /** - * Gets the minSize. - * - *

The minimum size of the font to match. - * - * @return the minSize - */ - public Long minSize() { - return minSize; - } - - /** - * Gets the maxSize. - * - *

The maximum size of the font to match. - * - * @return the maxSize - */ - public Long maxSize() { - return maxSize; - } - - /** - * Gets the bold. - * - *

When `true`, the font is matched if it is bold. - * - * @return the bold - */ - public Boolean bold() { - return bold; - } - - /** - * Gets the italic. - * - *

When `true`, the font is matched if it is italic. - * - * @return the italic - */ - public Boolean italic() { - return italic; - } - - /** - * Gets the name. - * - *

The name of the font. - * - * @return the name - */ - public String name() { - return name; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Gateway.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Gateway.java deleted file mode 100644 index 15ccc223cd9..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Gateway.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object describing a specific gateway. */ -public class Gateway extends GenericModel { - - /** - * The current status of the gateway. `connected` means the gateway is connected to the remotly - * installed gateway. `idle` means this gateway is not currently in use. - */ - public interface Status { - /** connected. */ - String CONNECTED = "connected"; - /** idle. */ - String IDLE = "idle"; - } - - @SerializedName("gateway_id") - protected String gatewayId; - - protected String name; - protected String status; - protected String token; - - @SerializedName("token_id") - protected String tokenId; - - protected Gateway() {} - - /** - * Gets the gatewayId. - * - *

The gateway ID of the gateway. - * - * @return the gatewayId - */ - public String getGatewayId() { - return gatewayId; - } - - /** - * Gets the name. - * - *

The user defined name of the gateway. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the status. - * - *

The current status of the gateway. `connected` means the gateway is connected to the remotly - * installed gateway. `idle` means this gateway is not currently in use. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the token. - * - *

The generated **token** for this gateway. The value of this field is used when configuring - * the remotly installed gateway. - * - * @return the token - */ - public String getToken() { - return token; - } - - /** - * Gets the tokenId. - * - *

The generated **token_id** for this gateway. The value of this field is used when - * configuring the remotly installed gateway. - * - * @return the tokenId - */ - public String getTokenId() { - return tokenId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayDelete.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayDelete.java deleted file mode 100644 index 7c66c36a8cd..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayDelete.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Gatway deletion confirmation. */ -public class GatewayDelete extends GenericModel { - - @SerializedName("gateway_id") - protected String gatewayId; - - protected String status; - - protected GatewayDelete() {} - - /** - * Gets the gatewayId. - * - *

The gateway ID of the deleted gateway. - * - * @return the gatewayId - */ - public String getGatewayId() { - return gatewayId; - } - - /** - * Gets the status. - * - *

The status of the request. - * - * @return the status - */ - public String getStatus() { - return status; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayList.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayList.java deleted file mode 100644 index 56a05e17d53..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GatewayList.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Object containing gateways array. */ -public class GatewayList extends GenericModel { - - protected List gateways; - - protected GatewayList() {} - - /** - * Gets the gateways. - * - *

Array of configured gateway connections. - * - * @return the gateways - */ - public List getGateways() { - return gateways; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetAutocompletionOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetAutocompletionOptions.java deleted file mode 100644 index 1b19f9a5b0c..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetAutocompletionOptions.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The getAutocompletion options. */ -public class GetAutocompletionOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String prefix; - protected String field; - protected Long count; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String prefix; - private String field; - private Long count; - - /** - * Instantiates a new Builder from an existing GetAutocompletionOptions instance. - * - * @param getAutocompletionOptions the instance to initialize the Builder with - */ - private Builder(GetAutocompletionOptions getAutocompletionOptions) { - this.environmentId = getAutocompletionOptions.environmentId; - this.collectionId = getAutocompletionOptions.collectionId; - this.prefix = getAutocompletionOptions.prefix; - this.field = getAutocompletionOptions.field; - this.count = getAutocompletionOptions.count; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param prefix the prefix - */ - public Builder(String environmentId, String collectionId, String prefix) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.prefix = prefix; - } - - /** - * Builds a GetAutocompletionOptions. - * - * @return the new GetAutocompletionOptions instance - */ - public GetAutocompletionOptions build() { - return new GetAutocompletionOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the GetAutocompletionOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the GetAutocompletionOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the prefix. - * - * @param prefix the prefix - * @return the GetAutocompletionOptions builder - */ - public Builder prefix(String prefix) { - this.prefix = prefix; - return this; - } - - /** - * Set the field. - * - * @param field the field - * @return the GetAutocompletionOptions builder - */ - public Builder field(String field) { - this.field = field; - return this; - } - - /** - * Set the count. - * - * @param count the count - * @return the GetAutocompletionOptions builder - */ - public Builder count(long count) { - this.count = count; - return this; - } - } - - protected GetAutocompletionOptions() {} - - protected GetAutocompletionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.prefix, "prefix cannot be null"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - prefix = builder.prefix; - field = builder.field; - count = builder.count; - } - - /** - * New builder. - * - * @return a GetAutocompletionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the prefix. - * - *

The prefix to use for autocompletion. For example, the prefix `Ho` could autocomplete to - * `hot`, `housing`, or `how`. - * - * @return the prefix - */ - public String prefix() { - return prefix; - } - - /** - * Gets the field. - * - *

The field in the result documents that autocompletion suggestions are identified from. - * - * @return the field - */ - public String field() { - return field; - } - - /** - * Gets the count. - * - *

The number of autocompletion suggestions to return. - * - * @return the count - */ - public Long count() { - return count; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCollectionOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCollectionOptions.java deleted file mode 100644 index b25ffab45a2..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCollectionOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The getCollection options. */ -public class GetCollectionOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - - /** - * Instantiates a new Builder from an existing GetCollectionOptions instance. - * - * @param getCollectionOptions the instance to initialize the Builder with - */ - private Builder(GetCollectionOptions getCollectionOptions) { - this.environmentId = getCollectionOptions.environmentId; - this.collectionId = getCollectionOptions.collectionId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a GetCollectionOptions. - * - * @return the new GetCollectionOptions instance - */ - public GetCollectionOptions build() { - return new GetCollectionOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the GetCollectionOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the GetCollectionOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - } - - protected GetCollectionOptions() {} - - protected GetCollectionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - } - - /** - * New builder. - * - * @return a GetCollectionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetConfigurationOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetConfigurationOptions.java deleted file mode 100644 index fd8469b0934..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetConfigurationOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The getConfiguration options. */ -public class GetConfigurationOptions extends GenericModel { - - protected String environmentId; - protected String configurationId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String configurationId; - - /** - * Instantiates a new Builder from an existing GetConfigurationOptions instance. - * - * @param getConfigurationOptions the instance to initialize the Builder with - */ - private Builder(GetConfigurationOptions getConfigurationOptions) { - this.environmentId = getConfigurationOptions.environmentId; - this.configurationId = getConfigurationOptions.configurationId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param configurationId the configurationId - */ - public Builder(String environmentId, String configurationId) { - this.environmentId = environmentId; - this.configurationId = configurationId; - } - - /** - * Builds a GetConfigurationOptions. - * - * @return the new GetConfigurationOptions instance - */ - public GetConfigurationOptions build() { - return new GetConfigurationOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the GetConfigurationOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the configurationId. - * - * @param configurationId the configurationId - * @return the GetConfigurationOptions builder - */ - public Builder configurationId(String configurationId) { - this.configurationId = configurationId; - return this; - } - } - - protected GetConfigurationOptions() {} - - protected GetConfigurationOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.configurationId, "configurationId cannot be empty"); - environmentId = builder.environmentId; - configurationId = builder.configurationId; - } - - /** - * New builder. - * - * @return a GetConfigurationOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the configurationId. - * - *

The ID of the configuration. - * - * @return the configurationId - */ - public String configurationId() { - return configurationId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCredentialsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCredentialsOptions.java deleted file mode 100644 index 51d5e9f1aad..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetCredentialsOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The getCredentials options. */ -public class GetCredentialsOptions extends GenericModel { - - protected String environmentId; - protected String credentialId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String credentialId; - - /** - * Instantiates a new Builder from an existing GetCredentialsOptions instance. - * - * @param getCredentialsOptions the instance to initialize the Builder with - */ - private Builder(GetCredentialsOptions getCredentialsOptions) { - this.environmentId = getCredentialsOptions.environmentId; - this.credentialId = getCredentialsOptions.credentialId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param credentialId the credentialId - */ - public Builder(String environmentId, String credentialId) { - this.environmentId = environmentId; - this.credentialId = credentialId; - } - - /** - * Builds a GetCredentialsOptions. - * - * @return the new GetCredentialsOptions instance - */ - public GetCredentialsOptions build() { - return new GetCredentialsOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the GetCredentialsOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the credentialId. - * - * @param credentialId the credentialId - * @return the GetCredentialsOptions builder - */ - public Builder credentialId(String credentialId) { - this.credentialId = credentialId; - return this; - } - } - - protected GetCredentialsOptions() {} - - protected GetCredentialsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.credentialId, "credentialId cannot be empty"); - environmentId = builder.environmentId; - credentialId = builder.credentialId; - } - - /** - * New builder. - * - * @return a GetCredentialsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the credentialId. - * - *

The unique identifier for a set of source credentials. - * - * @return the credentialId - */ - public String credentialId() { - return credentialId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetDocumentStatusOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetDocumentStatusOptions.java deleted file mode 100644 index 9413d33d180..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetDocumentStatusOptions.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The getDocumentStatus options. */ -public class GetDocumentStatusOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String documentId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String documentId; - - /** - * Instantiates a new Builder from an existing GetDocumentStatusOptions instance. - * - * @param getDocumentStatusOptions the instance to initialize the Builder with - */ - private Builder(GetDocumentStatusOptions getDocumentStatusOptions) { - this.environmentId = getDocumentStatusOptions.environmentId; - this.collectionId = getDocumentStatusOptions.collectionId; - this.documentId = getDocumentStatusOptions.documentId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param documentId the documentId - */ - public Builder(String environmentId, String collectionId, String documentId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.documentId = documentId; - } - - /** - * Builds a GetDocumentStatusOptions. - * - * @return the new GetDocumentStatusOptions instance - */ - public GetDocumentStatusOptions build() { - return new GetDocumentStatusOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the GetDocumentStatusOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the GetDocumentStatusOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the documentId. - * - * @param documentId the documentId - * @return the GetDocumentStatusOptions builder - */ - public Builder documentId(String documentId) { - this.documentId = documentId; - return this; - } - } - - protected GetDocumentStatusOptions() {} - - protected GetDocumentStatusOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.documentId, "documentId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - documentId = builder.documentId; - } - - /** - * New builder. - * - * @return a GetDocumentStatusOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the documentId. - * - *

The ID of the document. - * - * @return the documentId - */ - public String documentId() { - return documentId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetEnvironmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetEnvironmentOptions.java deleted file mode 100644 index f59478bbfdd..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetEnvironmentOptions.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The getEnvironment options. */ -public class GetEnvironmentOptions extends GenericModel { - - protected String environmentId; - - /** Builder. */ - public static class Builder { - private String environmentId; - - /** - * Instantiates a new Builder from an existing GetEnvironmentOptions instance. - * - * @param getEnvironmentOptions the instance to initialize the Builder with - */ - private Builder(GetEnvironmentOptions getEnvironmentOptions) { - this.environmentId = getEnvironmentOptions.environmentId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - */ - public Builder(String environmentId) { - this.environmentId = environmentId; - } - - /** - * Builds a GetEnvironmentOptions. - * - * @return the new GetEnvironmentOptions instance - */ - public GetEnvironmentOptions build() { - return new GetEnvironmentOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the GetEnvironmentOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - } - - protected GetEnvironmentOptions() {} - - protected GetEnvironmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - environmentId = builder.environmentId; - } - - /** - * New builder. - * - * @return a GetEnvironmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetGatewayOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetGatewayOptions.java deleted file mode 100644 index 886aaa62080..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetGatewayOptions.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The getGateway options. */ -public class GetGatewayOptions extends GenericModel { - - protected String environmentId; - protected String gatewayId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String gatewayId; - - /** - * Instantiates a new Builder from an existing GetGatewayOptions instance. - * - * @param getGatewayOptions the instance to initialize the Builder with - */ - private Builder(GetGatewayOptions getGatewayOptions) { - this.environmentId = getGatewayOptions.environmentId; - this.gatewayId = getGatewayOptions.gatewayId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param gatewayId the gatewayId - */ - public Builder(String environmentId, String gatewayId) { - this.environmentId = environmentId; - this.gatewayId = gatewayId; - } - - /** - * Builds a GetGatewayOptions. - * - * @return the new GetGatewayOptions instance - */ - public GetGatewayOptions build() { - return new GetGatewayOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the GetGatewayOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the gatewayId. - * - * @param gatewayId the gatewayId - * @return the GetGatewayOptions builder - */ - public Builder gatewayId(String gatewayId) { - this.gatewayId = gatewayId; - return this; - } - } - - protected GetGatewayOptions() {} - - protected GetGatewayOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.gatewayId, "gatewayId cannot be empty"); - environmentId = builder.environmentId; - gatewayId = builder.gatewayId; - } - - /** - * New builder. - * - * @return a GetGatewayOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the gatewayId. - * - *

The requested gateway ID. - * - * @return the gatewayId - */ - public String gatewayId() { - return gatewayId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsEventRateOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsEventRateOptions.java deleted file mode 100644 index 7778a17f760..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsEventRateOptions.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Date; - -/** The getMetricsEventRate options. */ -public class GetMetricsEventRateOptions extends GenericModel { - - /** The type of result to consider when calculating the metric. */ - public interface ResultType { - /** document. */ - String DOCUMENT = "document"; - } - - protected Date startTime; - protected Date endTime; - protected String resultType; - - /** Builder. */ - public static class Builder { - private Date startTime; - private Date endTime; - private String resultType; - - /** - * Instantiates a new Builder from an existing GetMetricsEventRateOptions instance. - * - * @param getMetricsEventRateOptions the instance to initialize the Builder with - */ - private Builder(GetMetricsEventRateOptions getMetricsEventRateOptions) { - this.startTime = getMetricsEventRateOptions.startTime; - this.endTime = getMetricsEventRateOptions.endTime; - this.resultType = getMetricsEventRateOptions.resultType; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a GetMetricsEventRateOptions. - * - * @return the new GetMetricsEventRateOptions instance - */ - public GetMetricsEventRateOptions build() { - return new GetMetricsEventRateOptions(this); - } - - /** - * Set the startTime. - * - * @param startTime the startTime - * @return the GetMetricsEventRateOptions builder - */ - public Builder startTime(Date startTime) { - this.startTime = startTime; - return this; - } - - /** - * Set the endTime. - * - * @param endTime the endTime - * @return the GetMetricsEventRateOptions builder - */ - public Builder endTime(Date endTime) { - this.endTime = endTime; - return this; - } - - /** - * Set the resultType. - * - * @param resultType the resultType - * @return the GetMetricsEventRateOptions builder - */ - public Builder resultType(String resultType) { - this.resultType = resultType; - return this; - } - } - - protected GetMetricsEventRateOptions() {} - - protected GetMetricsEventRateOptions(Builder builder) { - startTime = builder.startTime; - endTime = builder.endTime; - resultType = builder.resultType; - } - - /** - * New builder. - * - * @return a GetMetricsEventRateOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the startTime. - * - *

Metric is computed from data recorded after this timestamp; must be in - * `YYYY-MM-DDThh:mm:ssZ` format. - * - * @return the startTime - */ - public Date startTime() { - return startTime; - } - - /** - * Gets the endTime. - * - *

Metric is computed from data recorded before this timestamp; must be in - * `YYYY-MM-DDThh:mm:ssZ` format. - * - * @return the endTime - */ - public Date endTime() { - return endTime; - } - - /** - * Gets the resultType. - * - *

The type of result to consider when calculating the metric. - * - * @return the resultType - */ - public String resultType() { - return resultType; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryEventOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryEventOptions.java deleted file mode 100644 index fb2abf12342..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryEventOptions.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Date; - -/** The getMetricsQueryEvent options. */ -public class GetMetricsQueryEventOptions extends GenericModel { - - /** The type of result to consider when calculating the metric. */ - public interface ResultType { - /** document. */ - String DOCUMENT = "document"; - } - - protected Date startTime; - protected Date endTime; - protected String resultType; - - /** Builder. */ - public static class Builder { - private Date startTime; - private Date endTime; - private String resultType; - - /** - * Instantiates a new Builder from an existing GetMetricsQueryEventOptions instance. - * - * @param getMetricsQueryEventOptions the instance to initialize the Builder with - */ - private Builder(GetMetricsQueryEventOptions getMetricsQueryEventOptions) { - this.startTime = getMetricsQueryEventOptions.startTime; - this.endTime = getMetricsQueryEventOptions.endTime; - this.resultType = getMetricsQueryEventOptions.resultType; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a GetMetricsQueryEventOptions. - * - * @return the new GetMetricsQueryEventOptions instance - */ - public GetMetricsQueryEventOptions build() { - return new GetMetricsQueryEventOptions(this); - } - - /** - * Set the startTime. - * - * @param startTime the startTime - * @return the GetMetricsQueryEventOptions builder - */ - public Builder startTime(Date startTime) { - this.startTime = startTime; - return this; - } - - /** - * Set the endTime. - * - * @param endTime the endTime - * @return the GetMetricsQueryEventOptions builder - */ - public Builder endTime(Date endTime) { - this.endTime = endTime; - return this; - } - - /** - * Set the resultType. - * - * @param resultType the resultType - * @return the GetMetricsQueryEventOptions builder - */ - public Builder resultType(String resultType) { - this.resultType = resultType; - return this; - } - } - - protected GetMetricsQueryEventOptions() {} - - protected GetMetricsQueryEventOptions(Builder builder) { - startTime = builder.startTime; - endTime = builder.endTime; - resultType = builder.resultType; - } - - /** - * New builder. - * - * @return a GetMetricsQueryEventOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the startTime. - * - *

Metric is computed from data recorded after this timestamp; must be in - * `YYYY-MM-DDThh:mm:ssZ` format. - * - * @return the startTime - */ - public Date startTime() { - return startTime; - } - - /** - * Gets the endTime. - * - *

Metric is computed from data recorded before this timestamp; must be in - * `YYYY-MM-DDThh:mm:ssZ` format. - * - * @return the endTime - */ - public Date endTime() { - return endTime; - } - - /** - * Gets the resultType. - * - *

The type of result to consider when calculating the metric. - * - * @return the resultType - */ - public String resultType() { - return resultType; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryNoResultsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryNoResultsOptions.java deleted file mode 100644 index 73aa50c1df5..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryNoResultsOptions.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Date; - -/** The getMetricsQueryNoResults options. */ -public class GetMetricsQueryNoResultsOptions extends GenericModel { - - /** The type of result to consider when calculating the metric. */ - public interface ResultType { - /** document. */ - String DOCUMENT = "document"; - } - - protected Date startTime; - protected Date endTime; - protected String resultType; - - /** Builder. */ - public static class Builder { - private Date startTime; - private Date endTime; - private String resultType; - - /** - * Instantiates a new Builder from an existing GetMetricsQueryNoResultsOptions instance. - * - * @param getMetricsQueryNoResultsOptions the instance to initialize the Builder with - */ - private Builder(GetMetricsQueryNoResultsOptions getMetricsQueryNoResultsOptions) { - this.startTime = getMetricsQueryNoResultsOptions.startTime; - this.endTime = getMetricsQueryNoResultsOptions.endTime; - this.resultType = getMetricsQueryNoResultsOptions.resultType; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a GetMetricsQueryNoResultsOptions. - * - * @return the new GetMetricsQueryNoResultsOptions instance - */ - public GetMetricsQueryNoResultsOptions build() { - return new GetMetricsQueryNoResultsOptions(this); - } - - /** - * Set the startTime. - * - * @param startTime the startTime - * @return the GetMetricsQueryNoResultsOptions builder - */ - public Builder startTime(Date startTime) { - this.startTime = startTime; - return this; - } - - /** - * Set the endTime. - * - * @param endTime the endTime - * @return the GetMetricsQueryNoResultsOptions builder - */ - public Builder endTime(Date endTime) { - this.endTime = endTime; - return this; - } - - /** - * Set the resultType. - * - * @param resultType the resultType - * @return the GetMetricsQueryNoResultsOptions builder - */ - public Builder resultType(String resultType) { - this.resultType = resultType; - return this; - } - } - - protected GetMetricsQueryNoResultsOptions() {} - - protected GetMetricsQueryNoResultsOptions(Builder builder) { - startTime = builder.startTime; - endTime = builder.endTime; - resultType = builder.resultType; - } - - /** - * New builder. - * - * @return a GetMetricsQueryNoResultsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the startTime. - * - *

Metric is computed from data recorded after this timestamp; must be in - * `YYYY-MM-DDThh:mm:ssZ` format. - * - * @return the startTime - */ - public Date startTime() { - return startTime; - } - - /** - * Gets the endTime. - * - *

Metric is computed from data recorded before this timestamp; must be in - * `YYYY-MM-DDThh:mm:ssZ` format. - * - * @return the endTime - */ - public Date endTime() { - return endTime; - } - - /** - * Gets the resultType. - * - *

The type of result to consider when calculating the metric. - * - * @return the resultType - */ - public String resultType() { - return resultType; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryOptions.java deleted file mode 100644 index 6e9260b4907..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryOptions.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Date; - -/** The getMetricsQuery options. */ -public class GetMetricsQueryOptions extends GenericModel { - - /** The type of result to consider when calculating the metric. */ - public interface ResultType { - /** document. */ - String DOCUMENT = "document"; - } - - protected Date startTime; - protected Date endTime; - protected String resultType; - - /** Builder. */ - public static class Builder { - private Date startTime; - private Date endTime; - private String resultType; - - /** - * Instantiates a new Builder from an existing GetMetricsQueryOptions instance. - * - * @param getMetricsQueryOptions the instance to initialize the Builder with - */ - private Builder(GetMetricsQueryOptions getMetricsQueryOptions) { - this.startTime = getMetricsQueryOptions.startTime; - this.endTime = getMetricsQueryOptions.endTime; - this.resultType = getMetricsQueryOptions.resultType; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a GetMetricsQueryOptions. - * - * @return the new GetMetricsQueryOptions instance - */ - public GetMetricsQueryOptions build() { - return new GetMetricsQueryOptions(this); - } - - /** - * Set the startTime. - * - * @param startTime the startTime - * @return the GetMetricsQueryOptions builder - */ - public Builder startTime(Date startTime) { - this.startTime = startTime; - return this; - } - - /** - * Set the endTime. - * - * @param endTime the endTime - * @return the GetMetricsQueryOptions builder - */ - public Builder endTime(Date endTime) { - this.endTime = endTime; - return this; - } - - /** - * Set the resultType. - * - * @param resultType the resultType - * @return the GetMetricsQueryOptions builder - */ - public Builder resultType(String resultType) { - this.resultType = resultType; - return this; - } - } - - protected GetMetricsQueryOptions() {} - - protected GetMetricsQueryOptions(Builder builder) { - startTime = builder.startTime; - endTime = builder.endTime; - resultType = builder.resultType; - } - - /** - * New builder. - * - * @return a GetMetricsQueryOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the startTime. - * - *

Metric is computed from data recorded after this timestamp; must be in - * `YYYY-MM-DDThh:mm:ssZ` format. - * - * @return the startTime - */ - public Date startTime() { - return startTime; - } - - /** - * Gets the endTime. - * - *

Metric is computed from data recorded before this timestamp; must be in - * `YYYY-MM-DDThh:mm:ssZ` format. - * - * @return the endTime - */ - public Date endTime() { - return endTime; - } - - /** - * Gets the resultType. - * - *

The type of result to consider when calculating the metric. - * - * @return the resultType - */ - public String resultType() { - return resultType; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryTokenEventOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryTokenEventOptions.java deleted file mode 100644 index 8d7e337e1c2..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryTokenEventOptions.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The getMetricsQueryTokenEvent options. */ -public class GetMetricsQueryTokenEventOptions extends GenericModel { - - protected Long count; - - /** Builder. */ - public static class Builder { - private Long count; - - /** - * Instantiates a new Builder from an existing GetMetricsQueryTokenEventOptions instance. - * - * @param getMetricsQueryTokenEventOptions the instance to initialize the Builder with - */ - private Builder(GetMetricsQueryTokenEventOptions getMetricsQueryTokenEventOptions) { - this.count = getMetricsQueryTokenEventOptions.count; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a GetMetricsQueryTokenEventOptions. - * - * @return the new GetMetricsQueryTokenEventOptions instance - */ - public GetMetricsQueryTokenEventOptions build() { - return new GetMetricsQueryTokenEventOptions(this); - } - - /** - * Set the count. - * - * @param count the count - * @return the GetMetricsQueryTokenEventOptions builder - */ - public Builder count(long count) { - this.count = count; - return this; - } - } - - protected GetMetricsQueryTokenEventOptions() {} - - protected GetMetricsQueryTokenEventOptions(Builder builder) { - count = builder.count; - } - - /** - * New builder. - * - * @return a GetMetricsQueryTokenEventOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the count. - * - *

Number of results to return. The maximum for the **count** and **offset** values together in - * any one query is **10000**. - * - * @return the count - */ - public Long count() { - return count; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetStopwordListStatusOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetStopwordListStatusOptions.java deleted file mode 100644 index 5817bb3478d..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetStopwordListStatusOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The getStopwordListStatus options. */ -public class GetStopwordListStatusOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - - /** - * Instantiates a new Builder from an existing GetStopwordListStatusOptions instance. - * - * @param getStopwordListStatusOptions the instance to initialize the Builder with - */ - private Builder(GetStopwordListStatusOptions getStopwordListStatusOptions) { - this.environmentId = getStopwordListStatusOptions.environmentId; - this.collectionId = getStopwordListStatusOptions.collectionId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a GetStopwordListStatusOptions. - * - * @return the new GetStopwordListStatusOptions instance - */ - public GetStopwordListStatusOptions build() { - return new GetStopwordListStatusOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the GetStopwordListStatusOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the GetStopwordListStatusOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - } - - protected GetStopwordListStatusOptions() {} - - protected GetStopwordListStatusOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - } - - /** - * New builder. - * - * @return a GetStopwordListStatusOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTokenizationDictionaryStatusOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTokenizationDictionaryStatusOptions.java deleted file mode 100644 index c5e731db10b..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTokenizationDictionaryStatusOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The getTokenizationDictionaryStatus options. */ -public class GetTokenizationDictionaryStatusOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - - /** - * Instantiates a new Builder from an existing GetTokenizationDictionaryStatusOptions instance. - * - * @param getTokenizationDictionaryStatusOptions the instance to initialize the Builder with - */ - private Builder(GetTokenizationDictionaryStatusOptions getTokenizationDictionaryStatusOptions) { - this.environmentId = getTokenizationDictionaryStatusOptions.environmentId; - this.collectionId = getTokenizationDictionaryStatusOptions.collectionId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a GetTokenizationDictionaryStatusOptions. - * - * @return the new GetTokenizationDictionaryStatusOptions instance - */ - public GetTokenizationDictionaryStatusOptions build() { - return new GetTokenizationDictionaryStatusOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the GetTokenizationDictionaryStatusOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the GetTokenizationDictionaryStatusOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - } - - protected GetTokenizationDictionaryStatusOptions() {} - - protected GetTokenizationDictionaryStatusOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - } - - /** - * New builder. - * - * @return a GetTokenizationDictionaryStatusOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingDataOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingDataOptions.java deleted file mode 100644 index cd79a265823..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingDataOptions.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The getTrainingData options. */ -public class GetTrainingDataOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String queryId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String queryId; - - /** - * Instantiates a new Builder from an existing GetTrainingDataOptions instance. - * - * @param getTrainingDataOptions the instance to initialize the Builder with - */ - private Builder(GetTrainingDataOptions getTrainingDataOptions) { - this.environmentId = getTrainingDataOptions.environmentId; - this.collectionId = getTrainingDataOptions.collectionId; - this.queryId = getTrainingDataOptions.queryId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param queryId the queryId - */ - public Builder(String environmentId, String collectionId, String queryId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.queryId = queryId; - } - - /** - * Builds a GetTrainingDataOptions. - * - * @return the new GetTrainingDataOptions instance - */ - public GetTrainingDataOptions build() { - return new GetTrainingDataOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the GetTrainingDataOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the GetTrainingDataOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the queryId. - * - * @param queryId the queryId - * @return the GetTrainingDataOptions builder - */ - public Builder queryId(String queryId) { - this.queryId = queryId; - return this; - } - } - - protected GetTrainingDataOptions() {} - - protected GetTrainingDataOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, "queryId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - queryId = builder.queryId; - } - - /** - * New builder. - * - * @return a GetTrainingDataOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the queryId. - * - *

The ID of the query used for training. - * - * @return the queryId - */ - public String queryId() { - return queryId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingExampleOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingExampleOptions.java deleted file mode 100644 index d8a2e3bc6de..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/GetTrainingExampleOptions.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The getTrainingExample options. */ -public class GetTrainingExampleOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String queryId; - protected String exampleId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String queryId; - private String exampleId; - - /** - * Instantiates a new Builder from an existing GetTrainingExampleOptions instance. - * - * @param getTrainingExampleOptions the instance to initialize the Builder with - */ - private Builder(GetTrainingExampleOptions getTrainingExampleOptions) { - this.environmentId = getTrainingExampleOptions.environmentId; - this.collectionId = getTrainingExampleOptions.collectionId; - this.queryId = getTrainingExampleOptions.queryId; - this.exampleId = getTrainingExampleOptions.exampleId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param queryId the queryId - * @param exampleId the exampleId - */ - public Builder(String environmentId, String collectionId, String queryId, String exampleId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.queryId = queryId; - this.exampleId = exampleId; - } - - /** - * Builds a GetTrainingExampleOptions. - * - * @return the new GetTrainingExampleOptions instance - */ - public GetTrainingExampleOptions build() { - return new GetTrainingExampleOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the GetTrainingExampleOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the GetTrainingExampleOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the queryId. - * - * @param queryId the queryId - * @return the GetTrainingExampleOptions builder - */ - public Builder queryId(String queryId) { - this.queryId = queryId; - return this; - } - - /** - * Set the exampleId. - * - * @param exampleId the exampleId - * @return the GetTrainingExampleOptions builder - */ - public Builder exampleId(String exampleId) { - this.exampleId = exampleId; - return this; - } - } - - protected GetTrainingExampleOptions() {} - - protected GetTrainingExampleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, "queryId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.exampleId, "exampleId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - queryId = builder.queryId; - exampleId = builder.exampleId; - } - - /** - * New builder. - * - * @return a GetTrainingExampleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the queryId. - * - *

The ID of the query used for training. - * - * @return the queryId - */ - public String queryId() { - return queryId; - } - - /** - * Gets the exampleId. - * - *

The ID of the document as it is indexed. - * - * @return the exampleId - */ - public String exampleId() { - return exampleId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/HtmlSettings.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/HtmlSettings.java deleted file mode 100644 index f50c2ac4db1..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/HtmlSettings.java +++ /dev/null @@ -1,292 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** A list of HTML conversion settings. */ -public class HtmlSettings extends GenericModel { - - @SerializedName("exclude_tags_completely") - protected List excludeTagsCompletely; - - @SerializedName("exclude_tags_keep_content") - protected List excludeTagsKeepContent; - - @SerializedName("keep_content") - protected XPathPatterns keepContent; - - @SerializedName("exclude_content") - protected XPathPatterns excludeContent; - - @SerializedName("keep_tag_attributes") - protected List keepTagAttributes; - - @SerializedName("exclude_tag_attributes") - protected List excludeTagAttributes; - - /** Builder. */ - public static class Builder { - private List excludeTagsCompletely; - private List excludeTagsKeepContent; - private XPathPatterns keepContent; - private XPathPatterns excludeContent; - private List keepTagAttributes; - private List excludeTagAttributes; - - /** - * Instantiates a new Builder from an existing HtmlSettings instance. - * - * @param htmlSettings the instance to initialize the Builder with - */ - private Builder(HtmlSettings htmlSettings) { - this.excludeTagsCompletely = htmlSettings.excludeTagsCompletely; - this.excludeTagsKeepContent = htmlSettings.excludeTagsKeepContent; - this.keepContent = htmlSettings.keepContent; - this.excludeContent = htmlSettings.excludeContent; - this.keepTagAttributes = htmlSettings.keepTagAttributes; - this.excludeTagAttributes = htmlSettings.excludeTagAttributes; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a HtmlSettings. - * - * @return the new HtmlSettings instance - */ - public HtmlSettings build() { - return new HtmlSettings(this); - } - - /** - * Adds a new element to excludeTagsCompletely. - * - * @param excludeTagsCompletely the new element to be added - * @return the HtmlSettings builder - */ - public Builder addExcludeTagsCompletely(String excludeTagsCompletely) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - excludeTagsCompletely, "excludeTagsCompletely cannot be null"); - if (this.excludeTagsCompletely == null) { - this.excludeTagsCompletely = new ArrayList(); - } - this.excludeTagsCompletely.add(excludeTagsCompletely); - return this; - } - - /** - * Adds a new element to excludeTagsKeepContent. - * - * @param excludeTagsKeepContent the new element to be added - * @return the HtmlSettings builder - */ - public Builder addExcludeTagsKeepContent(String excludeTagsKeepContent) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - excludeTagsKeepContent, "excludeTagsKeepContent cannot be null"); - if (this.excludeTagsKeepContent == null) { - this.excludeTagsKeepContent = new ArrayList(); - } - this.excludeTagsKeepContent.add(excludeTagsKeepContent); - return this; - } - - /** - * Adds a new element to keepTagAttributes. - * - * @param keepTagAttributes the new element to be added - * @return the HtmlSettings builder - */ - public Builder addKeepTagAttributes(String keepTagAttributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - keepTagAttributes, "keepTagAttributes cannot be null"); - if (this.keepTagAttributes == null) { - this.keepTagAttributes = new ArrayList(); - } - this.keepTagAttributes.add(keepTagAttributes); - return this; - } - - /** - * Adds a new element to excludeTagAttributes. - * - * @param excludeTagAttributes the new element to be added - * @return the HtmlSettings builder - */ - public Builder addExcludeTagAttributes(String excludeTagAttributes) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - excludeTagAttributes, "excludeTagAttributes cannot be null"); - if (this.excludeTagAttributes == null) { - this.excludeTagAttributes = new ArrayList(); - } - this.excludeTagAttributes.add(excludeTagAttributes); - return this; - } - - /** - * Set the excludeTagsCompletely. Existing excludeTagsCompletely will be replaced. - * - * @param excludeTagsCompletely the excludeTagsCompletely - * @return the HtmlSettings builder - */ - public Builder excludeTagsCompletely(List excludeTagsCompletely) { - this.excludeTagsCompletely = excludeTagsCompletely; - return this; - } - - /** - * Set the excludeTagsKeepContent. Existing excludeTagsKeepContent will be replaced. - * - * @param excludeTagsKeepContent the excludeTagsKeepContent - * @return the HtmlSettings builder - */ - public Builder excludeTagsKeepContent(List excludeTagsKeepContent) { - this.excludeTagsKeepContent = excludeTagsKeepContent; - return this; - } - - /** - * Set the keepContent. - * - * @param keepContent the keepContent - * @return the HtmlSettings builder - */ - public Builder keepContent(XPathPatterns keepContent) { - this.keepContent = keepContent; - return this; - } - - /** - * Set the excludeContent. - * - * @param excludeContent the excludeContent - * @return the HtmlSettings builder - */ - public Builder excludeContent(XPathPatterns excludeContent) { - this.excludeContent = excludeContent; - return this; - } - - /** - * Set the keepTagAttributes. Existing keepTagAttributes will be replaced. - * - * @param keepTagAttributes the keepTagAttributes - * @return the HtmlSettings builder - */ - public Builder keepTagAttributes(List keepTagAttributes) { - this.keepTagAttributes = keepTagAttributes; - return this; - } - - /** - * Set the excludeTagAttributes. Existing excludeTagAttributes will be replaced. - * - * @param excludeTagAttributes the excludeTagAttributes - * @return the HtmlSettings builder - */ - public Builder excludeTagAttributes(List excludeTagAttributes) { - this.excludeTagAttributes = excludeTagAttributes; - return this; - } - } - - protected HtmlSettings() {} - - protected HtmlSettings(Builder builder) { - excludeTagsCompletely = builder.excludeTagsCompletely; - excludeTagsKeepContent = builder.excludeTagsKeepContent; - keepContent = builder.keepContent; - excludeContent = builder.excludeContent; - keepTagAttributes = builder.keepTagAttributes; - excludeTagAttributes = builder.excludeTagAttributes; - } - - /** - * New builder. - * - * @return a HtmlSettings builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the excludeTagsCompletely. - * - *

Array of HTML tags that are excluded completely. - * - * @return the excludeTagsCompletely - */ - public List excludeTagsCompletely() { - return excludeTagsCompletely; - } - - /** - * Gets the excludeTagsKeepContent. - * - *

Array of HTML tags which are excluded but still retain content. - * - * @return the excludeTagsKeepContent - */ - public List excludeTagsKeepContent() { - return excludeTagsKeepContent; - } - - /** - * Gets the keepContent. - * - *

Object containing an array of XPaths. - * - * @return the keepContent - */ - public XPathPatterns keepContent() { - return keepContent; - } - - /** - * Gets the excludeContent. - * - *

Object containing an array of XPaths. - * - * @return the excludeContent - */ - public XPathPatterns excludeContent() { - return excludeContent; - } - - /** - * Gets the keepTagAttributes. - * - *

An array of HTML tag attributes to keep in the converted document. - * - * @return the keepTagAttributes - */ - public List keepTagAttributes() { - return keepTagAttributes; - } - - /** - * Gets the excludeTagAttributes. - * - *

Array of HTML tag attributes to exclude. - * - * @return the excludeTagAttributes - */ - public List excludeTagAttributes() { - return excludeTagAttributes; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/IndexCapacity.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/IndexCapacity.java deleted file mode 100644 index 0b09d5d117f..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/IndexCapacity.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Details about the resource usage and capacity of the environment. */ -public class IndexCapacity extends GenericModel { - - protected EnvironmentDocuments documents; - - @SerializedName("disk_usage") - protected DiskUsage diskUsage; - - protected CollectionUsage collections; - - protected IndexCapacity() {} - - /** - * Gets the documents. - * - *

Summary of the document usage statistics for the environment. - * - * @return the documents - */ - public EnvironmentDocuments getDocuments() { - return documents; - } - - /** - * Gets the diskUsage. - * - *

Summary of the disk usage statistics for the environment. - * - * @return the diskUsage - */ - public DiskUsage getDiskUsage() { - return diskUsage; - } - - /** - * Gets the collections. - * - *

Summary of the collection usage in the environment. - * - * @return the collections - */ - public CollectionUsage getCollections() { - return collections; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsOptions.java deleted file mode 100644 index eff7f1a9bbb..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The listCollectionFields options. */ -public class ListCollectionFieldsOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - - /** - * Instantiates a new Builder from an existing ListCollectionFieldsOptions instance. - * - * @param listCollectionFieldsOptions the instance to initialize the Builder with - */ - private Builder(ListCollectionFieldsOptions listCollectionFieldsOptions) { - this.environmentId = listCollectionFieldsOptions.environmentId; - this.collectionId = listCollectionFieldsOptions.collectionId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a ListCollectionFieldsOptions. - * - * @return the new ListCollectionFieldsOptions instance - */ - public ListCollectionFieldsOptions build() { - return new ListCollectionFieldsOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the ListCollectionFieldsOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the ListCollectionFieldsOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - } - - protected ListCollectionFieldsOptions() {} - - protected ListCollectionFieldsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - } - - /** - * New builder. - * - * @return a ListCollectionFieldsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsResponse.java deleted file mode 100644 index 7f4e21f19fb..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsResponse.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** - * The list of fetched fields. - * - *

The fields are returned using a fully qualified name format, however, the format differs - * slightly from that used by the query operations. - * - *

* Fields which contain nested JSON objects are assigned a type of "nested". - * - *

* Fields which belong to a nested object are prefixed with `.properties` (for example, - * `warnings.properties.severity` means that the `warnings` object has a property called - * `severity`). - * - *

* Fields returned from the News collection are prefixed with - * `v{N}-fullnews-t3-{YEAR}.mappings` (for example, - * `v5-fullnews-t3-2016.mappings.text.properties.author`). - */ -public class ListCollectionFieldsResponse extends GenericModel { - - protected List fields; - - protected ListCollectionFieldsResponse() {} - - /** - * Gets the fields. - * - *

An array containing information about each field in the collections. - * - * @return the fields - */ - public List getFields() { - return fields; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsOptions.java deleted file mode 100644 index 67fb0a0c67c..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsOptions.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The listCollections options. */ -public class ListCollectionsOptions extends GenericModel { - - protected String environmentId; - protected String name; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String name; - - /** - * Instantiates a new Builder from an existing ListCollectionsOptions instance. - * - * @param listCollectionsOptions the instance to initialize the Builder with - */ - private Builder(ListCollectionsOptions listCollectionsOptions) { - this.environmentId = listCollectionsOptions.environmentId; - this.name = listCollectionsOptions.name; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - */ - public Builder(String environmentId) { - this.environmentId = environmentId; - } - - /** - * Builds a ListCollectionsOptions. - * - * @return the new ListCollectionsOptions instance - */ - public ListCollectionsOptions build() { - return new ListCollectionsOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the ListCollectionsOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListCollectionsOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - } - - protected ListCollectionsOptions() {} - - protected ListCollectionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - environmentId = builder.environmentId; - name = builder.name; - } - - /** - * New builder. - * - * @return a ListCollectionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the name. - * - *

Find collections with the given name. - * - * @return the name - */ - public String name() { - return name; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsResponse.java deleted file mode 100644 index fbbabf730a7..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCollectionsResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Response object containing an array of collection details. */ -public class ListCollectionsResponse extends GenericModel { - - protected List collections; - - protected ListCollectionsResponse() {} - - /** - * Gets the collections. - * - *

An array containing information about each collection in the environment. - * - * @return the collections - */ - public List getCollections() { - return collections; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsOptions.java deleted file mode 100644 index 63f47a721dc..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsOptions.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The listConfigurations options. */ -public class ListConfigurationsOptions extends GenericModel { - - protected String environmentId; - protected String name; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String name; - - /** - * Instantiates a new Builder from an existing ListConfigurationsOptions instance. - * - * @param listConfigurationsOptions the instance to initialize the Builder with - */ - private Builder(ListConfigurationsOptions listConfigurationsOptions) { - this.environmentId = listConfigurationsOptions.environmentId; - this.name = listConfigurationsOptions.name; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - */ - public Builder(String environmentId) { - this.environmentId = environmentId; - } - - /** - * Builds a ListConfigurationsOptions. - * - * @return the new ListConfigurationsOptions instance - */ - public ListConfigurationsOptions build() { - return new ListConfigurationsOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the ListConfigurationsOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the ListConfigurationsOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - } - - protected ListConfigurationsOptions() {} - - protected ListConfigurationsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - environmentId = builder.environmentId; - name = builder.name; - } - - /** - * New builder. - * - * @return a ListConfigurationsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the name. - * - *

Find configurations with the given name. - * - * @return the name - */ - public String name() { - return name; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsResponse.java deleted file mode 100644 index 00353bd94f8..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListConfigurationsResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Object containing an array of available configurations. */ -public class ListConfigurationsResponse extends GenericModel { - - protected List configurations; - - protected ListConfigurationsResponse() {} - - /** - * Gets the configurations. - * - *

An array of configurations that are available for the service instance. - * - * @return the configurations - */ - public List getConfigurations() { - return configurations; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCredentialsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCredentialsOptions.java deleted file mode 100644 index 538af7ee9ce..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListCredentialsOptions.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The listCredentials options. */ -public class ListCredentialsOptions extends GenericModel { - - protected String environmentId; - - /** Builder. */ - public static class Builder { - private String environmentId; - - /** - * Instantiates a new Builder from an existing ListCredentialsOptions instance. - * - * @param listCredentialsOptions the instance to initialize the Builder with - */ - private Builder(ListCredentialsOptions listCredentialsOptions) { - this.environmentId = listCredentialsOptions.environmentId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - */ - public Builder(String environmentId) { - this.environmentId = environmentId; - } - - /** - * Builds a ListCredentialsOptions. - * - * @return the new ListCredentialsOptions instance - */ - public ListCredentialsOptions build() { - return new ListCredentialsOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the ListCredentialsOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - } - - protected ListCredentialsOptions() {} - - protected ListCredentialsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - environmentId = builder.environmentId; - } - - /** - * New builder. - * - * @return a ListCredentialsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsOptions.java deleted file mode 100644 index 022ce2d9ec9..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsOptions.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The listEnvironments options. */ -public class ListEnvironmentsOptions extends GenericModel { - - protected String name; - - /** Builder. */ - public static class Builder { - private String name; - - /** - * Instantiates a new Builder from an existing ListEnvironmentsOptions instance. - * - * @param listEnvironmentsOptions the instance to initialize the Builder with - */ - private Builder(ListEnvironmentsOptions listEnvironmentsOptions) { - this.name = listEnvironmentsOptions.name; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a ListEnvironmentsOptions. - * - * @return the new ListEnvironmentsOptions instance - */ - public ListEnvironmentsOptions build() { - return new ListEnvironmentsOptions(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the ListEnvironmentsOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - } - - protected ListEnvironmentsOptions() {} - - protected ListEnvironmentsOptions(Builder builder) { - name = builder.name; - } - - /** - * New builder. - * - * @return a ListEnvironmentsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - *

Show only the environment with the given name. - * - * @return the name - */ - public String name() { - return name; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsResponse.java deleted file mode 100644 index 4dbe6f21aab..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Response object containing an array of configured environments. */ -public class ListEnvironmentsResponse extends GenericModel { - - protected List environments; - - protected ListEnvironmentsResponse() {} - - /** - * Gets the environments. - * - *

An array of [environments] that are available for the service instance. - * - * @return the environments - */ - public List getEnvironments() { - return environments; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListExpansionsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListExpansionsOptions.java deleted file mode 100644 index 7809135af8a..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListExpansionsOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The listExpansions options. */ -public class ListExpansionsOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - - /** - * Instantiates a new Builder from an existing ListExpansionsOptions instance. - * - * @param listExpansionsOptions the instance to initialize the Builder with - */ - private Builder(ListExpansionsOptions listExpansionsOptions) { - this.environmentId = listExpansionsOptions.environmentId; - this.collectionId = listExpansionsOptions.collectionId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a ListExpansionsOptions. - * - * @return the new ListExpansionsOptions instance - */ - public ListExpansionsOptions build() { - return new ListExpansionsOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the ListExpansionsOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the ListExpansionsOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - } - - protected ListExpansionsOptions() {} - - protected ListExpansionsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - } - - /** - * New builder. - * - * @return a ListExpansionsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListFieldsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListFieldsOptions.java deleted file mode 100644 index 22293d9fa50..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListFieldsOptions.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** The listFields options. */ -public class ListFieldsOptions extends GenericModel { - - protected String environmentId; - protected List collectionIds; - - /** Builder. */ - public static class Builder { - private String environmentId; - private List collectionIds; - - /** - * Instantiates a new Builder from an existing ListFieldsOptions instance. - * - * @param listFieldsOptions the instance to initialize the Builder with - */ - private Builder(ListFieldsOptions listFieldsOptions) { - this.environmentId = listFieldsOptions.environmentId; - this.collectionIds = listFieldsOptions.collectionIds; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionIds the collectionIds - */ - public Builder(String environmentId, List collectionIds) { - this.environmentId = environmentId; - this.collectionIds = collectionIds; - } - - /** - * Builds a ListFieldsOptions. - * - * @return the new ListFieldsOptions instance - */ - public ListFieldsOptions build() { - return new ListFieldsOptions(this); - } - - /** - * Adds a new element to collectionIds. - * - * @param collectionIds the new element to be added - * @return the ListFieldsOptions builder - */ - public Builder addCollectionIds(String collectionIds) { - com.ibm.cloud.sdk.core.util.Validator.notNull(collectionIds, "collectionIds cannot be null"); - if (this.collectionIds == null) { - this.collectionIds = new ArrayList(); - } - this.collectionIds.add(collectionIds); - return this; - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the ListFieldsOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionIds. Existing collectionIds will be replaced. - * - * @param collectionIds the collectionIds - * @return the ListFieldsOptions builder - */ - public Builder collectionIds(List collectionIds) { - this.collectionIds = collectionIds; - return this; - } - } - - protected ListFieldsOptions() {} - - protected ListFieldsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.collectionIds, "collectionIds cannot be null"); - environmentId = builder.environmentId; - collectionIds = builder.collectionIds; - } - - /** - * New builder. - * - * @return a ListFieldsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionIds. - * - *

A comma-separated list of collection IDs to be queried against. - * - * @return the collectionIds - */ - public List collectionIds() { - return collectionIds; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListGatewaysOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListGatewaysOptions.java deleted file mode 100644 index e8b6bb6410c..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListGatewaysOptions.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The listGateways options. */ -public class ListGatewaysOptions extends GenericModel { - - protected String environmentId; - - /** Builder. */ - public static class Builder { - private String environmentId; - - /** - * Instantiates a new Builder from an existing ListGatewaysOptions instance. - * - * @param listGatewaysOptions the instance to initialize the Builder with - */ - private Builder(ListGatewaysOptions listGatewaysOptions) { - this.environmentId = listGatewaysOptions.environmentId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - */ - public Builder(String environmentId) { - this.environmentId = environmentId; - } - - /** - * Builds a ListGatewaysOptions. - * - * @return the new ListGatewaysOptions instance - */ - public ListGatewaysOptions build() { - return new ListGatewaysOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the ListGatewaysOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - } - - protected ListGatewaysOptions() {} - - protected ListGatewaysOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - environmentId = builder.environmentId; - } - - /** - * New builder. - * - * @return a ListGatewaysOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingDataOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingDataOptions.java deleted file mode 100644 index 844df1362d2..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingDataOptions.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The listTrainingData options. */ -public class ListTrainingDataOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - - /** - * Instantiates a new Builder from an existing ListTrainingDataOptions instance. - * - * @param listTrainingDataOptions the instance to initialize the Builder with - */ - private Builder(ListTrainingDataOptions listTrainingDataOptions) { - this.environmentId = listTrainingDataOptions.environmentId; - this.collectionId = listTrainingDataOptions.collectionId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a ListTrainingDataOptions. - * - * @return the new ListTrainingDataOptions instance - */ - public ListTrainingDataOptions build() { - return new ListTrainingDataOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the ListTrainingDataOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the ListTrainingDataOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - } - - protected ListTrainingDataOptions() {} - - protected ListTrainingDataOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - } - - /** - * New builder. - * - * @return a ListTrainingDataOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingExamplesOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingExamplesOptions.java deleted file mode 100644 index 0702ed744bb..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/ListTrainingExamplesOptions.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The listTrainingExamples options. */ -public class ListTrainingExamplesOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String queryId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String queryId; - - /** - * Instantiates a new Builder from an existing ListTrainingExamplesOptions instance. - * - * @param listTrainingExamplesOptions the instance to initialize the Builder with - */ - private Builder(ListTrainingExamplesOptions listTrainingExamplesOptions) { - this.environmentId = listTrainingExamplesOptions.environmentId; - this.collectionId = listTrainingExamplesOptions.collectionId; - this.queryId = listTrainingExamplesOptions.queryId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param queryId the queryId - */ - public Builder(String environmentId, String collectionId, String queryId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.queryId = queryId; - } - - /** - * Builds a ListTrainingExamplesOptions. - * - * @return the new ListTrainingExamplesOptions instance - */ - public ListTrainingExamplesOptions build() { - return new ListTrainingExamplesOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the ListTrainingExamplesOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the ListTrainingExamplesOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the queryId. - * - * @param queryId the queryId - * @return the ListTrainingExamplesOptions builder - */ - public Builder queryId(String queryId) { - this.queryId = queryId; - return this; - } - } - - protected ListTrainingExamplesOptions() {} - - protected ListTrainingExamplesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, "queryId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - queryId = builder.queryId; - } - - /** - * New builder. - * - * @return a ListTrainingExamplesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the queryId. - * - *

The ID of the query used for training. - * - * @return the queryId - */ - public String queryId() { - return queryId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponse.java deleted file mode 100644 index e0492d69b52..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponse.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Object containing results that match the requested **logs** query. */ -public class LogQueryResponse extends GenericModel { - - @SerializedName("matching_results") - protected Long matchingResults; - - protected List results; - - protected LogQueryResponse() {} - - /** - * Gets the matchingResults. - * - *

Number of matching results. - * - * @return the matchingResults - */ - public Long getMatchingResults() { - return matchingResults; - } - - /** - * Gets the results. - * - *

Array of log query response results. - * - * @return the results - */ - public List getResults() { - return results; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResult.java deleted file mode 100644 index 337b6c2e3d1..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResult.java +++ /dev/null @@ -1,293 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Date; - -/** - * Individual result object for a **logs** query. Each object represents either a query to a - * Discovery collection or an event that is associated with a query. - */ -public class LogQueryResponseResult extends GenericModel { - - /** - * The type of log entry returned. - * - *

**query** indicates that the log represents the results of a call to the single collection - * **query** method. - * - *

**event** indicates that the log represents a call to the **events** API. - */ - public interface DocumentType { - /** query. */ - String QUERY = "query"; - /** event. */ - String EVENT = "event"; - } - - /** - * The type of event that this object respresents. Possible values are - * - *

- `query` the log of a query to a collection - * - *

- `click` the result of a call to the **events** endpoint. - */ - public interface EventType { - /** click. */ - String CLICK = "click"; - /** query. */ - String QUERY = "query"; - } - - /** - * The type of result that this **event** is associated with. Only returned with logs of type - * `event`. - */ - public interface ResultType { - /** document. */ - String DOCUMENT = "document"; - } - - @SerializedName("environment_id") - protected String environmentId; - - @SerializedName("customer_id") - protected String customerId; - - @SerializedName("document_type") - protected String documentType; - - @SerializedName("natural_language_query") - protected String naturalLanguageQuery; - - @SerializedName("document_results") - protected LogQueryResponseResultDocuments documentResults; - - @SerializedName("created_timestamp") - protected Date createdTimestamp; - - @SerializedName("client_timestamp") - protected Date clientTimestamp; - - @SerializedName("query_id") - protected String queryId; - - @SerializedName("session_token") - protected String sessionToken; - - @SerializedName("collection_id") - protected String collectionId; - - @SerializedName("display_rank") - protected Long displayRank; - - @SerializedName("document_id") - protected String documentId; - - @SerializedName("event_type") - protected String eventType; - - @SerializedName("result_type") - protected String resultType; - - protected LogQueryResponseResult() {} - - /** - * Gets the environmentId. - * - *

The environment ID that is associated with this log entry. - * - * @return the environmentId - */ - public String getEnvironmentId() { - return environmentId; - } - - /** - * Gets the customerId. - * - *

The **customer_id** label that was specified in the header of the query or event API call - * that corresponds to this log entry. - * - * @return the customerId - */ - public String getCustomerId() { - return customerId; - } - - /** - * Gets the documentType. - * - *

The type of log entry returned. - * - *

**query** indicates that the log represents the results of a call to the single collection - * **query** method. - * - *

**event** indicates that the log represents a call to the **events** API. - * - * @return the documentType - */ - public String getDocumentType() { - return documentType; - } - - /** - * Gets the naturalLanguageQuery. - * - *

The value of the **natural_language_query** query parameter that was used to create these - * results. Only returned with logs of type **query**. - * - *

**Note:** Other query parameters (such as **filter** or **deduplicate**) might have been - * used with this query, but are not recorded. - * - * @return the naturalLanguageQuery - */ - public String getNaturalLanguageQuery() { - return naturalLanguageQuery; - } - - /** - * Gets the documentResults. - * - *

Object containing result information that was returned by the query used to create this log - * entry. Only returned with logs of type `query`. - * - * @return the documentResults - */ - public LogQueryResponseResultDocuments getDocumentResults() { - return documentResults; - } - - /** - * Gets the createdTimestamp. - * - *

Date that the log result was created. Returned in `YYYY-MM-DDThh:mm:ssZ` format. - * - * @return the createdTimestamp - */ - public Date getCreatedTimestamp() { - return createdTimestamp; - } - - /** - * Gets the clientTimestamp. - * - *

Date specified by the user when recording an event. Returned in `YYYY-MM-DDThh:mm:ssZ` - * format. Only returned with logs of type **event**. - * - * @return the clientTimestamp - */ - public Date getClientTimestamp() { - return clientTimestamp; - } - - /** - * Gets the queryId. - * - *

Identifier that corresponds to the **natural_language_query** string used in the original or - * associated query. All **event** and **query** log entries that have the same original - * **natural_language_query** string also have them same **query_id**. This field can be used to - * recall all **event** and **query** log results that have the same original query (**event** - * logs do not contain the original **natural_language_query** field). - * - * @return the queryId - */ - public String getQueryId() { - return queryId; - } - - /** - * Gets the sessionToken. - * - *

Unique identifier (within a 24-hour period) that identifies a single `query` log and any - * `event` logs that were created for it. - * - *

**Note:** If the exact same query is run at the exact same time on different days, the - * **session_token** for those queries might be identical. However, the **created_timestamp** - * differs. - * - *

**Note:** Session tokens are case sensitive. To avoid matching on session tokens that are - * identical except for case, use the exact match operator (`::`) when you query for a specific - * session token. - * - * @return the sessionToken - */ - public String getSessionToken() { - return sessionToken; - } - - /** - * Gets the collectionId. - * - *

The collection ID of the document associated with this event. Only returned with logs of - * type `event`. - * - * @return the collectionId - */ - public String getCollectionId() { - return collectionId; - } - - /** - * Gets the displayRank. - * - *

The original display rank of the document associated with this event. Only returned with - * logs of type `event`. - * - * @return the displayRank - */ - public Long getDisplayRank() { - return displayRank; - } - - /** - * Gets the documentId. - * - *

The document ID of the document associated with this event. Only returned with logs of type - * `event`. - * - * @return the documentId - */ - public String getDocumentId() { - return documentId; - } - - /** - * Gets the eventType. - * - *

The type of event that this object respresents. Possible values are - * - *

- `query` the log of a query to a collection - * - *

- `click` the result of a call to the **events** endpoint. - * - * @return the eventType - */ - public String getEventType() { - return eventType; - } - - /** - * Gets the resultType. - * - *

The type of result that this **event** is associated with. Only returned with logs of type - * `event`. - * - * @return the resultType - */ - public String getResultType() { - return resultType; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocuments.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocuments.java deleted file mode 100644 index bc3c47641e7..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocuments.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** - * Object containing result information that was returned by the query used to create this log - * entry. Only returned with logs of type `query`. - */ -public class LogQueryResponseResultDocuments extends GenericModel { - - protected List results; - protected Long count; - - protected LogQueryResponseResultDocuments() {} - - /** - * Gets the results. - * - *

Array of log query response results. - * - * @return the results - */ - public List getResults() { - return results; - } - - /** - * Gets the count. - * - *

The number of results returned in the query associate with this log. - * - * @return the count - */ - public Long getCount() { - return count; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocumentsResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocumentsResult.java deleted file mode 100644 index d782dece3e9..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocumentsResult.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** - * Each object in the **results** array corresponds to an individual document returned by the - * original query. - */ -public class LogQueryResponseResultDocumentsResult extends GenericModel { - - protected Long position; - - @SerializedName("document_id") - protected String documentId; - - protected Double score; - protected Double confidence; - - @SerializedName("collection_id") - protected String collectionId; - - protected LogQueryResponseResultDocumentsResult() {} - - /** - * Gets the position. - * - *

The result rank of this document. A position of `1` indicates that it was the first returned - * result. - * - * @return the position - */ - public Long getPosition() { - return position; - } - - /** - * Gets the documentId. - * - *

The **document_id** of the document that this result represents. - * - * @return the documentId - */ - public String getDocumentId() { - return documentId; - } - - /** - * Gets the score. - * - *

The raw score of this result. A higher score indicates a greater match to the query - * parameters. - * - * @return the score - */ - public Double getScore() { - return score; - } - - /** - * Gets the confidence. - * - *

The confidence score of the result's analysis. A higher score indicating greater confidence. - * - * @return the confidence - */ - public Double getConfidence() { - return confidence; - } - - /** - * Gets the collectionId. - * - *

The **collection_id** of the document represented by this result. - * - * @return the collectionId - */ - public String getCollectionId() { - return collectionId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregation.java deleted file mode 100644 index 568421866c6..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregation.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** An aggregation analyzing log information for queries and events. */ -public class MetricAggregation extends GenericModel { - - protected String interval; - - @SerializedName("event_type") - protected String eventType; - - protected List results; - - protected MetricAggregation() {} - - /** - * Gets the interval. - * - *

The measurement interval for this metric. Metric intervals are always 1 day (`1d`). - * - * @return the interval - */ - public String getInterval() { - return interval; - } - - /** - * Gets the eventType. - * - *

The event type associated with this metric result. This field, when present, will always be - * `click`. - * - * @return the eventType - */ - public String getEventType() { - return eventType; - } - - /** - * Gets the results. - * - *

Array of metric aggregation query results. - * - * @return the results - */ - public List getResults() { - return results; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregationResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregationResult.java deleted file mode 100644 index 639cb1b5615..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricAggregationResult.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Date; - -/** Aggregation result data for the requested metric. */ -public class MetricAggregationResult extends GenericModel { - - @SerializedName("key_as_string") - protected Date keyAsString; - - protected Long key; - - @SerializedName("matching_results") - protected Long matchingResults; - - @SerializedName("event_rate") - protected Double eventRate; - - protected MetricAggregationResult() {} - - /** - * Gets the keyAsString. - * - *

Date in string form representing the start of this interval. - * - * @return the keyAsString - */ - public Date getKeyAsString() { - return keyAsString; - } - - /** - * Gets the key. - * - *

Unix epoch time equivalent of the **key_as_string**, that represents the start of this - * interval. - * - * @return the key - */ - public Long getKey() { - return key; - } - - /** - * Gets the matchingResults. - * - *

Number of matching results. - * - * @return the matchingResults - */ - public Long getMatchingResults() { - return matchingResults; - } - - /** - * Gets the eventRate. - * - *

The number of queries with associated events divided by the total number of queries for the - * interval. Only returned with **event_rate** metrics. - * - * @return the eventRate - */ - public Double getEventRate() { - return eventRate; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricResponse.java deleted file mode 100644 index 0d0eb48ec78..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** The response generated from a call to a **metrics** method. */ -public class MetricResponse extends GenericModel { - - protected List aggregations; - - protected MetricResponse() {} - - /** - * Gets the aggregations. - * - *

Array of metric aggregations. - * - * @return the aggregations - */ - public List getAggregations() { - return aggregations; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregation.java deleted file mode 100644 index 021dcfdce46..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregation.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** An aggregation analyzing log information for queries and events. */ -public class MetricTokenAggregation extends GenericModel { - - @SerializedName("event_type") - protected String eventType; - - protected List results; - - protected MetricTokenAggregation() {} - - /** - * Gets the eventType. - * - *

The event type associated with this metric result. This field, when present, will always be - * `click`. - * - * @return the eventType - */ - public String getEventType() { - return eventType; - } - - /** - * Gets the results. - * - *

Array of results for the metric token aggregation. - * - * @return the results - */ - public List getResults() { - return results; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregationResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregationResult.java deleted file mode 100644 index 7cba0d068d3..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregationResult.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Aggregation result data for the requested metric. */ -public class MetricTokenAggregationResult extends GenericModel { - - protected String key; - - @SerializedName("matching_results") - protected Long matchingResults; - - @SerializedName("event_rate") - protected Double eventRate; - - protected MetricTokenAggregationResult() {} - - /** - * Gets the key. - * - *

The content of the **natural_language_query** parameter used in the query that this result - * represents. - * - * @return the key - */ - public String getKey() { - return key; - } - - /** - * Gets the matchingResults. - * - *

Number of matching results. - * - * @return the matchingResults - */ - public Long getMatchingResults() { - return matchingResults; - } - - /** - * Gets the eventRate. - * - *

The number of queries with associated events divided by the total number of queries - * currently stored (queries and events are stored in the log for 30 days). - * - * @return the eventRate - */ - public Double getEventRate() { - return eventRate; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenResponse.java deleted file mode 100644 index b9423753c93..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/MetricTokenResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** The response generated from a call to a **metrics** method that evaluates tokens. */ -public class MetricTokenResponse extends GenericModel { - - protected List aggregations; - - protected MetricTokenResponse() {} - - /** - * Gets the aggregations. - * - *

Array of metric token aggregations. - * - * @return the aggregations - */ - public List getAggregations() { - return aggregations; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentConcepts.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentConcepts.java deleted file mode 100644 index 6a76900ed12..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentConcepts.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** An object specifiying the concepts enrichment and related parameters. */ -public class NluEnrichmentConcepts extends GenericModel { - - protected Long limit; - - /** Builder. */ - public static class Builder { - private Long limit; - - /** - * Instantiates a new Builder from an existing NluEnrichmentConcepts instance. - * - * @param nluEnrichmentConcepts the instance to initialize the Builder with - */ - private Builder(NluEnrichmentConcepts nluEnrichmentConcepts) { - this.limit = nluEnrichmentConcepts.limit; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a NluEnrichmentConcepts. - * - * @return the new NluEnrichmentConcepts instance - */ - public NluEnrichmentConcepts build() { - return new NluEnrichmentConcepts(this); - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the NluEnrichmentConcepts builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - } - - protected NluEnrichmentConcepts() {} - - protected NluEnrichmentConcepts(Builder builder) { - limit = builder.limit; - } - - /** - * New builder. - * - * @return a NluEnrichmentConcepts builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the limit. - * - *

The maximum number of concepts enrichments to extact from each instance of the specified - * field. - * - * @return the limit - */ - public Long limit() { - return limit; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEmotion.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEmotion.java deleted file mode 100644 index a51642975c4..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEmotion.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** An object specifying the emotion detection enrichment and related parameters. */ -public class NluEnrichmentEmotion extends GenericModel { - - protected Boolean document; - protected List targets; - - /** Builder. */ - public static class Builder { - private Boolean document; - private List targets; - - /** - * Instantiates a new Builder from an existing NluEnrichmentEmotion instance. - * - * @param nluEnrichmentEmotion the instance to initialize the Builder with - */ - private Builder(NluEnrichmentEmotion nluEnrichmentEmotion) { - this.document = nluEnrichmentEmotion.document; - this.targets = nluEnrichmentEmotion.targets; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a NluEnrichmentEmotion. - * - * @return the new NluEnrichmentEmotion instance - */ - public NluEnrichmentEmotion build() { - return new NluEnrichmentEmotion(this); - } - - /** - * Adds a new element to targets. - * - * @param target the new element to be added - * @return the NluEnrichmentEmotion builder - */ - public Builder addTarget(String target) { - com.ibm.cloud.sdk.core.util.Validator.notNull(target, "target cannot be null"); - if (this.targets == null) { - this.targets = new ArrayList(); - } - this.targets.add(target); - return this; - } - - /** - * Set the document. - * - * @param document the document - * @return the NluEnrichmentEmotion builder - */ - public Builder document(Boolean document) { - this.document = document; - return this; - } - - /** - * Set the targets. Existing targets will be replaced. - * - * @param targets the targets - * @return the NluEnrichmentEmotion builder - */ - public Builder targets(List targets) { - this.targets = targets; - return this; - } - } - - protected NluEnrichmentEmotion() {} - - protected NluEnrichmentEmotion(Builder builder) { - document = builder.document; - targets = builder.targets; - } - - /** - * New builder. - * - * @return a NluEnrichmentEmotion builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the document. - * - *

When `true`, emotion detection is performed on the entire field. - * - * @return the document - */ - public Boolean document() { - return document; - } - - /** - * Gets the targets. - * - *

A comma-separated list of target strings that will have any associated emotions detected. - * - * @return the targets - */ - public List targets() { - return targets; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEntities.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEntities.java deleted file mode 100644 index 6cdbde468a9..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEntities.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** An object speficying the Entities enrichment and related parameters. */ -public class NluEnrichmentEntities extends GenericModel { - - protected Boolean sentiment; - protected Boolean emotion; - protected Long limit; - protected Boolean mentions; - - @SerializedName("mention_types") - protected Boolean mentionTypes; - - @SerializedName("sentence_locations") - protected Boolean sentenceLocations; - - protected String model; - - /** Builder. */ - public static class Builder { - private Boolean sentiment; - private Boolean emotion; - private Long limit; - private Boolean mentions; - private Boolean mentionTypes; - private Boolean sentenceLocations; - private String model; - - /** - * Instantiates a new Builder from an existing NluEnrichmentEntities instance. - * - * @param nluEnrichmentEntities the instance to initialize the Builder with - */ - private Builder(NluEnrichmentEntities nluEnrichmentEntities) { - this.sentiment = nluEnrichmentEntities.sentiment; - this.emotion = nluEnrichmentEntities.emotion; - this.limit = nluEnrichmentEntities.limit; - this.mentions = nluEnrichmentEntities.mentions; - this.mentionTypes = nluEnrichmentEntities.mentionTypes; - this.sentenceLocations = nluEnrichmentEntities.sentenceLocations; - this.model = nluEnrichmentEntities.model; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a NluEnrichmentEntities. - * - * @return the new NluEnrichmentEntities instance - */ - public NluEnrichmentEntities build() { - return new NluEnrichmentEntities(this); - } - - /** - * Set the sentiment. - * - * @param sentiment the sentiment - * @return the NluEnrichmentEntities builder - */ - public Builder sentiment(Boolean sentiment) { - this.sentiment = sentiment; - return this; - } - - /** - * Set the emotion. - * - * @param emotion the emotion - * @return the NluEnrichmentEntities builder - */ - public Builder emotion(Boolean emotion) { - this.emotion = emotion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the NluEnrichmentEntities builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - - /** - * Set the mentions. - * - * @param mentions the mentions - * @return the NluEnrichmentEntities builder - */ - public Builder mentions(Boolean mentions) { - this.mentions = mentions; - return this; - } - - /** - * Set the mentionTypes. - * - * @param mentionTypes the mentionTypes - * @return the NluEnrichmentEntities builder - */ - public Builder mentionTypes(Boolean mentionTypes) { - this.mentionTypes = mentionTypes; - return this; - } - - /** - * Set the sentenceLocations. - * - * @param sentenceLocations the sentenceLocations - * @return the NluEnrichmentEntities builder - */ - public Builder sentenceLocations(Boolean sentenceLocations) { - this.sentenceLocations = sentenceLocations; - return this; - } - - /** - * Set the model. - * - * @param model the model - * @return the NluEnrichmentEntities builder - */ - public Builder model(String model) { - this.model = model; - return this; - } - } - - protected NluEnrichmentEntities() {} - - protected NluEnrichmentEntities(Builder builder) { - sentiment = builder.sentiment; - emotion = builder.emotion; - limit = builder.limit; - mentions = builder.mentions; - mentionTypes = builder.mentionTypes; - sentenceLocations = builder.sentenceLocations; - model = builder.model; - } - - /** - * New builder. - * - * @return a NluEnrichmentEntities builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the sentiment. - * - *

When `true`, sentiment analysis of entities will be performed on the specified field. - * - * @return the sentiment - */ - public Boolean sentiment() { - return sentiment; - } - - /** - * Gets the emotion. - * - *

When `true`, emotion detection of entities will be performed on the specified field. - * - * @return the emotion - */ - public Boolean emotion() { - return emotion; - } - - /** - * Gets the limit. - * - *

The maximum number of entities to extract for each instance of the specified field. - * - * @return the limit - */ - public Long limit() { - return limit; - } - - /** - * Gets the mentions. - * - *

When `true`, the number of mentions of each identified entity is recorded. The default is - * `false`. - * - * @return the mentions - */ - public Boolean mentions() { - return mentions; - } - - /** - * Gets the mentionTypes. - * - *

When `true`, the types of mentions for each idetifieid entity is recorded. The default is - * `false`. - * - * @return the mentionTypes - */ - public Boolean mentionTypes() { - return mentionTypes; - } - - /** - * Gets the sentenceLocations. - * - *

When `true`, a list of sentence locations for each instance of each identified entity is - * recorded. The default is `false`. - * - * @return the sentenceLocations - */ - public Boolean sentenceLocations() { - return sentenceLocations; - } - - /** - * Gets the model. - * - *

The enrichement model to use with entity extraction. May be a custom model provided by - * Watson Knowledge Studio, or the default public model `alchemy`. - * - * @return the model - */ - public String model() { - return model; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentFeatures.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentFeatures.java deleted file mode 100644 index 297886ad061..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentFeatures.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Map; - -/** Object containing Natural Language Understanding features to be used. */ -public class NluEnrichmentFeatures extends GenericModel { - - protected NluEnrichmentKeywords keywords; - protected NluEnrichmentEntities entities; - protected NluEnrichmentSentiment sentiment; - protected NluEnrichmentEmotion emotion; - protected Map categories; - - @SerializedName("semantic_roles") - protected NluEnrichmentSemanticRoles semanticRoles; - - protected NluEnrichmentRelations relations; - protected NluEnrichmentConcepts concepts; - - /** Builder. */ - public static class Builder { - private NluEnrichmentKeywords keywords; - private NluEnrichmentEntities entities; - private NluEnrichmentSentiment sentiment; - private NluEnrichmentEmotion emotion; - private Map categories; - private NluEnrichmentSemanticRoles semanticRoles; - private NluEnrichmentRelations relations; - private NluEnrichmentConcepts concepts; - - /** - * Instantiates a new Builder from an existing NluEnrichmentFeatures instance. - * - * @param nluEnrichmentFeatures the instance to initialize the Builder with - */ - private Builder(NluEnrichmentFeatures nluEnrichmentFeatures) { - this.keywords = nluEnrichmentFeatures.keywords; - this.entities = nluEnrichmentFeatures.entities; - this.sentiment = nluEnrichmentFeatures.sentiment; - this.emotion = nluEnrichmentFeatures.emotion; - this.categories = nluEnrichmentFeatures.categories; - this.semanticRoles = nluEnrichmentFeatures.semanticRoles; - this.relations = nluEnrichmentFeatures.relations; - this.concepts = nluEnrichmentFeatures.concepts; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a NluEnrichmentFeatures. - * - * @return the new NluEnrichmentFeatures instance - */ - public NluEnrichmentFeatures build() { - return new NluEnrichmentFeatures(this); - } - - /** - * Set the keywords. - * - * @param keywords the keywords - * @return the NluEnrichmentFeatures builder - */ - public Builder keywords(NluEnrichmentKeywords keywords) { - this.keywords = keywords; - return this; - } - - /** - * Set the entities. - * - * @param entities the entities - * @return the NluEnrichmentFeatures builder - */ - public Builder entities(NluEnrichmentEntities entities) { - this.entities = entities; - return this; - } - - /** - * Set the sentiment. - * - * @param sentiment the sentiment - * @return the NluEnrichmentFeatures builder - */ - public Builder sentiment(NluEnrichmentSentiment sentiment) { - this.sentiment = sentiment; - return this; - } - - /** - * Set the emotion. - * - * @param emotion the emotion - * @return the NluEnrichmentFeatures builder - */ - public Builder emotion(NluEnrichmentEmotion emotion) { - this.emotion = emotion; - return this; - } - - /** - * Set the categories. - * - * @param categories the categories - * @return the NluEnrichmentFeatures builder - */ - public Builder categories(Map categories) { - this.categories = categories; - return this; - } - - /** - * Set the semanticRoles. - * - * @param semanticRoles the semanticRoles - * @return the NluEnrichmentFeatures builder - */ - public Builder semanticRoles(NluEnrichmentSemanticRoles semanticRoles) { - this.semanticRoles = semanticRoles; - return this; - } - - /** - * Set the relations. - * - * @param relations the relations - * @return the NluEnrichmentFeatures builder - */ - public Builder relations(NluEnrichmentRelations relations) { - this.relations = relations; - return this; - } - - /** - * Set the concepts. - * - * @param concepts the concepts - * @return the NluEnrichmentFeatures builder - */ - public Builder concepts(NluEnrichmentConcepts concepts) { - this.concepts = concepts; - return this; - } - } - - protected NluEnrichmentFeatures() {} - - protected NluEnrichmentFeatures(Builder builder) { - keywords = builder.keywords; - entities = builder.entities; - sentiment = builder.sentiment; - emotion = builder.emotion; - categories = builder.categories; - semanticRoles = builder.semanticRoles; - relations = builder.relations; - concepts = builder.concepts; - } - - /** - * New builder. - * - * @return a NluEnrichmentFeatures builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the keywords. - * - *

An object specifying the Keyword enrichment and related parameters. - * - * @return the keywords - */ - public NluEnrichmentKeywords keywords() { - return keywords; - } - - /** - * Gets the entities. - * - *

An object speficying the Entities enrichment and related parameters. - * - * @return the entities - */ - public NluEnrichmentEntities entities() { - return entities; - } - - /** - * Gets the sentiment. - * - *

An object specifying the sentiment extraction enrichment and related parameters. - * - * @return the sentiment - */ - public NluEnrichmentSentiment sentiment() { - return sentiment; - } - - /** - * Gets the emotion. - * - *

An object specifying the emotion detection enrichment and related parameters. - * - * @return the emotion - */ - public NluEnrichmentEmotion emotion() { - return emotion; - } - - /** - * Gets the categories. - * - *

An object that indicates the Categories enrichment will be applied to the specified field. - * - * @return the categories - */ - public Map categories() { - return categories; - } - - /** - * Gets the semanticRoles. - * - *

An object specifiying the semantic roles enrichment and related parameters. - * - * @return the semanticRoles - */ - public NluEnrichmentSemanticRoles semanticRoles() { - return semanticRoles; - } - - /** - * Gets the relations. - * - *

An object specifying the relations enrichment and related parameters. - * - * @return the relations - */ - public NluEnrichmentRelations relations() { - return relations; - } - - /** - * Gets the concepts. - * - *

An object specifiying the concepts enrichment and related parameters. - * - * @return the concepts - */ - public NluEnrichmentConcepts concepts() { - return concepts; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentKeywords.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentKeywords.java deleted file mode 100644 index 4eea6c35691..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentKeywords.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** An object specifying the Keyword enrichment and related parameters. */ -public class NluEnrichmentKeywords extends GenericModel { - - protected Boolean sentiment; - protected Boolean emotion; - protected Long limit; - - /** Builder. */ - public static class Builder { - private Boolean sentiment; - private Boolean emotion; - private Long limit; - - /** - * Instantiates a new Builder from an existing NluEnrichmentKeywords instance. - * - * @param nluEnrichmentKeywords the instance to initialize the Builder with - */ - private Builder(NluEnrichmentKeywords nluEnrichmentKeywords) { - this.sentiment = nluEnrichmentKeywords.sentiment; - this.emotion = nluEnrichmentKeywords.emotion; - this.limit = nluEnrichmentKeywords.limit; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a NluEnrichmentKeywords. - * - * @return the new NluEnrichmentKeywords instance - */ - public NluEnrichmentKeywords build() { - return new NluEnrichmentKeywords(this); - } - - /** - * Set the sentiment. - * - * @param sentiment the sentiment - * @return the NluEnrichmentKeywords builder - */ - public Builder sentiment(Boolean sentiment) { - this.sentiment = sentiment; - return this; - } - - /** - * Set the emotion. - * - * @param emotion the emotion - * @return the NluEnrichmentKeywords builder - */ - public Builder emotion(Boolean emotion) { - this.emotion = emotion; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the NluEnrichmentKeywords builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - } - - protected NluEnrichmentKeywords() {} - - protected NluEnrichmentKeywords(Builder builder) { - sentiment = builder.sentiment; - emotion = builder.emotion; - limit = builder.limit; - } - - /** - * New builder. - * - * @return a NluEnrichmentKeywords builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the sentiment. - * - *

When `true`, sentiment analysis of keywords will be performed on the specified field. - * - * @return the sentiment - */ - public Boolean sentiment() { - return sentiment; - } - - /** - * Gets the emotion. - * - *

When `true`, emotion detection of keywords will be performed on the specified field. - * - * @return the emotion - */ - public Boolean emotion() { - return emotion; - } - - /** - * Gets the limit. - * - *

The maximum number of keywords to extract for each instance of the specified field. - * - * @return the limit - */ - public Long limit() { - return limit; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentRelations.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentRelations.java deleted file mode 100644 index 42c9b9aac3d..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentRelations.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** An object specifying the relations enrichment and related parameters. */ -public class NluEnrichmentRelations extends GenericModel { - - protected String model; - - /** Builder. */ - public static class Builder { - private String model; - - /** - * Instantiates a new Builder from an existing NluEnrichmentRelations instance. - * - * @param nluEnrichmentRelations the instance to initialize the Builder with - */ - private Builder(NluEnrichmentRelations nluEnrichmentRelations) { - this.model = nluEnrichmentRelations.model; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a NluEnrichmentRelations. - * - * @return the new NluEnrichmentRelations instance - */ - public NluEnrichmentRelations build() { - return new NluEnrichmentRelations(this); - } - - /** - * Set the model. - * - * @param model the model - * @return the NluEnrichmentRelations builder - */ - public Builder model(String model) { - this.model = model; - return this; - } - } - - protected NluEnrichmentRelations() {} - - protected NluEnrichmentRelations(Builder builder) { - model = builder.model; - } - - /** - * New builder. - * - * @return a NluEnrichmentRelations builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the model. - * - *

*For use with `natural_language_understanding` enrichments only.* The enrichement model to - * use with relationship extraction. May be a custom model provided by Watson Knowledge Studio, - * the default public model is`en-news`. - * - * @return the model - */ - public String model() { - return model; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSemanticRoles.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSemanticRoles.java deleted file mode 100644 index 76273e5f668..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSemanticRoles.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** An object specifiying the semantic roles enrichment and related parameters. */ -public class NluEnrichmentSemanticRoles extends GenericModel { - - protected Boolean entities; - protected Boolean keywords; - protected Long limit; - - /** Builder. */ - public static class Builder { - private Boolean entities; - private Boolean keywords; - private Long limit; - - /** - * Instantiates a new Builder from an existing NluEnrichmentSemanticRoles instance. - * - * @param nluEnrichmentSemanticRoles the instance to initialize the Builder with - */ - private Builder(NluEnrichmentSemanticRoles nluEnrichmentSemanticRoles) { - this.entities = nluEnrichmentSemanticRoles.entities; - this.keywords = nluEnrichmentSemanticRoles.keywords; - this.limit = nluEnrichmentSemanticRoles.limit; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a NluEnrichmentSemanticRoles. - * - * @return the new NluEnrichmentSemanticRoles instance - */ - public NluEnrichmentSemanticRoles build() { - return new NluEnrichmentSemanticRoles(this); - } - - /** - * Set the entities. - * - * @param entities the entities - * @return the NluEnrichmentSemanticRoles builder - */ - public Builder entities(Boolean entities) { - this.entities = entities; - return this; - } - - /** - * Set the keywords. - * - * @param keywords the keywords - * @return the NluEnrichmentSemanticRoles builder - */ - public Builder keywords(Boolean keywords) { - this.keywords = keywords; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the NluEnrichmentSemanticRoles builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - } - - protected NluEnrichmentSemanticRoles() {} - - protected NluEnrichmentSemanticRoles(Builder builder) { - entities = builder.entities; - keywords = builder.keywords; - limit = builder.limit; - } - - /** - * New builder. - * - * @return a NluEnrichmentSemanticRoles builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the entities. - * - *

When `true`, entities are extracted from the identified sentence parts. - * - * @return the entities - */ - public Boolean entities() { - return entities; - } - - /** - * Gets the keywords. - * - *

When `true`, keywords are extracted from the identified sentence parts. - * - * @return the keywords - */ - public Boolean keywords() { - return keywords; - } - - /** - * Gets the limit. - * - *

The maximum number of semantic roles enrichments to extact from each instance of the - * specified field. - * - * @return the limit - */ - public Long limit() { - return limit; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSentiment.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSentiment.java deleted file mode 100644 index a453c4f34d0..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSentiment.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** An object specifying the sentiment extraction enrichment and related parameters. */ -public class NluEnrichmentSentiment extends GenericModel { - - protected Boolean document; - protected List targets; - - /** Builder. */ - public static class Builder { - private Boolean document; - private List targets; - - /** - * Instantiates a new Builder from an existing NluEnrichmentSentiment instance. - * - * @param nluEnrichmentSentiment the instance to initialize the Builder with - */ - private Builder(NluEnrichmentSentiment nluEnrichmentSentiment) { - this.document = nluEnrichmentSentiment.document; - this.targets = nluEnrichmentSentiment.targets; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a NluEnrichmentSentiment. - * - * @return the new NluEnrichmentSentiment instance - */ - public NluEnrichmentSentiment build() { - return new NluEnrichmentSentiment(this); - } - - /** - * Adds a new element to targets. - * - * @param target the new element to be added - * @return the NluEnrichmentSentiment builder - */ - public Builder addTarget(String target) { - com.ibm.cloud.sdk.core.util.Validator.notNull(target, "target cannot be null"); - if (this.targets == null) { - this.targets = new ArrayList(); - } - this.targets.add(target); - return this; - } - - /** - * Set the document. - * - * @param document the document - * @return the NluEnrichmentSentiment builder - */ - public Builder document(Boolean document) { - this.document = document; - return this; - } - - /** - * Set the targets. Existing targets will be replaced. - * - * @param targets the targets - * @return the NluEnrichmentSentiment builder - */ - public Builder targets(List targets) { - this.targets = targets; - return this; - } - } - - protected NluEnrichmentSentiment() {} - - protected NluEnrichmentSentiment(Builder builder) { - document = builder.document; - targets = builder.targets; - } - - /** - * New builder. - * - * @return a NluEnrichmentSentiment builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the document. - * - *

When `true`, sentiment analysis is performed on the entire field. - * - * @return the document - */ - public Boolean document() { - return document; - } - - /** - * Gets the targets. - * - *

A comma-separated list of target strings that will have any associated sentiment analyzed. - * - * @return the targets - */ - public List targets() { - return targets; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NormalizationOperation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NormalizationOperation.java deleted file mode 100644 index e017b510960..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/NormalizationOperation.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object containing normalization operations. */ -public class NormalizationOperation extends GenericModel { - - /** - * Identifies what type of operation to perform. - * - *

**copy** - Copies the value of the **source_field** to the **destination_field** field. If - * the **destination_field** already exists, then the value of the **source_field** overwrites the - * original value of the **destination_field**. - * - *

**move** - Renames (moves) the **source_field** to the **destination_field**. If the - * **destination_field** already exists, then the value of the **source_field** overwrites the - * original value of the **destination_field**. Rename is identical to copy, except that the - * **source_field** is removed after the value has been copied to the **destination_field** (it is - * the same as a _copy_ followed by a _remove_). - * - *

**merge** - Merges the value of the **source_field** with the value of the - * **destination_field**. The **destination_field** is converted into an array if it is not - * already an array, and the value of the **source_field** is appended to the array. This - * operation removes the **source_field** after the merge. If the **source_field** does not exist - * in the current document, then the **destination_field** is still converted into an array (if it - * is not an array already). This conversion ensures the type for **destination_field** is - * consistent across all documents. - * - *

**remove** - Deletes the **source_field** field. The **destination_field** is ignored for - * this operation. - * - *

**remove_nulls** - Removes all nested null (blank) field values from the ingested document. - * **source_field** and **destination_field** are ignored by this operation because _remove_nulls_ - * operates on the entire ingested document. Typically, **remove_nulls** is invoked as the last - * normalization operation (if it is invoked at all, it can be time-expensive). - */ - public interface Operation { - /** copy. */ - String COPY = "copy"; - /** move. */ - String MOVE = "move"; - /** merge. */ - String MERGE = "merge"; - /** remove. */ - String REMOVE = "remove"; - /** remove_nulls. */ - String REMOVE_NULLS = "remove_nulls"; - } - - protected String operation; - - @SerializedName("source_field") - protected String sourceField; - - @SerializedName("destination_field") - protected String destinationField; - - /** Builder. */ - public static class Builder { - private String operation; - private String sourceField; - private String destinationField; - - /** - * Instantiates a new Builder from an existing NormalizationOperation instance. - * - * @param normalizationOperation the instance to initialize the Builder with - */ - private Builder(NormalizationOperation normalizationOperation) { - this.operation = normalizationOperation.operation; - this.sourceField = normalizationOperation.sourceField; - this.destinationField = normalizationOperation.destinationField; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a NormalizationOperation. - * - * @return the new NormalizationOperation instance - */ - public NormalizationOperation build() { - return new NormalizationOperation(this); - } - - /** - * Set the operation. - * - * @param operation the operation - * @return the NormalizationOperation builder - */ - public Builder operation(String operation) { - this.operation = operation; - return this; - } - - /** - * Set the sourceField. - * - * @param sourceField the sourceField - * @return the NormalizationOperation builder - */ - public Builder sourceField(String sourceField) { - this.sourceField = sourceField; - return this; - } - - /** - * Set the destinationField. - * - * @param destinationField the destinationField - * @return the NormalizationOperation builder - */ - public Builder destinationField(String destinationField) { - this.destinationField = destinationField; - return this; - } - } - - protected NormalizationOperation() {} - - protected NormalizationOperation(Builder builder) { - operation = builder.operation; - sourceField = builder.sourceField; - destinationField = builder.destinationField; - } - - /** - * New builder. - * - * @return a NormalizationOperation builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the operation. - * - *

Identifies what type of operation to perform. - * - *

**copy** - Copies the value of the **source_field** to the **destination_field** field. If - * the **destination_field** already exists, then the value of the **source_field** overwrites the - * original value of the **destination_field**. - * - *

**move** - Renames (moves) the **source_field** to the **destination_field**. If the - * **destination_field** already exists, then the value of the **source_field** overwrites the - * original value of the **destination_field**. Rename is identical to copy, except that the - * **source_field** is removed after the value has been copied to the **destination_field** (it is - * the same as a _copy_ followed by a _remove_). - * - *

**merge** - Merges the value of the **source_field** with the value of the - * **destination_field**. The **destination_field** is converted into an array if it is not - * already an array, and the value of the **source_field** is appended to the array. This - * operation removes the **source_field** after the merge. If the **source_field** does not exist - * in the current document, then the **destination_field** is still converted into an array (if it - * is not an array already). This conversion ensures the type for **destination_field** is - * consistent across all documents. - * - *

**remove** - Deletes the **source_field** field. The **destination_field** is ignored for - * this operation. - * - *

**remove_nulls** - Removes all nested null (blank) field values from the ingested document. - * **source_field** and **destination_field** are ignored by this operation because _remove_nulls_ - * operates on the entire ingested document. Typically, **remove_nulls** is invoked as the last - * normalization operation (if it is invoked at all, it can be time-expensive). - * - * @return the operation - */ - public String operation() { - return operation; - } - - /** - * Gets the sourceField. - * - *

The source field for the operation. - * - * @return the sourceField - */ - public String sourceField() { - return sourceField; - } - - /** - * Gets the destinationField. - * - *

The destination field for the operation. - * - * @return the destinationField - */ - public String destinationField() { - return destinationField; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Notice.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Notice.java deleted file mode 100644 index 149e2d42fde..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Notice.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Date; - -/** A notice produced for the collection. */ -public class Notice extends GenericModel { - - /** Severity level of the notice. */ - public interface Severity { - /** warning. */ - String WARNING = "warning"; - /** error. */ - String ERROR = "error"; - } - - @SerializedName("notice_id") - protected String noticeId; - - protected Date created; - - @SerializedName("document_id") - protected String documentId; - - @SerializedName("query_id") - protected String queryId; - - protected String severity; - protected String step; - protected String description; - - protected Notice() {} - - /** - * Gets the noticeId. - * - *

Identifies the notice. Many notices might have the same ID. This field exists so that user - * applications can programmatically identify a notice and take automatic corrective action. - * Typical notice IDs include: `index_failed`, `index_failed_too_many_requests`, - * `index_failed_incompatible_field`, `index_failed_cluster_unavailable`, `ingestion_timeout`, - * `ingestion_error`, `bad_request`, `internal_error`, `missing_model`, `unsupported_model`, - * `smart_document_understanding_failed_incompatible_field`, - * `smart_document_understanding_failed_internal_error`, - * `smart_document_understanding_failed_internal_error`, - * `smart_document_understanding_failed_warning`, `smart_document_understanding_page_error`, - * `smart_document_understanding_page_warning`. **Note:** This is not a complete list; other - * values might be returned. - * - * @return the noticeId - */ - public String getNoticeId() { - return noticeId; - } - - /** - * Gets the created. - * - *

The creation date of the collection in the format yyyy-MM-dd'T'HH:mm:ss.SSS'Z'. - * - * @return the created - */ - public Date getCreated() { - return created; - } - - /** - * Gets the documentId. - * - *

Unique identifier of the document. - * - * @return the documentId - */ - public String getDocumentId() { - return documentId; - } - - /** - * Gets the queryId. - * - *

Unique identifier of the query used for relevance training. - * - * @return the queryId - */ - public String getQueryId() { - return queryId; - } - - /** - * Gets the severity. - * - *

Severity level of the notice. - * - * @return the severity - */ - public String getSeverity() { - return severity; - } - - /** - * Gets the step. - * - *

Ingestion or training step in which the notice occurred. Typical step values include: - * `smartDocumentUnderstanding`, `ingestion`, `indexing`, `convert`. **Note:** This is not a - * complete list; other values might be returned. - * - * @return the step - */ - public String getStep() { - return step; - } - - /** - * Gets the description. - * - *

The description of the notice. - * - * @return the description - */ - public String getDescription() { - return description; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfHeadingDetection.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfHeadingDetection.java deleted file mode 100644 index 5719d4d4d91..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfHeadingDetection.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** Object containing heading detection conversion settings for PDF documents. */ -public class PdfHeadingDetection extends GenericModel { - - protected List fonts; - - /** Builder. */ - public static class Builder { - private List fonts; - - /** - * Instantiates a new Builder from an existing PdfHeadingDetection instance. - * - * @param pdfHeadingDetection the instance to initialize the Builder with - */ - private Builder(PdfHeadingDetection pdfHeadingDetection) { - this.fonts = pdfHeadingDetection.fonts; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a PdfHeadingDetection. - * - * @return the new PdfHeadingDetection instance - */ - public PdfHeadingDetection build() { - return new PdfHeadingDetection(this); - } - - /** - * Adds a new element to fonts. - * - * @param fontSetting the new element to be added - * @return the PdfHeadingDetection builder - */ - public Builder addFontSetting(FontSetting fontSetting) { - com.ibm.cloud.sdk.core.util.Validator.notNull(fontSetting, "fontSetting cannot be null"); - if (this.fonts == null) { - this.fonts = new ArrayList(); - } - this.fonts.add(fontSetting); - return this; - } - - /** - * Set the fonts. Existing fonts will be replaced. - * - * @param fonts the fonts - * @return the PdfHeadingDetection builder - */ - public Builder fonts(List fonts) { - this.fonts = fonts; - return this; - } - } - - protected PdfHeadingDetection() {} - - protected PdfHeadingDetection(Builder builder) { - fonts = builder.fonts; - } - - /** - * New builder. - * - * @return a PdfHeadingDetection builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the fonts. - * - *

Array of font matching configurations. - * - * @return the fonts - */ - public List fonts() { - return fonts; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfSettings.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfSettings.java deleted file mode 100644 index 16e3f0d5ebb..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/PdfSettings.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** A list of PDF conversion settings. */ -public class PdfSettings extends GenericModel { - - protected PdfHeadingDetection heading; - - /** Builder. */ - public static class Builder { - private PdfHeadingDetection heading; - - /** - * Instantiates a new Builder from an existing PdfSettings instance. - * - * @param pdfSettings the instance to initialize the Builder with - */ - private Builder(PdfSettings pdfSettings) { - this.heading = pdfSettings.heading; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a PdfSettings. - * - * @return the new PdfSettings instance - */ - public PdfSettings build() { - return new PdfSettings(this); - } - - /** - * Set the heading. - * - * @param heading the heading - * @return the PdfSettings builder - */ - public Builder heading(PdfHeadingDetection heading) { - this.heading = heading; - return this; - } - } - - protected PdfSettings() {} - - protected PdfSettings(Builder builder) { - heading = builder.heading; - } - - /** - * New builder. - * - * @return a PdfSettings builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the heading. - * - *

Object containing heading detection conversion settings for PDF documents. - * - * @return the heading - */ - public PdfHeadingDetection heading() { - return heading; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryAggregation.java deleted file mode 100644 index 798399c5334..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryAggregation.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** An aggregation produced by Discovery to analyze the input provided. */ -public class QueryAggregation extends GenericModel { - @SuppressWarnings("unused") - protected static String discriminatorPropertyName = "type"; - - protected static java.util.Map> discriminatorMapping; - - static { - discriminatorMapping = new java.util.HashMap<>(); - discriminatorMapping.put("histogram", QueryHistogramAggregation.class); - discriminatorMapping.put("max", QueryCalculationAggregation.class); - discriminatorMapping.put("min", QueryCalculationAggregation.class); - discriminatorMapping.put("average", QueryCalculationAggregation.class); - discriminatorMapping.put("sum", QueryCalculationAggregation.class); - discriminatorMapping.put("unique_count", QueryCalculationAggregation.class); - discriminatorMapping.put("term", QueryTermAggregation.class); - discriminatorMapping.put("filter", QueryFilterAggregation.class); - discriminatorMapping.put("nested", QueryNestedAggregation.class); - discriminatorMapping.put("timeslice", QueryTimesliceAggregation.class); - discriminatorMapping.put("top_hits", QueryTopHitsAggregation.class); - } - - protected String type; - - protected QueryAggregation() {} - - /** - * Gets the type. - * - *

The type of aggregation command used. For example: term, filter, max, min, etc. - * - * @return the type - */ - public String getType() { - return type; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryCalculationAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryCalculationAggregation.java deleted file mode 100644 index ed529094620..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryCalculationAggregation.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -/** - * Returns a scalar calculation across all documents for the field specified. Possible calculations - * include min, max, sum, average, and unique_count. - */ -public class QueryCalculationAggregation extends QueryAggregation { - - protected String field; - protected Double value; - - protected QueryCalculationAggregation() {} - - /** - * Gets the field. - * - *

The field to perform the calculation on. - * - * @return the field - */ - public String getField() { - return field; - } - - /** - * Gets the value. - * - *

The value of the calculation. - * - * @return the value - */ - public Double getValue() { - return value; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryFilterAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryFilterAggregation.java deleted file mode 100644 index 3d1c5e45b80..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryFilterAggregation.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import java.util.List; - -/** A modifier that narrows the document set of the sub-aggregations it precedes. */ -public class QueryFilterAggregation extends QueryAggregation { - - protected String match; - - @SerializedName("matching_results") - protected Long matchingResults; - - protected List aggregations; - - protected QueryFilterAggregation() {} - - /** - * Gets the match. - * - *

The filter that is written in Discovery Query Language syntax and is applied to the - * documents before sub-aggregations are run. - * - * @return the match - */ - public String getMatch() { - return match; - } - - /** - * Gets the matchingResults. - * - *

Number of documents that match the filter. - * - * @return the matchingResults - */ - public Long getMatchingResults() { - return matchingResults; - } - - /** - * Gets the aggregations. - * - *

An array of sub-aggregations. - * - * @return the aggregations - */ - public List getAggregations() { - return aggregations; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryHistogramAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryHistogramAggregation.java deleted file mode 100644 index 2b7aedb6f40..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryHistogramAggregation.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import java.util.List; - -/** - * Numeric interval segments to categorize documents by using field values from a single numeric - * field to describe the category. - */ -public class QueryHistogramAggregation extends QueryAggregation { - - protected String field; - protected Long interval; - protected String name; - protected List results; - - protected QueryHistogramAggregation() {} - - /** - * Gets the field. - * - *

The numeric field name used to create the histogram. - * - * @return the field - */ - public String getField() { - return field; - } - - /** - * Gets the interval. - * - *

The size of the sections that the results are split into. - * - * @return the interval - */ - public Long getInterval() { - return interval; - } - - /** - * Gets the name. - * - *

Identifier specified in the query request of this aggregation. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the results. - * - *

Array of numeric intervals. - * - * @return the results - */ - public List getResults() { - return results; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryHistogramAggregationResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryHistogramAggregationResult.java deleted file mode 100644 index 8c0162e93d8..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryHistogramAggregationResult.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Histogram numeric interval result. */ -public class QueryHistogramAggregationResult extends GenericModel { - - protected Long key; - - @SerializedName("matching_results") - protected Long matchingResults; - - protected List aggregations; - - protected QueryHistogramAggregationResult() {} - - /** - * Gets the key. - * - *

The value of the upper bound for the numeric segment. - * - * @return the key - */ - public Long getKey() { - return key; - } - - /** - * Gets the matchingResults. - * - *

Number of documents with the specified key as the upper bound. - * - * @return the matchingResults - */ - public Long getMatchingResults() { - return matchingResults; - } - - /** - * Gets the aggregations. - * - *

An array of sub-aggregations. - * - * @return the aggregations - */ - public List getAggregations() { - return aggregations; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryLogOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryLogOptions.java deleted file mode 100644 index 7bef1b17fa2..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryLogOptions.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** The queryLog options. */ -public class QueryLogOptions extends GenericModel { - - protected String filter; - protected String query; - protected Long count; - protected Long offset; - protected List sort; - - /** Builder. */ - public static class Builder { - private String filter; - private String query; - private Long count; - private Long offset; - private List sort; - - /** - * Instantiates a new Builder from an existing QueryLogOptions instance. - * - * @param queryLogOptions the instance to initialize the Builder with - */ - private Builder(QueryLogOptions queryLogOptions) { - this.filter = queryLogOptions.filter; - this.query = queryLogOptions.query; - this.count = queryLogOptions.count; - this.offset = queryLogOptions.offset; - this.sort = queryLogOptions.sort; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a QueryLogOptions. - * - * @return the new QueryLogOptions instance - */ - public QueryLogOptions build() { - return new QueryLogOptions(this); - } - - /** - * Adds a new element to sort. - * - * @param sort the new element to be added - * @return the QueryLogOptions builder - */ - public Builder addSort(String sort) { - com.ibm.cloud.sdk.core.util.Validator.notNull(sort, "sort cannot be null"); - if (this.sort == null) { - this.sort = new ArrayList(); - } - this.sort.add(sort); - return this; - } - - /** - * Set the filter. - * - * @param filter the filter - * @return the QueryLogOptions builder - */ - public Builder filter(String filter) { - this.filter = filter; - return this; - } - - /** - * Set the query. - * - * @param query the query - * @return the QueryLogOptions builder - */ - public Builder query(String query) { - this.query = query; - return this; - } - - /** - * Set the count. - * - * @param count the count - * @return the QueryLogOptions builder - */ - public Builder count(long count) { - this.count = count; - return this; - } - - /** - * Set the offset. - * - * @param offset the offset - * @return the QueryLogOptions builder - */ - public Builder offset(long offset) { - this.offset = offset; - return this; - } - - /** - * Set the sort. Existing sort will be replaced. - * - * @param sort the sort - * @return the QueryLogOptions builder - */ - public Builder sort(List sort) { - this.sort = sort; - return this; - } - } - - protected QueryLogOptions() {} - - protected QueryLogOptions(Builder builder) { - filter = builder.filter; - query = builder.query; - count = builder.count; - offset = builder.offset; - sort = builder.sort; - } - - /** - * New builder. - * - * @return a QueryLogOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the filter. - * - *

A cacheable query that excludes documents that don't mention the query content. Filter - * searches are better for metadata-type searches and for assessing the concepts in the data set. - * - * @return the filter - */ - public String filter() { - return filter; - } - - /** - * Gets the query. - * - *

A query search returns all documents in your data set with full enrichments and full text, - * but with the most relevant documents listed first. - * - * @return the query - */ - public String query() { - return query; - } - - /** - * Gets the count. - * - *

Number of results to return. The maximum for the **count** and **offset** values together in - * any one query is **10000**. - * - * @return the count - */ - public Long count() { - return count; - } - - /** - * Gets the offset. - * - *

The number of query results to skip at the beginning. For example, if the total number of - * results that are returned is 10 and the offset is 8, it returns the last two results. The - * maximum for the **count** and **offset** values together in any one query is **10000**. - * - * @return the offset - */ - public Long offset() { - return offset; - } - - /** - * Gets the sort. - * - *

A comma-separated list of fields in the document to sort on. You can optionally specify a - * sort direction by prefixing the field with `-` for descending or `+` for ascending. Ascending - * is the default sort direction if no prefix is specified. - * - * @return the sort - */ - public List sort() { - return sort; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNestedAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNestedAggregation.java deleted file mode 100644 index 4afd77ab57e..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNestedAggregation.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import java.util.List; - -/** - * A restriction that alters the document set that is used for sub-aggregations it precedes to - * nested documents found in the field specified. - */ -public class QueryNestedAggregation extends QueryAggregation { - - protected String path; - - @SerializedName("matching_results") - protected Long matchingResults; - - protected List aggregations; - - protected QueryNestedAggregation() {} - - /** - * Gets the path. - * - *

The path to the document field to scope sub-aggregations to. - * - * @return the path - */ - public String getPath() { - return path; - } - - /** - * Gets the matchingResults. - * - *

Number of nested documents found in the specified field. - * - * @return the matchingResults - */ - public Long getMatchingResults() { - return matchingResults; - } - - /** - * Gets the aggregations. - * - *

An array of sub-aggregations. - * - * @return the aggregations - */ - public List getAggregations() { - return aggregations; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptions.java deleted file mode 100644 index a7a0d907d98..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptions.java +++ /dev/null @@ -1,667 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** The queryNotices options. */ -public class QueryNoticesOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String filter; - protected String query; - protected String naturalLanguageQuery; - protected Boolean passages; - protected String aggregation; - protected Long count; - protected List xReturn; - protected Long offset; - protected List sort; - protected Boolean highlight; - protected List passagesFields; - protected Long passagesCount; - protected Long passagesCharacters; - protected String deduplicateField; - protected Boolean similar; - protected List similarDocumentIds; - protected List similarFields; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String filter; - private String query; - private String naturalLanguageQuery; - private Boolean passages; - private String aggregation; - private Long count; - private List xReturn; - private Long offset; - private List sort; - private Boolean highlight; - private List passagesFields; - private Long passagesCount; - private Long passagesCharacters; - private String deduplicateField; - private Boolean similar; - private List similarDocumentIds; - private List similarFields; - - /** - * Instantiates a new Builder from an existing QueryNoticesOptions instance. - * - * @param queryNoticesOptions the instance to initialize the Builder with - */ - private Builder(QueryNoticesOptions queryNoticesOptions) { - this.environmentId = queryNoticesOptions.environmentId; - this.collectionId = queryNoticesOptions.collectionId; - this.filter = queryNoticesOptions.filter; - this.query = queryNoticesOptions.query; - this.naturalLanguageQuery = queryNoticesOptions.naturalLanguageQuery; - this.passages = queryNoticesOptions.passages; - this.aggregation = queryNoticesOptions.aggregation; - this.count = queryNoticesOptions.count; - this.xReturn = queryNoticesOptions.xReturn; - this.offset = queryNoticesOptions.offset; - this.sort = queryNoticesOptions.sort; - this.highlight = queryNoticesOptions.highlight; - this.passagesFields = queryNoticesOptions.passagesFields; - this.passagesCount = queryNoticesOptions.passagesCount; - this.passagesCharacters = queryNoticesOptions.passagesCharacters; - this.deduplicateField = queryNoticesOptions.deduplicateField; - this.similar = queryNoticesOptions.similar; - this.similarDocumentIds = queryNoticesOptions.similarDocumentIds; - this.similarFields = queryNoticesOptions.similarFields; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a QueryNoticesOptions. - * - * @return the new QueryNoticesOptions instance - */ - public QueryNoticesOptions build() { - return new QueryNoticesOptions(this); - } - - /** - * Adds a new element to xReturn. - * - * @param returnField the new element to be added - * @return the QueryNoticesOptions builder - */ - public Builder addReturnField(String returnField) { - com.ibm.cloud.sdk.core.util.Validator.notNull(returnField, "returnField cannot be null"); - if (this.xReturn == null) { - this.xReturn = new ArrayList(); - } - this.xReturn.add(returnField); - return this; - } - - /** - * Adds a new element to sort. - * - * @param sort the new element to be added - * @return the QueryNoticesOptions builder - */ - public Builder addSort(String sort) { - com.ibm.cloud.sdk.core.util.Validator.notNull(sort, "sort cannot be null"); - if (this.sort == null) { - this.sort = new ArrayList(); - } - this.sort.add(sort); - return this; - } - - /** - * Adds a new element to passagesFields. - * - * @param passagesFields the new element to be added - * @return the QueryNoticesOptions builder - */ - public Builder addPassagesFields(String passagesFields) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - passagesFields, "passagesFields cannot be null"); - if (this.passagesFields == null) { - this.passagesFields = new ArrayList(); - } - this.passagesFields.add(passagesFields); - return this; - } - - /** - * Adds a new element to similarDocumentIds. - * - * @param similarDocumentIds the new element to be added - * @return the QueryNoticesOptions builder - */ - public Builder addSimilarDocumentIds(String similarDocumentIds) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - similarDocumentIds, "similarDocumentIds cannot be null"); - if (this.similarDocumentIds == null) { - this.similarDocumentIds = new ArrayList(); - } - this.similarDocumentIds.add(similarDocumentIds); - return this; - } - - /** - * Adds a new element to similarFields. - * - * @param similarFields the new element to be added - * @return the QueryNoticesOptions builder - */ - public Builder addSimilarFields(String similarFields) { - com.ibm.cloud.sdk.core.util.Validator.notNull(similarFields, "similarFields cannot be null"); - if (this.similarFields == null) { - this.similarFields = new ArrayList(); - } - this.similarFields.add(similarFields); - return this; - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the QueryNoticesOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the QueryNoticesOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the filter. - * - * @param filter the filter - * @return the QueryNoticesOptions builder - */ - public Builder filter(String filter) { - this.filter = filter; - return this; - } - - /** - * Set the query. - * - * @param query the query - * @return the QueryNoticesOptions builder - */ - public Builder query(String query) { - this.query = query; - return this; - } - - /** - * Set the naturalLanguageQuery. - * - * @param naturalLanguageQuery the naturalLanguageQuery - * @return the QueryNoticesOptions builder - */ - public Builder naturalLanguageQuery(String naturalLanguageQuery) { - this.naturalLanguageQuery = naturalLanguageQuery; - return this; - } - - /** - * Set the passages. - * - * @param passages the passages - * @return the QueryNoticesOptions builder - */ - public Builder passages(Boolean passages) { - this.passages = passages; - return this; - } - - /** - * Set the aggregation. - * - * @param aggregation the aggregation - * @return the QueryNoticesOptions builder - */ - public Builder aggregation(String aggregation) { - this.aggregation = aggregation; - return this; - } - - /** - * Set the count. - * - * @param count the count - * @return the QueryNoticesOptions builder - */ - public Builder count(long count) { - this.count = count; - return this; - } - - /** - * Set the xReturn. Existing xReturn will be replaced. - * - * @param xReturn the xReturn - * @return the QueryNoticesOptions builder - */ - public Builder xReturn(List xReturn) { - this.xReturn = xReturn; - return this; - } - - /** - * Set the offset. - * - * @param offset the offset - * @return the QueryNoticesOptions builder - */ - public Builder offset(long offset) { - this.offset = offset; - return this; - } - - /** - * Set the sort. Existing sort will be replaced. - * - * @param sort the sort - * @return the QueryNoticesOptions builder - */ - public Builder sort(List sort) { - this.sort = sort; - return this; - } - - /** - * Set the highlight. - * - * @param highlight the highlight - * @return the QueryNoticesOptions builder - */ - public Builder highlight(Boolean highlight) { - this.highlight = highlight; - return this; - } - - /** - * Set the passagesFields. Existing passagesFields will be replaced. - * - * @param passagesFields the passagesFields - * @return the QueryNoticesOptions builder - */ - public Builder passagesFields(List passagesFields) { - this.passagesFields = passagesFields; - return this; - } - - /** - * Set the passagesCount. - * - * @param passagesCount the passagesCount - * @return the QueryNoticesOptions builder - */ - public Builder passagesCount(long passagesCount) { - this.passagesCount = passagesCount; - return this; - } - - /** - * Set the passagesCharacters. - * - * @param passagesCharacters the passagesCharacters - * @return the QueryNoticesOptions builder - */ - public Builder passagesCharacters(long passagesCharacters) { - this.passagesCharacters = passagesCharacters; - return this; - } - - /** - * Set the deduplicateField. - * - * @param deduplicateField the deduplicateField - * @return the QueryNoticesOptions builder - */ - public Builder deduplicateField(String deduplicateField) { - this.deduplicateField = deduplicateField; - return this; - } - - /** - * Set the similar. - * - * @param similar the similar - * @return the QueryNoticesOptions builder - */ - public Builder similar(Boolean similar) { - this.similar = similar; - return this; - } - - /** - * Set the similarDocumentIds. Existing similarDocumentIds will be replaced. - * - * @param similarDocumentIds the similarDocumentIds - * @return the QueryNoticesOptions builder - */ - public Builder similarDocumentIds(List similarDocumentIds) { - this.similarDocumentIds = similarDocumentIds; - return this; - } - - /** - * Set the similarFields. Existing similarFields will be replaced. - * - * @param similarFields the similarFields - * @return the QueryNoticesOptions builder - */ - public Builder similarFields(List similarFields) { - this.similarFields = similarFields; - return this; - } - } - - protected QueryNoticesOptions() {} - - protected QueryNoticesOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - filter = builder.filter; - query = builder.query; - naturalLanguageQuery = builder.naturalLanguageQuery; - passages = builder.passages; - aggregation = builder.aggregation; - count = builder.count; - xReturn = builder.xReturn; - offset = builder.offset; - sort = builder.sort; - highlight = builder.highlight; - passagesFields = builder.passagesFields; - passagesCount = builder.passagesCount; - passagesCharacters = builder.passagesCharacters; - deduplicateField = builder.deduplicateField; - similar = builder.similar; - similarDocumentIds = builder.similarDocumentIds; - similarFields = builder.similarFields; - } - - /** - * New builder. - * - * @return a QueryNoticesOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the filter. - * - *

A cacheable query that excludes documents that don't mention the query content. Filter - * searches are better for metadata-type searches and for assessing the concepts in the data set. - * - * @return the filter - */ - public String filter() { - return filter; - } - - /** - * Gets the query. - * - *

A query search returns all documents in your data set with full enrichments and full text, - * but with the most relevant documents listed first. - * - * @return the query - */ - public String query() { - return query; - } - - /** - * Gets the naturalLanguageQuery. - * - *

A natural language query that returns relevant documents by utilizing training data and - * natural language understanding. - * - * @return the naturalLanguageQuery - */ - public String naturalLanguageQuery() { - return naturalLanguageQuery; - } - - /** - * Gets the passages. - * - *

A passages query that returns the most relevant passages from the results. - * - * @return the passages - */ - public Boolean passages() { - return passages; - } - - /** - * Gets the aggregation. - * - *

An aggregation search that returns an exact answer by combining query search with filters. - * Useful for applications to build lists, tables, and time series. For a full list of possible - * aggregations, see the Query reference. - * - * @return the aggregation - */ - public String aggregation() { - return aggregation; - } - - /** - * Gets the count. - * - *

Number of results to return. The maximum for the **count** and **offset** values together in - * any one query is **10000**. - * - * @return the count - */ - public Long count() { - return count; - } - - /** - * Gets the xReturn. - * - *

A comma-separated list of the portion of the document hierarchy to return. - * - * @return the xReturn - */ - public List xReturn() { - return xReturn; - } - - /** - * Gets the offset. - * - *

The number of query results to skip at the beginning. For example, if the total number of - * results that are returned is 10 and the offset is 8, it returns the last two results. The - * maximum for the **count** and **offset** values together in any one query is **10000**. - * - * @return the offset - */ - public Long offset() { - return offset; - } - - /** - * Gets the sort. - * - *

A comma-separated list of fields in the document to sort on. You can optionally specify a - * sort direction by prefixing the field with `-` for descending or `+` for ascending. Ascending - * is the default sort direction if no prefix is specified. - * - * @return the sort - */ - public List sort() { - return sort; - } - - /** - * Gets the highlight. - * - *

When true, a highlight field is returned for each result which contains the fields which - * match the query with `<em></em>` tags around the matching query terms. - * - * @return the highlight - */ - public Boolean highlight() { - return highlight; - } - - /** - * Gets the passagesFields. - * - *

A comma-separated list of fields that passages are drawn from. If this parameter not - * specified, then all top-level fields are included. - * - * @return the passagesFields - */ - public List passagesFields() { - return passagesFields; - } - - /** - * Gets the passagesCount. - * - *

The maximum number of passages to return. The search returns fewer passages if the requested - * total is not found. - * - * @return the passagesCount - */ - public Long passagesCount() { - return passagesCount; - } - - /** - * Gets the passagesCharacters. - * - *

The approximate number of characters that any one passage will have. - * - * @return the passagesCharacters - */ - public Long passagesCharacters() { - return passagesCharacters; - } - - /** - * Gets the deduplicateField. - * - *

When specified, duplicate results based on the field specified are removed from the returned - * results. Duplicate comparison is limited to the current query only, **offset** is not - * considered. This parameter is currently Beta functionality. - * - * @return the deduplicateField - */ - public String deduplicateField() { - return deduplicateField; - } - - /** - * Gets the similar. - * - *

When `true`, results are returned based on their similarity to the document IDs specified in - * the **similar.document_ids** parameter. - * - * @return the similar - */ - public Boolean similar() { - return similar; - } - - /** - * Gets the similarDocumentIds. - * - *

A comma-separated list of document IDs to find similar documents. - * - *

**Tip:** Include the **natural_language_query** parameter to expand the scope of the - * document similarity search with the natural language query. Other query parameters, such as - * **filter** and **query**, are subsequently applied and reduce the scope. - * - * @return the similarDocumentIds - */ - public List similarDocumentIds() { - return similarDocumentIds; - } - - /** - * Gets the similarFields. - * - *

A comma-separated list of field names that are used as a basis for comparison to identify - * similar documents. If not specified, the entire document is used for comparison. - * - * @return the similarFields - */ - public List similarFields() { - return similarFields; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResponse.java deleted file mode 100644 index 095c085e221..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResponse.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Object containing notice query results. */ -public class QueryNoticesResponse extends GenericModel { - - @SerializedName("matching_results") - protected Long matchingResults; - - protected List results; - protected List aggregations; - protected List passages; - - @SerializedName("duplicates_removed") - protected Long duplicatesRemoved; - - protected QueryNoticesResponse() {} - - /** - * Gets the matchingResults. - * - *

The number of matching results. - * - * @return the matchingResults - */ - public Long getMatchingResults() { - return matchingResults; - } - - /** - * Gets the results. - * - *

Array of document results that match the query. - * - * @return the results - */ - public List getResults() { - return results; - } - - /** - * Gets the aggregations. - * - *

Array of aggregation results that match the query. - * - * @return the aggregations - */ - public List getAggregations() { - return aggregations; - } - - /** - * Gets the passages. - * - *

Array of passage results that match the query. - * - * @return the passages - */ - public List getPassages() { - return passages; - } - - /** - * Gets the duplicatesRemoved. - * - *

The number of duplicates removed from this notices query. - * - * @return the duplicatesRemoved - */ - public Long getDuplicatesRemoved() { - return duplicatesRemoved; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResult.java deleted file mode 100644 index 9dfb9603eae..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryNoticesResult.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.ibm.cloud.sdk.core.service.model.DynamicModel; -import java.util.List; -import java.util.Map; - -/** Query result object. */ -public class QueryNoticesResult extends DynamicModel { - - /** The type of the original source file. */ - public interface FileType { - /** pdf. */ - String PDF = "pdf"; - /** html. */ - String HTML = "html"; - /** word. */ - String WORD = "word"; - /** json. */ - String JSON = "json"; - } - - @SerializedName("id") - protected String id; - - @SerializedName("metadata") - protected Map metadata; - - @SerializedName("collection_id") - protected String collectionId; - - @SerializedName("result_metadata") - protected QueryResultMetadata resultMetadata; - - @SerializedName("code") - protected Long code; - - @SerializedName("filename") - protected String filename; - - @SerializedName("file_type") - protected String fileType; - - @SerializedName("sha1") - protected String sha1; - - @SerializedName("notices") - protected List notices; - - public QueryNoticesResult() { - super(new TypeToken() {}); - } - - /** - * Gets the id. - * - *

The unique identifier of the document. - * - * @return the id - */ - public String getId() { - return this.id; - } - - /** - * Gets the metadata. - * - *

Metadata of the document. - * - * @return the metadata - */ - public Map getMetadata() { - return this.metadata; - } - - /** - * Gets the collectionId. - * - *

The collection ID of the collection containing the document for this result. - * - * @return the collectionId - */ - public String getCollectionId() { - return this.collectionId; - } - - /** - * Gets the resultMetadata. - * - *

Metadata of a query result. - * - * @return the resultMetadata - */ - public QueryResultMetadata getResultMetadata() { - return this.resultMetadata; - } - - /** - * Gets the code. - * - *

The internal status code returned by the ingestion subsystem indicating the overall result - * of ingesting the source document. - * - * @return the code - */ - public Long getCode() { - return this.code; - } - - /** - * Gets the filename. - * - *

Name of the original source file (if available). - * - * @return the filename - */ - public String getFilename() { - return this.filename; - } - - /** - * Gets the fileType. - * - *

The type of the original source file. - * - * @return the fileType - */ - public String getFileType() { - return this.fileType; - } - - /** - * Gets the sha1. - * - *

The SHA-1 hash of the original source file (formatted as a hexadecimal string). - * - * @return the sha1 - */ - public String getSha1() { - return this.sha1; - } - - /** - * Gets the notices. - * - *

Array of notices for the document. - * - * @return the notices - */ - public List getNotices() { - return this.notices; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryOptions.java deleted file mode 100644 index 65a598ebf47..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryOptions.java +++ /dev/null @@ -1,703 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The query options. */ -public class QueryOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String filter; - protected String query; - protected String naturalLanguageQuery; - protected Boolean passages; - protected String aggregation; - protected Long count; - protected String xReturn; - protected Long offset; - protected String sort; - protected Boolean highlight; - protected String passagesFields; - protected Long passagesCount; - protected Long passagesCharacters; - protected Boolean deduplicate; - protected String deduplicateField; - protected Boolean similar; - protected String similarDocumentIds; - protected String similarFields; - protected String bias; - protected Boolean spellingSuggestions; - protected Boolean xWatsonLoggingOptOut; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String filter; - private String query; - private String naturalLanguageQuery; - private Boolean passages; - private String aggregation; - private Long count; - private String xReturn; - private Long offset; - private String sort; - private Boolean highlight; - private String passagesFields; - private Long passagesCount; - private Long passagesCharacters; - private Boolean deduplicate; - private String deduplicateField; - private Boolean similar; - private String similarDocumentIds; - private String similarFields; - private String bias; - private Boolean spellingSuggestions; - private Boolean xWatsonLoggingOptOut; - - /** - * Instantiates a new Builder from an existing QueryOptions instance. - * - * @param queryOptions the instance to initialize the Builder with - */ - private Builder(QueryOptions queryOptions) { - this.environmentId = queryOptions.environmentId; - this.collectionId = queryOptions.collectionId; - this.filter = queryOptions.filter; - this.query = queryOptions.query; - this.naturalLanguageQuery = queryOptions.naturalLanguageQuery; - this.passages = queryOptions.passages; - this.aggregation = queryOptions.aggregation; - this.count = queryOptions.count; - this.xReturn = queryOptions.xReturn; - this.offset = queryOptions.offset; - this.sort = queryOptions.sort; - this.highlight = queryOptions.highlight; - this.passagesFields = queryOptions.passagesFields; - this.passagesCount = queryOptions.passagesCount; - this.passagesCharacters = queryOptions.passagesCharacters; - this.deduplicate = queryOptions.deduplicate; - this.deduplicateField = queryOptions.deduplicateField; - this.similar = queryOptions.similar; - this.similarDocumentIds = queryOptions.similarDocumentIds; - this.similarFields = queryOptions.similarFields; - this.bias = queryOptions.bias; - this.spellingSuggestions = queryOptions.spellingSuggestions; - this.xWatsonLoggingOptOut = queryOptions.xWatsonLoggingOptOut; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - */ - public Builder(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - /** - * Builds a QueryOptions. - * - * @return the new QueryOptions instance - */ - public QueryOptions build() { - return new QueryOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the QueryOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the QueryOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the filter. - * - * @param filter the filter - * @return the QueryOptions builder - */ - public Builder filter(String filter) { - this.filter = filter; - return this; - } - - /** - * Set the query. - * - * @param query the query - * @return the QueryOptions builder - */ - public Builder query(String query) { - this.query = query; - return this; - } - - /** - * Set the naturalLanguageQuery. - * - * @param naturalLanguageQuery the naturalLanguageQuery - * @return the QueryOptions builder - */ - public Builder naturalLanguageQuery(String naturalLanguageQuery) { - this.naturalLanguageQuery = naturalLanguageQuery; - return this; - } - - /** - * Set the passages. - * - * @param passages the passages - * @return the QueryOptions builder - */ - public Builder passages(Boolean passages) { - this.passages = passages; - return this; - } - - /** - * Set the aggregation. - * - * @param aggregation the aggregation - * @return the QueryOptions builder - */ - public Builder aggregation(String aggregation) { - this.aggregation = aggregation; - return this; - } - - /** - * Set the count. - * - * @param count the count - * @return the QueryOptions builder - */ - public Builder count(long count) { - this.count = count; - return this; - } - - /** - * Set the xReturn. - * - * @param xReturn the xReturn - * @return the QueryOptions builder - */ - public Builder xReturn(String xReturn) { - this.xReturn = xReturn; - return this; - } - - /** - * Set the offset. - * - * @param offset the offset - * @return the QueryOptions builder - */ - public Builder offset(long offset) { - this.offset = offset; - return this; - } - - /** - * Set the sort. - * - * @param sort the sort - * @return the QueryOptions builder - */ - public Builder sort(String sort) { - this.sort = sort; - return this; - } - - /** - * Set the highlight. - * - * @param highlight the highlight - * @return the QueryOptions builder - */ - public Builder highlight(Boolean highlight) { - this.highlight = highlight; - return this; - } - - /** - * Set the passagesFields. - * - * @param passagesFields the passagesFields - * @return the QueryOptions builder - */ - public Builder passagesFields(String passagesFields) { - this.passagesFields = passagesFields; - return this; - } - - /** - * Set the passagesCount. - * - * @param passagesCount the passagesCount - * @return the QueryOptions builder - */ - public Builder passagesCount(long passagesCount) { - this.passagesCount = passagesCount; - return this; - } - - /** - * Set the passagesCharacters. - * - * @param passagesCharacters the passagesCharacters - * @return the QueryOptions builder - */ - public Builder passagesCharacters(long passagesCharacters) { - this.passagesCharacters = passagesCharacters; - return this; - } - - /** - * Set the deduplicate. - * - * @param deduplicate the deduplicate - * @return the QueryOptions builder - */ - public Builder deduplicate(Boolean deduplicate) { - this.deduplicate = deduplicate; - return this; - } - - /** - * Set the deduplicateField. - * - * @param deduplicateField the deduplicateField - * @return the QueryOptions builder - */ - public Builder deduplicateField(String deduplicateField) { - this.deduplicateField = deduplicateField; - return this; - } - - /** - * Set the similar. - * - * @param similar the similar - * @return the QueryOptions builder - */ - public Builder similar(Boolean similar) { - this.similar = similar; - return this; - } - - /** - * Set the similarDocumentIds. - * - * @param similarDocumentIds the similarDocumentIds - * @return the QueryOptions builder - */ - public Builder similarDocumentIds(String similarDocumentIds) { - this.similarDocumentIds = similarDocumentIds; - return this; - } - - /** - * Set the similarFields. - * - * @param similarFields the similarFields - * @return the QueryOptions builder - */ - public Builder similarFields(String similarFields) { - this.similarFields = similarFields; - return this; - } - - /** - * Set the bias. - * - * @param bias the bias - * @return the QueryOptions builder - */ - public Builder bias(String bias) { - this.bias = bias; - return this; - } - - /** - * Set the spellingSuggestions. - * - * @param spellingSuggestions the spellingSuggestions - * @return the QueryOptions builder - */ - public Builder spellingSuggestions(Boolean spellingSuggestions) { - this.spellingSuggestions = spellingSuggestions; - return this; - } - - /** - * Set the xWatsonLoggingOptOut. - * - * @param xWatsonLoggingOptOut the xWatsonLoggingOptOut - * @return the QueryOptions builder - */ - public Builder xWatsonLoggingOptOut(Boolean xWatsonLoggingOptOut) { - this.xWatsonLoggingOptOut = xWatsonLoggingOptOut; - return this; - } - } - - protected QueryOptions() {} - - protected QueryOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - filter = builder.filter; - query = builder.query; - naturalLanguageQuery = builder.naturalLanguageQuery; - passages = builder.passages; - aggregation = builder.aggregation; - count = builder.count; - xReturn = builder.xReturn; - offset = builder.offset; - sort = builder.sort; - highlight = builder.highlight; - passagesFields = builder.passagesFields; - passagesCount = builder.passagesCount; - passagesCharacters = builder.passagesCharacters; - deduplicate = builder.deduplicate; - deduplicateField = builder.deduplicateField; - similar = builder.similar; - similarDocumentIds = builder.similarDocumentIds; - similarFields = builder.similarFields; - bias = builder.bias; - spellingSuggestions = builder.spellingSuggestions; - xWatsonLoggingOptOut = builder.xWatsonLoggingOptOut; - } - - /** - * New builder. - * - * @return a QueryOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the filter. - * - *

A cacheable query that excludes documents that don't mention the query content. Filter - * searches are better for metadata-type searches and for assessing the concepts in the data set. - * - * @return the filter - */ - public String filter() { - return filter; - } - - /** - * Gets the query. - * - *

A query search returns all documents in your data set with full enrichments and full text, - * but with the most relevant documents listed first. Use a query search when you want to find the - * most relevant search results. - * - * @return the query - */ - public String query() { - return query; - } - - /** - * Gets the naturalLanguageQuery. - * - *

A natural language query that returns relevant documents by utilizing training data and - * natural language understanding. - * - * @return the naturalLanguageQuery - */ - public String naturalLanguageQuery() { - return naturalLanguageQuery; - } - - /** - * Gets the passages. - * - *

A passages query that returns the most relevant passages from the results. - * - * @return the passages - */ - public Boolean passages() { - return passages; - } - - /** - * Gets the aggregation. - * - *

An aggregation search that returns an exact answer by combining query search with filters. - * Useful for applications to build lists, tables, and time series. For a full list of possible - * aggregations, see the Query reference. - * - * @return the aggregation - */ - public String aggregation() { - return aggregation; - } - - /** - * Gets the count. - * - *

Number of results to return. - * - * @return the count - */ - public Long count() { - return count; - } - - /** - * Gets the xReturn. - * - *

A comma-separated list of the portion of the document hierarchy to return. - * - * @return the xReturn - */ - public String xReturn() { - return xReturn; - } - - /** - * Gets the offset. - * - *

The number of query results to skip at the beginning. For example, if the total number of - * results that are returned is 10 and the offset is 8, it returns the last two results. - * - * @return the offset - */ - public Long offset() { - return offset; - } - - /** - * Gets the sort. - * - *

A comma-separated list of fields in the document to sort on. You can optionally specify a - * sort direction by prefixing the field with `-` for descending or `+` for ascending. Ascending - * is the default sort direction if no prefix is specified. This parameter cannot be used in the - * same query as the **bias** parameter. - * - * @return the sort - */ - public String sort() { - return sort; - } - - /** - * Gets the highlight. - * - *

When true, a highlight field is returned for each result which contains the fields which - * match the query with `<em></em>` tags around the matching query terms. - * - * @return the highlight - */ - public Boolean highlight() { - return highlight; - } - - /** - * Gets the passagesFields. - * - *

A comma-separated list of fields that passages are drawn from. If this parameter not - * specified, then all top-level fields are included. - * - * @return the passagesFields - */ - public String passagesFields() { - return passagesFields; - } - - /** - * Gets the passagesCount. - * - *

The maximum number of passages to return. The search returns fewer passages if the requested - * total is not found. The default is `10`. The maximum is `100`. - * - * @return the passagesCount - */ - public Long passagesCount() { - return passagesCount; - } - - /** - * Gets the passagesCharacters. - * - *

The approximate number of characters that any one passage will have. - * - * @return the passagesCharacters - */ - public Long passagesCharacters() { - return passagesCharacters; - } - - /** - * Gets the deduplicate. - * - *

When `true`, and used with a Watson Discovery News collection, duplicate results (based on - * the contents of the **title** field) are removed. Duplicate comparison is limited to the - * current query only; **offset** is not considered. This parameter is currently Beta - * functionality. - * - * @return the deduplicate - */ - public Boolean deduplicate() { - return deduplicate; - } - - /** - * Gets the deduplicateField. - * - *

When specified, duplicate results based on the field specified are removed from the returned - * results. Duplicate comparison is limited to the current query only, **offset** is not - * considered. This parameter is currently Beta functionality. - * - * @return the deduplicateField - */ - public String deduplicateField() { - return deduplicateField; - } - - /** - * Gets the similar. - * - *

When `true`, results are returned based on their similarity to the document IDs specified in - * the **similar.document_ids** parameter. - * - * @return the similar - */ - public Boolean similar() { - return similar; - } - - /** - * Gets the similarDocumentIds. - * - *

A comma-separated list of document IDs to find similar documents. - * - *

**Tip:** Include the **natural_language_query** parameter to expand the scope of the - * document similarity search with the natural language query. Other query parameters, such as - * **filter** and **query**, are subsequently applied and reduce the scope. - * - * @return the similarDocumentIds - */ - public String similarDocumentIds() { - return similarDocumentIds; - } - - /** - * Gets the similarFields. - * - *

A comma-separated list of field names that are used as a basis for comparison to identify - * similar documents. If not specified, the entire document is used for comparison. - * - * @return the similarFields - */ - public String similarFields() { - return similarFields; - } - - /** - * Gets the bias. - * - *

Field which the returned results will be biased against. The specified field must be either - * a **date** or **number** format. When a **date** type field is specified returned results are - * biased towards field values closer to the current date. When a **number** type field is - * specified, returned results are biased towards higher field values. This parameter cannot be - * used in the same query as the **sort** parameter. - * - * @return the bias - */ - public String bias() { - return bias; - } - - /** - * Gets the spellingSuggestions. - * - *

When `true` and the **natural_language_query** parameter is used, the - * **natural_languge_query** parameter is spell checked. The most likely correction is returned in - * the **suggested_query** field of the response (if one exists). - * - *

**Important:** this parameter is only valid when using the Cloud Pak version of Discovery. - * - * @return the spellingSuggestions - */ - public Boolean spellingSuggestions() { - return spellingSuggestions; - } - - /** - * Gets the xWatsonLoggingOptOut. - * - *

If `true`, queries are not stored in the Discovery **Logs** endpoint. - * - * @return the xWatsonLoggingOptOut - */ - public Boolean xWatsonLoggingOptOut() { - return xWatsonLoggingOptOut; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryPassages.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryPassages.java deleted file mode 100644 index f2a12ecf783..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryPassages.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** A passage query result. */ -public class QueryPassages extends GenericModel { - - @SerializedName("document_id") - protected String documentId; - - @SerializedName("passage_score") - protected Double passageScore; - - @SerializedName("passage_text") - protected String passageText; - - @SerializedName("start_offset") - protected Long startOffset; - - @SerializedName("end_offset") - protected Long endOffset; - - protected String field; - - protected QueryPassages() {} - - /** - * Gets the documentId. - * - *

The unique identifier of the document from which the passage has been extracted. - * - * @return the documentId - */ - public String getDocumentId() { - return documentId; - } - - /** - * Gets the passageScore. - * - *

The confidence score of the passages's analysis. A higher score indicates greater - * confidence. - * - * @return the passageScore - */ - public Double getPassageScore() { - return passageScore; - } - - /** - * Gets the passageText. - * - *

The content of the extracted passage. - * - * @return the passageText - */ - public String getPassageText() { - return passageText; - } - - /** - * Gets the startOffset. - * - *

The position of the first character of the extracted passage in the originating field. - * - * @return the startOffset - */ - public Long getStartOffset() { - return startOffset; - } - - /** - * Gets the endOffset. - * - *

The position of the last character of the extracted passage in the originating field. - * - * @return the endOffset - */ - public Long getEndOffset() { - return endOffset; - } - - /** - * Gets the field. - * - *

The label of the field from which the passage has been extracted. - * - * @return the field - */ - public String getField() { - return field; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResponse.java deleted file mode 100644 index 1df29298087..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResponse.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** A response containing the documents and aggregations for the query. */ -public class QueryResponse extends GenericModel { - - @SerializedName("matching_results") - protected Long matchingResults; - - protected List results; - protected List aggregations; - protected List passages; - - @SerializedName("duplicates_removed") - protected Long duplicatesRemoved; - - @SerializedName("session_token") - protected String sessionToken; - - @SerializedName("retrieval_details") - protected RetrievalDetails retrievalDetails; - - @SerializedName("suggested_query") - protected String suggestedQuery; - - protected QueryResponse() {} - - /** - * Gets the matchingResults. - * - *

The number of matching results for the query. - * - * @return the matchingResults - */ - public Long getMatchingResults() { - return matchingResults; - } - - /** - * Gets the results. - * - *

Array of document results for the query. - * - * @return the results - */ - public List getResults() { - return results; - } - - /** - * Gets the aggregations. - * - *

Array of aggregation results for the query. - * - * @return the aggregations - */ - public List getAggregations() { - return aggregations; - } - - /** - * Gets the passages. - * - *

Array of passage results for the query. - * - * @return the passages - */ - public List getPassages() { - return passages; - } - - /** - * Gets the duplicatesRemoved. - * - *

The number of duplicate results removed. - * - * @return the duplicatesRemoved - */ - public Long getDuplicatesRemoved() { - return duplicatesRemoved; - } - - /** - * Gets the sessionToken. - * - *

The session token for this query. The session token can be used to add events associated - * with this query to the query and event log. - * - *

**Important:** Session tokens are case sensitive. - * - * @return the sessionToken - */ - public String getSessionToken() { - return sessionToken; - } - - /** - * Gets the retrievalDetails. - * - *

An object contain retrieval type information. - * - * @return the retrievalDetails - */ - public RetrievalDetails getRetrievalDetails() { - return retrievalDetails; - } - - /** - * Gets the suggestedQuery. - * - *

The suggestions for a misspelled natural language query. - * - * @return the suggestedQuery - */ - public String getSuggestedQuery() { - return suggestedQuery; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResult.java deleted file mode 100644 index eebea29e8e1..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResult.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.ibm.cloud.sdk.core.service.model.DynamicModel; -import java.util.Map; - -/** Query result object. */ -public class QueryResult extends DynamicModel { - - @SerializedName("id") - protected String id; - - @SerializedName("metadata") - protected Map metadata; - - @SerializedName("collection_id") - protected String collectionId; - - @SerializedName("result_metadata") - protected QueryResultMetadata resultMetadata; - - public QueryResult() { - super(new TypeToken() {}); - } - - /** - * Gets the id. - * - *

The unique identifier of the document. - * - * @return the id - */ - public String getId() { - return this.id; - } - - /** - * Gets the metadata. - * - *

Metadata of the document. - * - * @return the metadata - */ - public Map getMetadata() { - return this.metadata; - } - - /** - * Gets the collectionId. - * - *

The collection ID of the collection containing the document for this result. - * - * @return the collectionId - */ - public String getCollectionId() { - return this.collectionId; - } - - /** - * Gets the resultMetadata. - * - *

Metadata of a query result. - * - * @return the resultMetadata - */ - public QueryResultMetadata getResultMetadata() { - return this.resultMetadata; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResultMetadata.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResultMetadata.java deleted file mode 100644 index e6e294229d8..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryResultMetadata.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Metadata of a query result. */ -public class QueryResultMetadata extends GenericModel { - - protected Double score; - protected Double confidence; - - protected QueryResultMetadata() {} - - /** - * Gets the score. - * - *

An unbounded measure of the relevance of a particular result, dependent on the query and - * matching document. A higher score indicates a greater match to the query parameters. - * - * @return the score - */ - public Double getScore() { - return score; - } - - /** - * Gets the confidence. - * - *

The confidence score for the given result. Calculated based on how relevant the result is - * estimated to be. confidence can range from `0.0` to `1.0`. The higher the number, the more - * relevant the document. The `confidence` value for a result was calculated using the model - * specified in the `document_retrieval_strategy` field of the result set. - * - * @return the confidence - */ - public Double getConfidence() { - return confidence; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTermAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTermAggregation.java deleted file mode 100644 index 042e60b6221..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTermAggregation.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import java.util.List; - -/** Returns the top values for the field specified. */ -public class QueryTermAggregation extends QueryAggregation { - - protected String field; - protected Long count; - protected String name; - protected List results; - - protected QueryTermAggregation() {} - - /** - * Gets the field. - * - *

The field in the document used to generate top values from. - * - * @return the field - */ - public String getField() { - return field; - } - - /** - * Gets the count. - * - *

The number of top values returned. - * - * @return the count - */ - public Long getCount() { - return count; - } - - /** - * Gets the name. - * - *

Identifier specified in the query request of this aggregation. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the results. - * - *

Array of top values for the field. - * - * @return the results - */ - public List getResults() { - return results; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTermAggregationResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTermAggregationResult.java deleted file mode 100644 index fadb524a0b7..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTermAggregationResult.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Top value result for the term aggregation. */ -public class QueryTermAggregationResult extends GenericModel { - - protected String key; - - @SerializedName("matching_results") - protected Long matchingResults; - - protected Double relevancy; - - @SerializedName("total_matching_documents") - protected Long totalMatchingDocuments; - - @SerializedName("estimated_matching_documents") - protected Long estimatedMatchingDocuments; - - protected List aggregations; - - protected QueryTermAggregationResult() {} - - /** - * Gets the key. - * - *

Value of the field with a non-zero frequency in the document set. - * - * @return the key - */ - public String getKey() { - return key; - } - - /** - * Gets the matchingResults. - * - *

Number of documents that contain the 'key'. - * - * @return the matchingResults - */ - public Long getMatchingResults() { - return matchingResults; - } - - /** - * Gets the relevancy. - * - *

The relevancy for this term. - * - * @return the relevancy - */ - public Double getRelevancy() { - return relevancy; - } - - /** - * Gets the totalMatchingDocuments. - * - *

The number of documents which have the term as the value of specified field in the whole set - * of documents in this collection. Returned only when the `relevancy` parameter is set to `true`. - * - * @return the totalMatchingDocuments - */ - public Long getTotalMatchingDocuments() { - return totalMatchingDocuments; - } - - /** - * Gets the estimatedMatchingDocuments. - * - *

The estimated number of documents which would match the query and also meet the condition. - * Returned only when the `relevancy` parameter is set to `true`. - * - * @return the estimatedMatchingDocuments - */ - public Long getEstimatedMatchingDocuments() { - return estimatedMatchingDocuments; - } - - /** - * Gets the aggregations. - * - *

An array of sub-aggregations. - * - * @return the aggregations - */ - public List getAggregations() { - return aggregations; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTimesliceAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTimesliceAggregation.java deleted file mode 100644 index 9b664c111a6..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTimesliceAggregation.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import java.util.List; - -/** A specialized histogram aggregation that uses dates to create interval segments. */ -public class QueryTimesliceAggregation extends QueryAggregation { - - protected String field; - protected String interval; - protected String name; - protected List results; - - protected QueryTimesliceAggregation() {} - - /** - * Gets the field. - * - *

The date field name used to create the timeslice. - * - * @return the field - */ - public String getField() { - return field; - } - - /** - * Gets the interval. - * - *

The date interval value. Valid values are seconds, minutes, hours, days, weeks, and years. - * - * @return the interval - */ - public String getInterval() { - return interval; - } - - /** - * Gets the name. - * - *

Identifier specified in the query request of this aggregation. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the results. - * - *

Array of aggregation results. - * - * @return the results - */ - public List getResults() { - return results; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTimesliceAggregationResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTimesliceAggregationResult.java deleted file mode 100644 index fc42778b42e..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTimesliceAggregationResult.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** A timeslice interval segment. */ -public class QueryTimesliceAggregationResult extends GenericModel { - - @SerializedName("key_as_string") - protected String keyAsString; - - protected Long key; - - @SerializedName("matching_results") - protected Long matchingResults; - - protected List aggregations; - - protected QueryTimesliceAggregationResult() {} - - /** - * Gets the keyAsString. - * - *

String date value of the upper bound for the timeslice interval in ISO-8601 format. - * - * @return the keyAsString - */ - public String getKeyAsString() { - return keyAsString; - } - - /** - * Gets the key. - * - *

Numeric date value of the upper bound for the timeslice interval in UNIX milliseconds since - * epoch. - * - * @return the key - */ - public Long getKey() { - return key; - } - - /** - * Gets the matchingResults. - * - *

Number of documents with the specified key as the upper bound. - * - * @return the matchingResults - */ - public Long getMatchingResults() { - return matchingResults; - } - - /** - * Gets the aggregations. - * - *

An array of sub-aggregations. - * - * @return the aggregations - */ - public List getAggregations() { - return aggregations; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTopHitsAggregation.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTopHitsAggregation.java deleted file mode 100644 index 0d3071527fd..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTopHitsAggregation.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -/** Returns the top documents ranked by the score of the query. */ -public class QueryTopHitsAggregation extends QueryAggregation { - - protected Long size; - protected String name; - protected QueryTopHitsAggregationResult hits; - - protected QueryTopHitsAggregation() {} - - /** - * Gets the size. - * - *

The number of documents to return. - * - * @return the size - */ - public Long getSize() { - return size; - } - - /** - * Gets the name. - * - *

Identifier specified in the query request of this aggregation. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Gets the hits. - * - * @return the hits - */ - public QueryTopHitsAggregationResult getHits() { - return hits; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTopHitsAggregationResult.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTopHitsAggregationResult.java deleted file mode 100644 index b7b8a98a041..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/QueryTopHitsAggregationResult.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; -import java.util.Map; - -/** A query response that contains the matching documents for the preceding aggregations. */ -public class QueryTopHitsAggregationResult extends GenericModel { - - @SerializedName("matching_results") - protected Long matchingResults; - - protected List> hits; - - protected QueryTopHitsAggregationResult() {} - - /** - * Gets the matchingResults. - * - *

Number of matching results. - * - * @return the matchingResults - */ - public Long getMatchingResults() { - return matchingResults; - } - - /** - * Gets the hits. - * - *

An array of the document results. - * - * @return the hits - */ - public List> getHits() { - return hits; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/RetrievalDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/RetrievalDetails.java deleted file mode 100644 index f707e433d72..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/RetrievalDetails.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** An object contain retrieval type information. */ -public class RetrievalDetails extends GenericModel { - - /** - * Indentifies the document retrieval strategy used for this query. `relevancy_training` indicates - * that the results were returned using a relevancy trained model. `continuous_relevancy_training` - * indicates that the results were returned using the continuous relevancy training model created - * by result feedback analysis. `untrained` means the results were returned using the standard - * untrained model. - * - *

**Note**: In the event of trained collections being queried, but the trained model is not - * used to return results, the **document_retrieval_strategy** will be listed as `untrained`. - */ - public interface DocumentRetrievalStrategy { - /** untrained. */ - String UNTRAINED = "untrained"; - /** relevancy_training. */ - String RELEVANCY_TRAINING = "relevancy_training"; - /** continuous_relevancy_training. */ - String CONTINUOUS_RELEVANCY_TRAINING = "continuous_relevancy_training"; - } - - @SerializedName("document_retrieval_strategy") - protected String documentRetrievalStrategy; - - protected RetrievalDetails() {} - - /** - * Gets the documentRetrievalStrategy. - * - *

Indentifies the document retrieval strategy used for this query. `relevancy_training` - * indicates that the results were returned using a relevancy trained model. - * `continuous_relevancy_training` indicates that the results were returned using the continuous - * relevancy training model created by result feedback analysis. `untrained` means the results - * were returned using the standard untrained model. - * - *

**Note**: In the event of trained collections being queried, but the trained model is not - * used to return results, the **document_retrieval_strategy** will be listed as `untrained`. - * - * @return the documentRetrievalStrategy - */ - public String getDocumentRetrievalStrategy() { - return documentRetrievalStrategy; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatus.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatus.java deleted file mode 100644 index f44955092a1..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatus.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object containing smart document understanding information for this collection. */ -public class SduStatus extends GenericModel { - - protected Boolean enabled; - - @SerializedName("total_annotated_pages") - protected Long totalAnnotatedPages; - - @SerializedName("total_pages") - protected Long totalPages; - - @SerializedName("total_documents") - protected Long totalDocuments; - - @SerializedName("custom_fields") - protected SduStatusCustomFields customFields; - - protected SduStatus() {} - - /** - * Gets the enabled. - * - *

When `true`, smart document understanding conversion is enabled for this collection. All - * collections created with a version date after `2019-04-30` have smart document understanding - * enabled. If `false`, documents added to the collection are converted using the **conversion** - * settings specified in the configuration associated with the collection. - * - * @return the enabled - */ - public Boolean isEnabled() { - return enabled; - } - - /** - * Gets the totalAnnotatedPages. - * - *

The total number of pages annotated using smart document understanding in this collection. - * - * @return the totalAnnotatedPages - */ - public Long getTotalAnnotatedPages() { - return totalAnnotatedPages; - } - - /** - * Gets the totalPages. - * - *

The current number of pages that can be used for training smart document understanding. The - * `total_pages` number is calculated as the total number of pages identified from the documents - * listed in the **total_documents** field. - * - * @return the totalPages - */ - public Long getTotalPages() { - return totalPages; - } - - /** - * Gets the totalDocuments. - * - *

The total number of documents in this collection that can be used to train smart document - * understanding. For **lite** plan collections, the maximum is the first 20 uploaded documents - * (not including HTML or JSON documents). For other plans, the maximum is the first 40 uploaded - * documents (not including HTML or JSON documents). When the maximum is reached, additional - * documents uploaded to the collection are not considered for training smart document - * understanding. - * - * @return the totalDocuments - */ - public Long getTotalDocuments() { - return totalDocuments; - } - - /** - * Gets the customFields. - * - *

Information about custom smart document understanding fields that exist in this collection. - * - * @return the customFields - */ - public SduStatusCustomFields getCustomFields() { - return customFields; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatusCustomFields.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatusCustomFields.java deleted file mode 100644 index 2225c3de2ac..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SduStatusCustomFields.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Information about custom smart document understanding fields that exist in this collection. */ -public class SduStatusCustomFields extends GenericModel { - - protected Long defined; - - @SerializedName("maximum_allowed") - protected Long maximumAllowed; - - protected SduStatusCustomFields() {} - - /** - * Gets the defined. - * - *

The number of custom fields defined for this collection. - * - * @return the defined - */ - public Long getDefined() { - return defined; - } - - /** - * Gets the maximumAllowed. - * - *

The maximum number of custom fields that are allowed in this collection. - * - * @return the maximumAllowed - */ - public Long getMaximumAllowed() { - return maximumAllowed; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SearchStatus.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SearchStatus.java deleted file mode 100644 index 24b59ef8dd6..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SearchStatus.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import com.ibm.cloud.sdk.core.util.DateTypeAdapter; -import java.util.Date; - -/** Information about the Continuous Relevancy Training for this environment. */ -public class SearchStatus extends GenericModel { - - /** The current status of Continuous Relevancy Training for this environment. */ - public interface Status { - /** NO_DATA. */ - String NO_DATA = "NO_DATA"; - /** INSUFFICENT_DATA. */ - String INSUFFICENT_DATA = "INSUFFICENT_DATA"; - /** TRAINING. */ - String TRAINING = "TRAINING"; - /** TRAINED. */ - String TRAINED = "TRAINED"; - /** NOT_APPLICABLE. */ - String NOT_APPLICABLE = "NOT_APPLICABLE"; - } - - protected String scope; - protected String status; - - @SerializedName("status_description") - protected String statusDescription; - - @JsonAdapter(DateTypeAdapter.class) - @SerializedName("last_trained") - protected Date lastTrained; - - protected SearchStatus() {} - - /** - * Gets the scope. - * - *

Current scope of the training. Always returned as `environment`. - * - * @return the scope - */ - public String getScope() { - return scope; - } - - /** - * Gets the status. - * - *

The current status of Continuous Relevancy Training for this environment. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the statusDescription. - * - *

Long description of the current Continuous Relevancy Training status. - * - * @return the statusDescription - */ - public String getStatusDescription() { - return statusDescription; - } - - /** - * Gets the lastTrained. - * - *

The date stamp of the most recent completed training for this environment. - * - * @return the lastTrained - */ - public Date getLastTrained() { - return lastTrained; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SegmentSettings.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SegmentSettings.java deleted file mode 100644 index 4e431ff8a2e..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SegmentSettings.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** A list of Document Segmentation settings. */ -public class SegmentSettings extends GenericModel { - - protected Boolean enabled; - - @SerializedName("selector_tags") - protected List selectorTags; - - @SerializedName("annotated_fields") - protected List annotatedFields; - - /** Builder. */ - public static class Builder { - private Boolean enabled; - private List selectorTags; - private List annotatedFields; - - /** - * Instantiates a new Builder from an existing SegmentSettings instance. - * - * @param segmentSettings the instance to initialize the Builder with - */ - private Builder(SegmentSettings segmentSettings) { - this.enabled = segmentSettings.enabled; - this.selectorTags = segmentSettings.selectorTags; - this.annotatedFields = segmentSettings.annotatedFields; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a SegmentSettings. - * - * @return the new SegmentSettings instance - */ - public SegmentSettings build() { - return new SegmentSettings(this); - } - - /** - * Adds a new element to selectorTags. - * - * @param selectorTags the new element to be added - * @return the SegmentSettings builder - */ - public Builder addSelectorTags(String selectorTags) { - com.ibm.cloud.sdk.core.util.Validator.notNull(selectorTags, "selectorTags cannot be null"); - if (this.selectorTags == null) { - this.selectorTags = new ArrayList(); - } - this.selectorTags.add(selectorTags); - return this; - } - - /** - * Adds a new element to annotatedFields. - * - * @param annotatedFields the new element to be added - * @return the SegmentSettings builder - */ - public Builder addAnnotatedFields(String annotatedFields) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - annotatedFields, "annotatedFields cannot be null"); - if (this.annotatedFields == null) { - this.annotatedFields = new ArrayList(); - } - this.annotatedFields.add(annotatedFields); - return this; - } - - /** - * Set the enabled. - * - * @param enabled the enabled - * @return the SegmentSettings builder - */ - public Builder enabled(Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Set the selectorTags. Existing selectorTags will be replaced. - * - * @param selectorTags the selectorTags - * @return the SegmentSettings builder - */ - public Builder selectorTags(List selectorTags) { - this.selectorTags = selectorTags; - return this; - } - - /** - * Set the annotatedFields. Existing annotatedFields will be replaced. - * - * @param annotatedFields the annotatedFields - * @return the SegmentSettings builder - */ - public Builder annotatedFields(List annotatedFields) { - this.annotatedFields = annotatedFields; - return this; - } - } - - protected SegmentSettings() {} - - protected SegmentSettings(Builder builder) { - enabled = builder.enabled; - selectorTags = builder.selectorTags; - annotatedFields = builder.annotatedFields; - } - - /** - * New builder. - * - * @return a SegmentSettings builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the enabled. - * - *

Enables/disables the Document Segmentation feature. - * - * @return the enabled - */ - public Boolean enabled() { - return enabled; - } - - /** - * Gets the selectorTags. - * - *

Defines the heading level that splits into document segments. Valid values are h1, h2, h3, - * h4, h5, h6. The content of the header field that the segmentation splits at is used as the - * **title** field for that segmented result. Only valid if used with a collection that has - * **enabled** set to `false` in the **smart_document_understanding** object. - * - * @return the selectorTags - */ - public List selectorTags() { - return selectorTags; - } - - /** - * Gets the annotatedFields. - * - *

Defines the annotated smart document understanding fields that the document is split on. The - * content of the annotated field that the segmentation splits at is used as the **title** field - * for that segmented result. For example, if the field `sub-title` is specified, when a document - * is uploaded each time the smart document understanding conversion encounters a field of type - * `sub-title` the document is split at that point and the content of the field used as the title - * of the remaining content. This split is performed for all instances of the listed fields in the - * uploaded document. Only valid if used with a collection that has **enabled** set to `true` in - * the **smart_document_understanding** object. - * - * @return the annotatedFields - */ - public List annotatedFields() { - return annotatedFields; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Source.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Source.java deleted file mode 100644 index a05838fee96..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/Source.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object containing source parameters for the configuration. */ -public class Source extends GenericModel { - - /** - * The type of source to connect to. - `box` indicates the configuration is to connect an instance - * of Enterprise Box. - `salesforce` indicates the configuration is to connect to Salesforce. - - * `sharepoint` indicates the configuration is to connect to Microsoft SharePoint Online. - - * `web_crawl` indicates the configuration is to perform a web page crawl. - - * `cloud_object_storage` indicates the configuration is to connect to a cloud object store. - */ - public interface Type { - /** box. */ - String BOX = "box"; - /** salesforce. */ - String SALESFORCE = "salesforce"; - /** sharepoint. */ - String SHAREPOINT = "sharepoint"; - /** web_crawl. */ - String WEB_CRAWL = "web_crawl"; - /** cloud_object_storage. */ - String CLOUD_OBJECT_STORAGE = "cloud_object_storage"; - } - - protected String type; - - @SerializedName("credential_id") - protected String credentialId; - - protected SourceSchedule schedule; - protected SourceOptions options; - - /** Builder. */ - public static class Builder { - private String type; - private String credentialId; - private SourceSchedule schedule; - private SourceOptions options; - - /** - * Instantiates a new Builder from an existing Source instance. - * - * @param source the instance to initialize the Builder with - */ - private Builder(Source source) { - this.type = source.type; - this.credentialId = source.credentialId; - this.schedule = source.schedule; - this.options = source.options; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a Source. - * - * @return the new Source instance - */ - public Source build() { - return new Source(this); - } - - /** - * Set the type. - * - * @param type the type - * @return the Source builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Set the credentialId. - * - * @param credentialId the credentialId - * @return the Source builder - */ - public Builder credentialId(String credentialId) { - this.credentialId = credentialId; - return this; - } - - /** - * Set the schedule. - * - * @param schedule the schedule - * @return the Source builder - */ - public Builder schedule(SourceSchedule schedule) { - this.schedule = schedule; - return this; - } - - /** - * Set the options. - * - * @param options the options - * @return the Source builder - */ - public Builder options(SourceOptions options) { - this.options = options; - return this; - } - } - - protected Source() {} - - protected Source(Builder builder) { - type = builder.type; - credentialId = builder.credentialId; - schedule = builder.schedule; - options = builder.options; - } - - /** - * New builder. - * - * @return a Source builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the type. - * - *

The type of source to connect to. - `box` indicates the configuration is to connect an - * instance of Enterprise Box. - `salesforce` indicates the configuration is to connect to - * Salesforce. - `sharepoint` indicates the configuration is to connect to Microsoft SharePoint - * Online. - `web_crawl` indicates the configuration is to perform a web page crawl. - - * `cloud_object_storage` indicates the configuration is to connect to a cloud object store. - * - * @return the type - */ - public String type() { - return type; - } - - /** - * Gets the credentialId. - * - *

The **credential_id** of the credentials to use to connect to the source. Credentials are - * defined using the **credentials** method. The **source_type** of the credentials used must - * match the **type** field specified in this object. - * - * @return the credentialId - */ - public String credentialId() { - return credentialId; - } - - /** - * Gets the schedule. - * - *

Object containing the schedule information for the source. - * - * @return the schedule - */ - public SourceSchedule schedule() { - return schedule; - } - - /** - * Gets the options. - * - *

The **options** object defines which items to crawl from the source system. - * - * @return the options - */ - public SourceOptions options() { - return options; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptions.java deleted file mode 100644 index d7e04a458c5..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptions.java +++ /dev/null @@ -1,306 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** The **options** object defines which items to crawl from the source system. */ -public class SourceOptions extends GenericModel { - - protected List folders; - protected List objects; - - @SerializedName("site_collections") - protected List siteCollections; - - protected List urls; - protected List buckets; - - @SerializedName("crawl_all_buckets") - protected Boolean crawlAllBuckets; - - /** Builder. */ - public static class Builder { - private List folders; - private List objects; - private List siteCollections; - private List urls; - private List buckets; - private Boolean crawlAllBuckets; - - /** - * Instantiates a new Builder from an existing SourceOptions instance. - * - * @param sourceOptions the instance to initialize the Builder with - */ - private Builder(SourceOptions sourceOptions) { - this.folders = sourceOptions.folders; - this.objects = sourceOptions.objects; - this.siteCollections = sourceOptions.siteCollections; - this.urls = sourceOptions.urls; - this.buckets = sourceOptions.buckets; - this.crawlAllBuckets = sourceOptions.crawlAllBuckets; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a SourceOptions. - * - * @return the new SourceOptions instance - */ - public SourceOptions build() { - return new SourceOptions(this); - } - - /** - * Adds a new element to folders. - * - * @param folders the new element to be added - * @return the SourceOptions builder - */ - public Builder addFolders(SourceOptionsFolder folders) { - com.ibm.cloud.sdk.core.util.Validator.notNull(folders, "folders cannot be null"); - if (this.folders == null) { - this.folders = new ArrayList(); - } - this.folders.add(folders); - return this; - } - - /** - * Adds a new element to objects. - * - * @param objects the new element to be added - * @return the SourceOptions builder - */ - public Builder addObjects(SourceOptionsObject objects) { - com.ibm.cloud.sdk.core.util.Validator.notNull(objects, "objects cannot be null"); - if (this.objects == null) { - this.objects = new ArrayList(); - } - this.objects.add(objects); - return this; - } - - /** - * Adds a new element to siteCollections. - * - * @param siteCollections the new element to be added - * @return the SourceOptions builder - */ - public Builder addSiteCollections(SourceOptionsSiteColl siteCollections) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - siteCollections, "siteCollections cannot be null"); - if (this.siteCollections == null) { - this.siteCollections = new ArrayList(); - } - this.siteCollections.add(siteCollections); - return this; - } - - /** - * Adds a new element to urls. - * - * @param urls the new element to be added - * @return the SourceOptions builder - */ - public Builder addUrls(SourceOptionsWebCrawl urls) { - com.ibm.cloud.sdk.core.util.Validator.notNull(urls, "urls cannot be null"); - if (this.urls == null) { - this.urls = new ArrayList(); - } - this.urls.add(urls); - return this; - } - - /** - * Adds a new element to buckets. - * - * @param buckets the new element to be added - * @return the SourceOptions builder - */ - public Builder addBuckets(SourceOptionsBuckets buckets) { - com.ibm.cloud.sdk.core.util.Validator.notNull(buckets, "buckets cannot be null"); - if (this.buckets == null) { - this.buckets = new ArrayList(); - } - this.buckets.add(buckets); - return this; - } - - /** - * Set the folders. Existing folders will be replaced. - * - * @param folders the folders - * @return the SourceOptions builder - */ - public Builder folders(List folders) { - this.folders = folders; - return this; - } - - /** - * Set the objects. Existing objects will be replaced. - * - * @param objects the objects - * @return the SourceOptions builder - */ - public Builder objects(List objects) { - this.objects = objects; - return this; - } - - /** - * Set the siteCollections. Existing siteCollections will be replaced. - * - * @param siteCollections the siteCollections - * @return the SourceOptions builder - */ - public Builder siteCollections(List siteCollections) { - this.siteCollections = siteCollections; - return this; - } - - /** - * Set the urls. Existing urls will be replaced. - * - * @param urls the urls - * @return the SourceOptions builder - */ - public Builder urls(List urls) { - this.urls = urls; - return this; - } - - /** - * Set the buckets. Existing buckets will be replaced. - * - * @param buckets the buckets - * @return the SourceOptions builder - */ - public Builder buckets(List buckets) { - this.buckets = buckets; - return this; - } - - /** - * Set the crawlAllBuckets. - * - * @param crawlAllBuckets the crawlAllBuckets - * @return the SourceOptions builder - */ - public Builder crawlAllBuckets(Boolean crawlAllBuckets) { - this.crawlAllBuckets = crawlAllBuckets; - return this; - } - } - - protected SourceOptions() {} - - protected SourceOptions(Builder builder) { - folders = builder.folders; - objects = builder.objects; - siteCollections = builder.siteCollections; - urls = builder.urls; - buckets = builder.buckets; - crawlAllBuckets = builder.crawlAllBuckets; - } - - /** - * New builder. - * - * @return a SourceOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the folders. - * - *

Array of folders to crawl from the Box source. Only valid, and required, when the **type** - * field of the **source** object is set to `box`. - * - * @return the folders - */ - public List folders() { - return folders; - } - - /** - * Gets the objects. - * - *

Array of Salesforce document object types to crawl from the Salesforce source. Only valid, - * and required, when the **type** field of the **source** object is set to `salesforce`. - * - * @return the objects - */ - public List objects() { - return objects; - } - - /** - * Gets the siteCollections. - * - *

Array of Microsoft SharePointoint Online site collections to crawl from the SharePoint - * source. Only valid and required when the **type** field of the **source** object is set to - * `sharepoint`. - * - * @return the siteCollections - */ - public List siteCollections() { - return siteCollections; - } - - /** - * Gets the urls. - * - *

Array of Web page URLs to begin crawling the web from. Only valid and required when the - * **type** field of the **source** object is set to `web_crawl`. - * - * @return the urls - */ - public List urls() { - return urls; - } - - /** - * Gets the buckets. - * - *

Array of cloud object store buckets to begin crawling. Only valid and required when the - * **type** field of the **source** object is set to `cloud_object_store`, and the - * **crawl_all_buckets** field is `false` or not specified. - * - * @return the buckets - */ - public List buckets() { - return buckets; - } - - /** - * Gets the crawlAllBuckets. - * - *

When `true`, all buckets in the specified cloud object store are crawled. If set to `true`, - * the **buckets** array must not be specified. - * - * @return the crawlAllBuckets - */ - public Boolean crawlAllBuckets() { - return crawlAllBuckets; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsBuckets.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsBuckets.java deleted file mode 100644 index 60e4c4ac75d..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsBuckets.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object defining a cloud object store bucket to crawl. */ -public class SourceOptionsBuckets extends GenericModel { - - protected String name; - protected Long limit; - - /** Builder. */ - public static class Builder { - private String name; - private Long limit; - - /** - * Instantiates a new Builder from an existing SourceOptionsBuckets instance. - * - * @param sourceOptionsBuckets the instance to initialize the Builder with - */ - private Builder(SourceOptionsBuckets sourceOptionsBuckets) { - this.name = sourceOptionsBuckets.name; - this.limit = sourceOptionsBuckets.limit; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - */ - public Builder(String name) { - this.name = name; - } - - /** - * Builds a SourceOptionsBuckets. - * - * @return the new SourceOptionsBuckets instance - */ - public SourceOptionsBuckets build() { - return new SourceOptionsBuckets(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the SourceOptionsBuckets builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the SourceOptionsBuckets builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - } - - protected SourceOptionsBuckets() {} - - protected SourceOptionsBuckets(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, "name cannot be null"); - name = builder.name; - limit = builder.limit; - } - - /** - * New builder. - * - * @return a SourceOptionsBuckets builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - *

The name of the cloud object store bucket to crawl. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the limit. - * - *

The number of documents to crawl from this cloud object store bucket. If not specified, all - * documents in the bucket are crawled. - * - * @return the limit - */ - public Long limit() { - return limit; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsFolder.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsFolder.java deleted file mode 100644 index 2f018106607..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsFolder.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object that defines a box folder to crawl with this configuration. */ -public class SourceOptionsFolder extends GenericModel { - - @SerializedName("owner_user_id") - protected String ownerUserId; - - @SerializedName("folder_id") - protected String folderId; - - protected Long limit; - - /** Builder. */ - public static class Builder { - private String ownerUserId; - private String folderId; - private Long limit; - - /** - * Instantiates a new Builder from an existing SourceOptionsFolder instance. - * - * @param sourceOptionsFolder the instance to initialize the Builder with - */ - private Builder(SourceOptionsFolder sourceOptionsFolder) { - this.ownerUserId = sourceOptionsFolder.ownerUserId; - this.folderId = sourceOptionsFolder.folderId; - this.limit = sourceOptionsFolder.limit; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param ownerUserId the ownerUserId - * @param folderId the folderId - */ - public Builder(String ownerUserId, String folderId) { - this.ownerUserId = ownerUserId; - this.folderId = folderId; - } - - /** - * Builds a SourceOptionsFolder. - * - * @return the new SourceOptionsFolder instance - */ - public SourceOptionsFolder build() { - return new SourceOptionsFolder(this); - } - - /** - * Set the ownerUserId. - * - * @param ownerUserId the ownerUserId - * @return the SourceOptionsFolder builder - */ - public Builder ownerUserId(String ownerUserId) { - this.ownerUserId = ownerUserId; - return this; - } - - /** - * Set the folderId. - * - * @param folderId the folderId - * @return the SourceOptionsFolder builder - */ - public Builder folderId(String folderId) { - this.folderId = folderId; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the SourceOptionsFolder builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - } - - protected SourceOptionsFolder() {} - - protected SourceOptionsFolder(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.ownerUserId, "ownerUserId cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.folderId, "folderId cannot be null"); - ownerUserId = builder.ownerUserId; - folderId = builder.folderId; - limit = builder.limit; - } - - /** - * New builder. - * - * @return a SourceOptionsFolder builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the ownerUserId. - * - *

The Box user ID of the user who owns the folder to crawl. - * - * @return the ownerUserId - */ - public String ownerUserId() { - return ownerUserId; - } - - /** - * Gets the folderId. - * - *

The Box folder ID of the folder to crawl. - * - * @return the folderId - */ - public String folderId() { - return folderId; - } - - /** - * Gets the limit. - * - *

The maximum number of documents to crawl for this folder. By default, all documents in the - * folder are crawled. - * - * @return the limit - */ - public Long limit() { - return limit; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsObject.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsObject.java deleted file mode 100644 index 8b95e6216d0..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsObject.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object that defines a Salesforce document object type crawl with this configuration. */ -public class SourceOptionsObject extends GenericModel { - - protected String name; - protected Long limit; - - /** Builder. */ - public static class Builder { - private String name; - private Long limit; - - /** - * Instantiates a new Builder from an existing SourceOptionsObject instance. - * - * @param sourceOptionsObject the instance to initialize the Builder with - */ - private Builder(SourceOptionsObject sourceOptionsObject) { - this.name = sourceOptionsObject.name; - this.limit = sourceOptionsObject.limit; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param name the name - */ - public Builder(String name) { - this.name = name; - } - - /** - * Builds a SourceOptionsObject. - * - * @return the new SourceOptionsObject instance - */ - public SourceOptionsObject build() { - return new SourceOptionsObject(this); - } - - /** - * Set the name. - * - * @param name the name - * @return the SourceOptionsObject builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the SourceOptionsObject builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - } - - protected SourceOptionsObject() {} - - protected SourceOptionsObject(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, "name cannot be null"); - name = builder.name; - limit = builder.limit; - } - - /** - * New builder. - * - * @return a SourceOptionsObject builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the name. - * - *

The name of the Salesforce document object to crawl. For example, `case`. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the limit. - * - *

The maximum number of documents to crawl for this document object. By default, all documents - * in the document object are crawled. - * - * @return the limit - */ - public Long limit() { - return limit; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsSiteColl.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsSiteColl.java deleted file mode 100644 index 8cc93bbf7a7..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsSiteColl.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object that defines a Microsoft SharePoint site collection to crawl with this configuration. */ -public class SourceOptionsSiteColl extends GenericModel { - - @SerializedName("site_collection_path") - protected String siteCollectionPath; - - protected Long limit; - - /** Builder. */ - public static class Builder { - private String siteCollectionPath; - private Long limit; - - /** - * Instantiates a new Builder from an existing SourceOptionsSiteColl instance. - * - * @param sourceOptionsSiteColl the instance to initialize the Builder with - */ - private Builder(SourceOptionsSiteColl sourceOptionsSiteColl) { - this.siteCollectionPath = sourceOptionsSiteColl.siteCollectionPath; - this.limit = sourceOptionsSiteColl.limit; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param siteCollectionPath the siteCollectionPath - */ - public Builder(String siteCollectionPath) { - this.siteCollectionPath = siteCollectionPath; - } - - /** - * Builds a SourceOptionsSiteColl. - * - * @return the new SourceOptionsSiteColl instance - */ - public SourceOptionsSiteColl build() { - return new SourceOptionsSiteColl(this); - } - - /** - * Set the siteCollectionPath. - * - * @param siteCollectionPath the siteCollectionPath - * @return the SourceOptionsSiteColl builder - */ - public Builder siteCollectionPath(String siteCollectionPath) { - this.siteCollectionPath = siteCollectionPath; - return this; - } - - /** - * Set the limit. - * - * @param limit the limit - * @return the SourceOptionsSiteColl builder - */ - public Builder limit(long limit) { - this.limit = limit; - return this; - } - } - - protected SourceOptionsSiteColl() {} - - protected SourceOptionsSiteColl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.siteCollectionPath, "siteCollectionPath cannot be null"); - siteCollectionPath = builder.siteCollectionPath; - limit = builder.limit; - } - - /** - * New builder. - * - * @return a SourceOptionsSiteColl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the siteCollectionPath. - * - *

The Microsoft SharePoint Online site collection path to crawl. The path must be be relative - * to the **organization_url** that was specified in the credentials associated with this source - * configuration. - * - * @return the siteCollectionPath - */ - public String siteCollectionPath() { - return siteCollectionPath; - } - - /** - * Gets the limit. - * - *

The maximum number of documents to crawl for this site collection. By default, all documents - * in the site collection are crawled. - * - * @return the limit - */ - public Long limit() { - return limit; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsWebCrawl.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsWebCrawl.java deleted file mode 100644 index 82053c1e190..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptionsWebCrawl.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** Object defining which URL to crawl and how to crawl it. */ -public class SourceOptionsWebCrawl extends GenericModel { - - /** - * The number of concurrent URLs to fetch. `gentle` means one URL is fetched at a time with a - * delay between each call. `normal` means as many as two URLs are fectched concurrently with a - * short delay between fetch calls. `aggressive` means that up to ten URLs are fetched - * concurrently with a short delay between fetch calls. - */ - public interface CrawlSpeed { - /** gentle. */ - String GENTLE = "gentle"; - /** normal. */ - String NORMAL = "normal"; - /** aggressive. */ - String AGGRESSIVE = "aggressive"; - } - - protected String url; - - @SerializedName("limit_to_starting_hosts") - protected Boolean limitToStartingHosts; - - @SerializedName("crawl_speed") - protected String crawlSpeed; - - @SerializedName("allow_untrusted_certificate") - protected Boolean allowUntrustedCertificate; - - @SerializedName("maximum_hops") - protected Long maximumHops; - - @SerializedName("request_timeout") - protected Long requestTimeout; - - @SerializedName("override_robots_txt") - protected Boolean overrideRobotsTxt; - - protected List blacklist; - - /** Builder. */ - public static class Builder { - private String url; - private Boolean limitToStartingHosts; - private String crawlSpeed; - private Boolean allowUntrustedCertificate; - private Long maximumHops; - private Long requestTimeout; - private Boolean overrideRobotsTxt; - private List blacklist; - - /** - * Instantiates a new Builder from an existing SourceOptionsWebCrawl instance. - * - * @param sourceOptionsWebCrawl the instance to initialize the Builder with - */ - private Builder(SourceOptionsWebCrawl sourceOptionsWebCrawl) { - this.url = sourceOptionsWebCrawl.url; - this.limitToStartingHosts = sourceOptionsWebCrawl.limitToStartingHosts; - this.crawlSpeed = sourceOptionsWebCrawl.crawlSpeed; - this.allowUntrustedCertificate = sourceOptionsWebCrawl.allowUntrustedCertificate; - this.maximumHops = sourceOptionsWebCrawl.maximumHops; - this.requestTimeout = sourceOptionsWebCrawl.requestTimeout; - this.overrideRobotsTxt = sourceOptionsWebCrawl.overrideRobotsTxt; - this.blacklist = sourceOptionsWebCrawl.blacklist; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param url the url - */ - public Builder(String url) { - this.url = url; - } - - /** - * Builds a SourceOptionsWebCrawl. - * - * @return the new SourceOptionsWebCrawl instance - */ - public SourceOptionsWebCrawl build() { - return new SourceOptionsWebCrawl(this); - } - - /** - * Adds a new element to blacklist. - * - * @param blacklist the new element to be added - * @return the SourceOptionsWebCrawl builder - */ - public Builder addBlacklist(String blacklist) { - com.ibm.cloud.sdk.core.util.Validator.notNull(blacklist, "blacklist cannot be null"); - if (this.blacklist == null) { - this.blacklist = new ArrayList(); - } - this.blacklist.add(blacklist); - return this; - } - - /** - * Set the url. - * - * @param url the url - * @return the SourceOptionsWebCrawl builder - */ - public Builder url(String url) { - this.url = url; - return this; - } - - /** - * Set the limitToStartingHosts. - * - * @param limitToStartingHosts the limitToStartingHosts - * @return the SourceOptionsWebCrawl builder - */ - public Builder limitToStartingHosts(Boolean limitToStartingHosts) { - this.limitToStartingHosts = limitToStartingHosts; - return this; - } - - /** - * Set the crawlSpeed. - * - * @param crawlSpeed the crawlSpeed - * @return the SourceOptionsWebCrawl builder - */ - public Builder crawlSpeed(String crawlSpeed) { - this.crawlSpeed = crawlSpeed; - return this; - } - - /** - * Set the allowUntrustedCertificate. - * - * @param allowUntrustedCertificate the allowUntrustedCertificate - * @return the SourceOptionsWebCrawl builder - */ - public Builder allowUntrustedCertificate(Boolean allowUntrustedCertificate) { - this.allowUntrustedCertificate = allowUntrustedCertificate; - return this; - } - - /** - * Set the maximumHops. - * - * @param maximumHops the maximumHops - * @return the SourceOptionsWebCrawl builder - */ - public Builder maximumHops(long maximumHops) { - this.maximumHops = maximumHops; - return this; - } - - /** - * Set the requestTimeout. - * - * @param requestTimeout the requestTimeout - * @return the SourceOptionsWebCrawl builder - */ - public Builder requestTimeout(long requestTimeout) { - this.requestTimeout = requestTimeout; - return this; - } - - /** - * Set the overrideRobotsTxt. - * - * @param overrideRobotsTxt the overrideRobotsTxt - * @return the SourceOptionsWebCrawl builder - */ - public Builder overrideRobotsTxt(Boolean overrideRobotsTxt) { - this.overrideRobotsTxt = overrideRobotsTxt; - return this; - } - - /** - * Set the blacklist. Existing blacklist will be replaced. - * - * @param blacklist the blacklist - * @return the SourceOptionsWebCrawl builder - */ - public Builder blacklist(List blacklist) { - this.blacklist = blacklist; - return this; - } - } - - protected SourceOptionsWebCrawl() {} - - protected SourceOptionsWebCrawl(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.url, "url cannot be null"); - url = builder.url; - limitToStartingHosts = builder.limitToStartingHosts; - crawlSpeed = builder.crawlSpeed; - allowUntrustedCertificate = builder.allowUntrustedCertificate; - maximumHops = builder.maximumHops; - requestTimeout = builder.requestTimeout; - overrideRobotsTxt = builder.overrideRobotsTxt; - blacklist = builder.blacklist; - } - - /** - * New builder. - * - * @return a SourceOptionsWebCrawl builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the url. - * - *

The starting URL to crawl. - * - * @return the url - */ - public String url() { - return url; - } - - /** - * Gets the limitToStartingHosts. - * - *

When `true`, crawls of the specified URL are limited to the host part of the **url** field. - * - * @return the limitToStartingHosts - */ - public Boolean limitToStartingHosts() { - return limitToStartingHosts; - } - - /** - * Gets the crawlSpeed. - * - *

The number of concurrent URLs to fetch. `gentle` means one URL is fetched at a time with a - * delay between each call. `normal` means as many as two URLs are fectched concurrently with a - * short delay between fetch calls. `aggressive` means that up to ten URLs are fetched - * concurrently with a short delay between fetch calls. - * - * @return the crawlSpeed - */ - public String crawlSpeed() { - return crawlSpeed; - } - - /** - * Gets the allowUntrustedCertificate. - * - *

When `true`, allows the crawl to interact with HTTPS sites with SSL certificates with - * untrusted signers. - * - * @return the allowUntrustedCertificate - */ - public Boolean allowUntrustedCertificate() { - return allowUntrustedCertificate; - } - - /** - * Gets the maximumHops. - * - *

The maximum number of hops to make from the initial URL. When a page is crawled each link on - * that page will also be crawled if it is within the **maximum_hops** from the initial URL. The - * first page crawled is 0 hops, each link crawled from the first page is 1 hop, each link crawled - * from those pages is 2 hops, and so on. - * - * @return the maximumHops - */ - public Long maximumHops() { - return maximumHops; - } - - /** - * Gets the requestTimeout. - * - *

The maximum milliseconds to wait for a response from the web server. - * - * @return the requestTimeout - */ - public Long requestTimeout() { - return requestTimeout; - } - - /** - * Gets the overrideRobotsTxt. - * - *

When `true`, the crawler will ignore any `robots.txt` encountered by the crawler. This - * should only ever be done when crawling a web site the user owns. This must be be set to `true` - * when a **gateway_id** is specied in the **credentials**. - * - * @return the overrideRobotsTxt - */ - public Boolean overrideRobotsTxt() { - return overrideRobotsTxt; - } - - /** - * Gets the blacklist. - * - *

Array of URL's to be excluded while crawling. The crawler will not follow links which - * contains this string. For example, listing `https://ibm.com/watson` also excludes - * `https://ibm.com/watson/discovery`. - * - * @return the blacklist - */ - public List blacklist() { - return blacklist; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceSchedule.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceSchedule.java deleted file mode 100644 index dd2f36a7166..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceSchedule.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object containing the schedule information for the source. */ -public class SourceSchedule extends GenericModel { - - /** - * The crawl schedule in the specified **time_zone**. - * - *

- `five_minutes`: Runs every five minutes. - `hourly`: Runs every hour. - `daily`: Runs - * every day between 00:00 and 06:00. - `weekly`: Runs every week on Sunday between 00:00 and - * 06:00. - `monthly`: Runs the on the first Sunday of every month between 00:00 and 06:00. - */ - public interface Frequency { - /** daily. */ - String DAILY = "daily"; - /** weekly. */ - String WEEKLY = "weekly"; - /** monthly. */ - String MONTHLY = "monthly"; - /** five_minutes. */ - String FIVE_MINUTES = "five_minutes"; - /** hourly. */ - String HOURLY = "hourly"; - } - - protected Boolean enabled; - - @SerializedName("time_zone") - protected String timeZone; - - protected String frequency; - - /** Builder. */ - public static class Builder { - private Boolean enabled; - private String timeZone; - private String frequency; - - /** - * Instantiates a new Builder from an existing SourceSchedule instance. - * - * @param sourceSchedule the instance to initialize the Builder with - */ - private Builder(SourceSchedule sourceSchedule) { - this.enabled = sourceSchedule.enabled; - this.timeZone = sourceSchedule.timeZone; - this.frequency = sourceSchedule.frequency; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a SourceSchedule. - * - * @return the new SourceSchedule instance - */ - public SourceSchedule build() { - return new SourceSchedule(this); - } - - /** - * Set the enabled. - * - * @param enabled the enabled - * @return the SourceSchedule builder - */ - public Builder enabled(Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Set the timeZone. - * - * @param timeZone the timeZone - * @return the SourceSchedule builder - */ - public Builder timeZone(String timeZone) { - this.timeZone = timeZone; - return this; - } - - /** - * Set the frequency. - * - * @param frequency the frequency - * @return the SourceSchedule builder - */ - public Builder frequency(String frequency) { - this.frequency = frequency; - return this; - } - } - - protected SourceSchedule() {} - - protected SourceSchedule(Builder builder) { - enabled = builder.enabled; - timeZone = builder.timeZone; - frequency = builder.frequency; - } - - /** - * New builder. - * - * @return a SourceSchedule builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the enabled. - * - *

When `true`, the source is re-crawled based on the **frequency** field in this object. When - * `false` the source is not re-crawled; When `false` and connecting to Salesforce the source is - * crawled annually. - * - * @return the enabled - */ - public Boolean enabled() { - return enabled; - } - - /** - * Gets the timeZone. - * - *

The time zone to base source crawl times on. Possible values correspond to the IANA - * (Internet Assigned Numbers Authority) time zones list. - * - * @return the timeZone - */ - public String timeZone() { - return timeZone; - } - - /** - * Gets the frequency. - * - *

The crawl schedule in the specified **time_zone**. - * - *

- `five_minutes`: Runs every five minutes. - `hourly`: Runs every hour. - `daily`: Runs - * every day between 00:00 and 06:00. - `weekly`: Runs every week on Sunday between 00:00 and - * 06:00. - `monthly`: Runs the on the first Sunday of every month between 00:00 and 06:00. - * - * @return the frequency - */ - public String frequency() { - return frequency; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceStatus.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceStatus.java deleted file mode 100644 index 7ddef6ab624..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceStatus.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Date; - -/** Object containing source crawl status information. */ -public class SourceStatus extends GenericModel { - - /** - * The current status of the source crawl for this collection. This field returns `not_configured` - * if the default configuration for this source does not have a **source** object defined. - * - *

- `running` indicates that a crawl to fetch more documents is in progress. - `complete` - * indicates that the crawl has completed with no errors. - `queued` indicates that the crawl has - * been paused by the system and will automatically restart when possible. - `unknown` indicates - * that an unidentified error has occured in the service. - */ - public interface Status { - /** running. */ - String RUNNING = "running"; - /** complete. */ - String COMPLETE = "complete"; - /** not_configured. */ - String NOT_CONFIGURED = "not_configured"; - /** queued. */ - String QUEUED = "queued"; - /** unknown. */ - String UNKNOWN = "unknown"; - } - - protected String status; - - @SerializedName("next_crawl") - protected Date nextCrawl; - - protected SourceStatus() {} - - /** - * Gets the status. - * - *

The current status of the source crawl for this collection. This field returns - * `not_configured` if the default configuration for this source does not have a **source** object - * defined. - * - *

- `running` indicates that a crawl to fetch more documents is in progress. - `complete` - * indicates that the crawl has completed with no errors. - `queued` indicates that the crawl has - * been paused by the system and will automatically restart when possible. - `unknown` indicates - * that an unidentified error has occured in the service. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the nextCrawl. - * - *

Date in `RFC 3339` format indicating the time of the next crawl attempt. - * - * @return the nextCrawl - */ - public Date getNextCrawl() { - return nextCrawl; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/StatusDetails.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/StatusDetails.java deleted file mode 100644 index 9dd5ad57020..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/StatusDetails.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object that contains details about the status of the authentication process. */ -public class StatusDetails extends GenericModel { - - protected Boolean authenticated; - - @SerializedName("error_message") - protected String errorMessage; - - /** Builder. */ - public static class Builder { - private Boolean authenticated; - private String errorMessage; - - /** - * Instantiates a new Builder from an existing StatusDetails instance. - * - * @param statusDetails the instance to initialize the Builder with - */ - private Builder(StatusDetails statusDetails) { - this.authenticated = statusDetails.authenticated; - this.errorMessage = statusDetails.errorMessage; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a StatusDetails. - * - * @return the new StatusDetails instance - */ - public StatusDetails build() { - return new StatusDetails(this); - } - - /** - * Set the authenticated. - * - * @param authenticated the authenticated - * @return the StatusDetails builder - */ - public Builder authenticated(Boolean authenticated) { - this.authenticated = authenticated; - return this; - } - - /** - * Set the errorMessage. - * - * @param errorMessage the errorMessage - * @return the StatusDetails builder - */ - public Builder errorMessage(String errorMessage) { - this.errorMessage = errorMessage; - return this; - } - } - - protected StatusDetails() {} - - protected StatusDetails(Builder builder) { - authenticated = builder.authenticated; - errorMessage = builder.errorMessage; - } - - /** - * New builder. - * - * @return a StatusDetails builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the authenticated. - * - *

Indicates whether the credential is accepted by the target data source. - * - * @return the authenticated - */ - public Boolean authenticated() { - return authenticated; - } - - /** - * Gets the errorMessage. - * - *

If `authenticated` is `false`, a message describes why authentication is unsuccessful. - * - * @return the errorMessage - */ - public String errorMessage() { - return errorMessage; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictRule.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictRule.java deleted file mode 100644 index 0533d82f96c..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictRule.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** An object defining a single tokenizaion rule. */ -public class TokenDictRule extends GenericModel { - - protected String text; - protected List tokens; - protected List readings; - - @SerializedName("part_of_speech") - protected String partOfSpeech; - - /** Builder. */ - public static class Builder { - private String text; - private List tokens; - private List readings; - private String partOfSpeech; - - /** - * Instantiates a new Builder from an existing TokenDictRule instance. - * - * @param tokenDictRule the instance to initialize the Builder with - */ - private Builder(TokenDictRule tokenDictRule) { - this.text = tokenDictRule.text; - this.tokens = tokenDictRule.tokens; - this.readings = tokenDictRule.readings; - this.partOfSpeech = tokenDictRule.partOfSpeech; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param text the text - * @param tokens the tokens - * @param partOfSpeech the partOfSpeech - */ - public Builder(String text, List tokens, String partOfSpeech) { - this.text = text; - this.tokens = tokens; - this.partOfSpeech = partOfSpeech; - } - - /** - * Builds a TokenDictRule. - * - * @return the new TokenDictRule instance - */ - public TokenDictRule build() { - return new TokenDictRule(this); - } - - /** - * Adds a new element to tokens. - * - * @param tokens the new element to be added - * @return the TokenDictRule builder - */ - public Builder addTokens(String tokens) { - com.ibm.cloud.sdk.core.util.Validator.notNull(tokens, "tokens cannot be null"); - if (this.tokens == null) { - this.tokens = new ArrayList(); - } - this.tokens.add(tokens); - return this; - } - - /** - * Adds a new element to readings. - * - * @param readings the new element to be added - * @return the TokenDictRule builder - */ - public Builder addReadings(String readings) { - com.ibm.cloud.sdk.core.util.Validator.notNull(readings, "readings cannot be null"); - if (this.readings == null) { - this.readings = new ArrayList(); - } - this.readings.add(readings); - return this; - } - - /** - * Set the text. - * - * @param text the text - * @return the TokenDictRule builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - - /** - * Set the tokens. Existing tokens will be replaced. - * - * @param tokens the tokens - * @return the TokenDictRule builder - */ - public Builder tokens(List tokens) { - this.tokens = tokens; - return this; - } - - /** - * Set the readings. Existing readings will be replaced. - * - * @param readings the readings - * @return the TokenDictRule builder - */ - public Builder readings(List readings) { - this.readings = readings; - return this; - } - - /** - * Set the partOfSpeech. - * - * @param partOfSpeech the partOfSpeech - * @return the TokenDictRule builder - */ - public Builder partOfSpeech(String partOfSpeech) { - this.partOfSpeech = partOfSpeech; - return this; - } - } - - protected TokenDictRule() {} - - protected TokenDictRule(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.text, "text cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.tokens, "tokens cannot be null"); - com.ibm.cloud.sdk.core.util.Validator.notNull( - builder.partOfSpeech, "partOfSpeech cannot be null"); - text = builder.text; - tokens = builder.tokens; - readings = builder.readings; - partOfSpeech = builder.partOfSpeech; - } - - /** - * New builder. - * - * @return a TokenDictRule builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the text. - * - *

The string to tokenize. - * - * @return the text - */ - public String text() { - return text; - } - - /** - * Gets the tokens. - * - *

Array of tokens that the `text` field is split into when found. - * - * @return the tokens - */ - public List tokens() { - return tokens; - } - - /** - * Gets the readings. - * - *

Array of tokens that represent the content of the `text` field in an alternate character - * set. - * - * @return the readings - */ - public List readings() { - return readings; - } - - /** - * Gets the partOfSpeech. - * - *

The part of speech that the `text` string belongs to. For example `noun`. Custom parts of - * speech can be specified. - * - * @return the partOfSpeech - */ - public String partOfSpeech() { - return partOfSpeech; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictStatusResponse.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictStatusResponse.java deleted file mode 100644 index e9748708582..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TokenDictStatusResponse.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Object describing the current status of the wordlist. */ -public class TokenDictStatusResponse extends GenericModel { - - /** Current wordlist status for the specified collection. */ - public interface Status { - /** active. */ - String ACTIVE = "active"; - /** pending. */ - String PENDING = "pending"; - /** not found. */ - String NOT_FOUND = "not found"; - } - - protected String status; - protected String type; - - protected TokenDictStatusResponse() {} - - /** - * Gets the status. - * - *

Current wordlist status for the specified collection. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Gets the type. - * - *

The type for this wordlist. Can be `tokenization_dictionary` or `stopwords`. - * - * @return the type - */ - public String getType() { - return type; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TopHitsResults.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TopHitsResults.java deleted file mode 100644 index 4f3147d3cfa..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TopHitsResults.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Top hit information for this query. */ -public class TopHitsResults extends GenericModel { - - @SerializedName("matching_results") - protected Long matchingResults; - - protected List hits; - - /** - * Gets the matchingResults. - * - *

Number of matching results. - * - * @return the matchingResults - */ - public Long getMatchingResults() { - return matchingResults; - } - - /** - * Gets the hits. - * - *

Top results returned by the aggregation. - * - * @return the hits - */ - public List getHits() { - return hits; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingDataSet.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingDataSet.java deleted file mode 100644 index 65b9f94e15f..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingDataSet.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Training information for a specific collection. */ -public class TrainingDataSet extends GenericModel { - - @SerializedName("environment_id") - protected String environmentId; - - @SerializedName("collection_id") - protected String collectionId; - - protected List queries; - - protected TrainingDataSet() {} - - /** - * Gets the environmentId. - * - *

The environment id associated with this training data set. - * - * @return the environmentId - */ - public String getEnvironmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The collection id associated with this training data set. - * - * @return the collectionId - */ - public String getCollectionId() { - return collectionId; - } - - /** - * Gets the queries. - * - *

Array of training queries. At least 50 queries are required for training to begin. A maximum - * of 10,000 queries are returned. - * - * @return the queries - */ - public List getQueries() { - return queries; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExample.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExample.java deleted file mode 100644 index 1de799911c3..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExample.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** Training example details. */ -public class TrainingExample extends GenericModel { - - @SerializedName("document_id") - protected String documentId; - - @SerializedName("cross_reference") - protected String crossReference; - - protected Long relevance; - - /** Builder. */ - public static class Builder { - private String documentId; - private String crossReference; - private Long relevance; - - /** - * Instantiates a new Builder from an existing TrainingExample instance. - * - * @param trainingExample the instance to initialize the Builder with - */ - private Builder(TrainingExample trainingExample) { - this.documentId = trainingExample.documentId; - this.crossReference = trainingExample.crossReference; - this.relevance = trainingExample.relevance; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a TrainingExample. - * - * @return the new TrainingExample instance - */ - public TrainingExample build() { - return new TrainingExample(this); - } - - /** - * Set the documentId. - * - * @param documentId the documentId - * @return the TrainingExample builder - */ - public Builder documentId(String documentId) { - this.documentId = documentId; - return this; - } - - /** - * Set the crossReference. - * - * @param crossReference the crossReference - * @return the TrainingExample builder - */ - public Builder crossReference(String crossReference) { - this.crossReference = crossReference; - return this; - } - - /** - * Set the relevance. - * - * @param relevance the relevance - * @return the TrainingExample builder - */ - public Builder relevance(long relevance) { - this.relevance = relevance; - return this; - } - } - - protected TrainingExample() {} - - protected TrainingExample(Builder builder) { - documentId = builder.documentId; - crossReference = builder.crossReference; - relevance = builder.relevance; - } - - /** - * New builder. - * - * @return a TrainingExample builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the documentId. - * - *

The document ID associated with this training example. - * - * @return the documentId - */ - public String documentId() { - return documentId; - } - - /** - * Gets the crossReference. - * - *

The cross reference associated with this training example. - * - * @return the crossReference - */ - public String crossReference() { - return crossReference; - } - - /** - * Gets the relevance. - * - *

The relevance of the training example. - * - * @return the relevance - */ - public Long relevance() { - return relevance; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExampleList.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExampleList.java deleted file mode 100644 index c86eeebecf8..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingExampleList.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Object containing an array of training examples. */ -public class TrainingExampleList extends GenericModel { - - protected List examples; - - protected TrainingExampleList() {} - - /** - * Gets the examples. - * - *

Array of training examples. - * - * @return the examples - */ - public List getExamples() { - return examples; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingQuery.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingQuery.java deleted file mode 100644 index ec7c32e5ff3..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingQuery.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.List; - -/** Training query details. */ -public class TrainingQuery extends GenericModel { - - @SerializedName("query_id") - protected String queryId; - - @SerializedName("natural_language_query") - protected String naturalLanguageQuery; - - protected String filter; - protected List examples; - - protected TrainingQuery() {} - - /** - * Gets the queryId. - * - *

The query ID associated with the training query. - * - * @return the queryId - */ - public String getQueryId() { - return queryId; - } - - /** - * Gets the naturalLanguageQuery. - * - *

The natural text query for the training query. - * - * @return the naturalLanguageQuery - */ - public String getNaturalLanguageQuery() { - return naturalLanguageQuery; - } - - /** - * Gets the filter. - * - *

The filter used on the collection before the **natural_language_query** is applied. - * - * @return the filter - */ - public String getFilter() { - return filter; - } - - /** - * Gets the examples. - * - *

Array of training examples. - * - * @return the examples - */ - public List getExamples() { - return examples; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingStatus.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingStatus.java deleted file mode 100644 index ceea5c0f367..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/TrainingStatus.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.google.gson.annotations.SerializedName; -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.Date; - -/** Training status details. */ -public class TrainingStatus extends GenericModel { - - @SerializedName("total_examples") - protected Long totalExamples; - - protected Boolean available; - protected Boolean processing; - - @SerializedName("minimum_queries_added") - protected Boolean minimumQueriesAdded; - - @SerializedName("minimum_examples_added") - protected Boolean minimumExamplesAdded; - - @SerializedName("sufficient_label_diversity") - protected Boolean sufficientLabelDiversity; - - protected Long notices; - - @SerializedName("successfully_trained") - protected Date successfullyTrained; - - @SerializedName("data_updated") - protected Date dataUpdated; - - protected TrainingStatus() {} - - /** - * Gets the totalExamples. - * - *

The total number of training examples uploaded to this collection. - * - * @return the totalExamples - */ - public Long getTotalExamples() { - return totalExamples; - } - - /** - * Gets the available. - * - *

When `true`, the collection has been successfully trained. - * - * @return the available - */ - public Boolean isAvailable() { - return available; - } - - /** - * Gets the processing. - * - *

When `true`, the collection is currently processing training. - * - * @return the processing - */ - public Boolean isProcessing() { - return processing; - } - - /** - * Gets the minimumQueriesAdded. - * - *

When `true`, the collection has a sufficent amount of queries added for training to occur. - * - * @return the minimumQueriesAdded - */ - public Boolean isMinimumQueriesAdded() { - return minimumQueriesAdded; - } - - /** - * Gets the minimumExamplesAdded. - * - *

When `true`, the collection has a sufficent amount of examples added for training to occur. - * - * @return the minimumExamplesAdded - */ - public Boolean isMinimumExamplesAdded() { - return minimumExamplesAdded; - } - - /** - * Gets the sufficientLabelDiversity. - * - *

When `true`, the collection has a sufficent amount of diversity in labeled results for - * training to occur. - * - * @return the sufficientLabelDiversity - */ - public Boolean isSufficientLabelDiversity() { - return sufficientLabelDiversity; - } - - /** - * Gets the notices. - * - *

The number of notices associated with this data set. - * - * @return the notices - */ - public Long getNotices() { - return notices; - } - - /** - * Gets the successfullyTrained. - * - *

The timestamp of when the collection was successfully trained. - * - * @return the successfullyTrained - */ - public Date getSuccessfullyTrained() { - return successfullyTrained; - } - - /** - * Gets the dataUpdated. - * - *

The timestamp of when the data was uploaded. - * - * @return the dataUpdated - */ - public Date getDataUpdated() { - return dataUpdated; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCollectionOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCollectionOptions.java deleted file mode 100644 index 2f636c11bde..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCollectionOptions.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The updateCollection options. */ -public class UpdateCollectionOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String name; - protected String description; - protected String configurationId; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String name; - private String description; - private String configurationId; - - /** - * Instantiates a new Builder from an existing UpdateCollectionOptions instance. - * - * @param updateCollectionOptions the instance to initialize the Builder with - */ - private Builder(UpdateCollectionOptions updateCollectionOptions) { - this.environmentId = updateCollectionOptions.environmentId; - this.collectionId = updateCollectionOptions.collectionId; - this.name = updateCollectionOptions.name; - this.description = updateCollectionOptions.description; - this.configurationId = updateCollectionOptions.configurationId; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param name the name - */ - public Builder(String environmentId, String collectionId, String name) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.name = name; - } - - /** - * Builds a UpdateCollectionOptions. - * - * @return the new UpdateCollectionOptions instance - */ - public UpdateCollectionOptions build() { - return new UpdateCollectionOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the UpdateCollectionOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the UpdateCollectionOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the UpdateCollectionOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the UpdateCollectionOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the configurationId. - * - * @param configurationId the configurationId - * @return the UpdateCollectionOptions builder - */ - public Builder configurationId(String configurationId) { - this.configurationId = configurationId; - return this; - } - } - - protected UpdateCollectionOptions() {} - - protected UpdateCollectionOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, "name cannot be null"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - name = builder.name; - description = builder.description; - configurationId = builder.configurationId; - } - - /** - * New builder. - * - * @return a UpdateCollectionOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the name. - * - *

The name of the collection. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - *

A description of the collection. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the configurationId. - * - *

The ID of the configuration in which the collection is to be updated. - * - * @return the configurationId - */ - public String configurationId() { - return configurationId; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateConfigurationOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateConfigurationOptions.java deleted file mode 100644 index 93c343f47f6..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateConfigurationOptions.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** The updateConfiguration options. */ -public class UpdateConfigurationOptions extends GenericModel { - - protected String environmentId; - protected String configurationId; - protected String name; - protected String description; - protected Conversions conversions; - protected List enrichments; - protected List normalizations; - protected Source source; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String configurationId; - private String name; - private String description; - private Conversions conversions; - private List enrichments; - private List normalizations; - private Source source; - - /** - * Instantiates a new Builder from an existing UpdateConfigurationOptions instance. - * - * @param updateConfigurationOptions the instance to initialize the Builder with - */ - private Builder(UpdateConfigurationOptions updateConfigurationOptions) { - this.environmentId = updateConfigurationOptions.environmentId; - this.configurationId = updateConfigurationOptions.configurationId; - this.name = updateConfigurationOptions.name; - this.description = updateConfigurationOptions.description; - this.conversions = updateConfigurationOptions.conversions; - this.enrichments = updateConfigurationOptions.enrichments; - this.normalizations = updateConfigurationOptions.normalizations; - this.source = updateConfigurationOptions.source; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param configurationId the configurationId - * @param name the name - */ - public Builder(String environmentId, String configurationId, String name) { - this.environmentId = environmentId; - this.configurationId = configurationId; - this.name = name; - } - - /** - * Builds a UpdateConfigurationOptions. - * - * @return the new UpdateConfigurationOptions instance - */ - public UpdateConfigurationOptions build() { - return new UpdateConfigurationOptions(this); - } - - /** - * Adds a new element to enrichments. - * - * @param enrichment the new element to be added - * @return the UpdateConfigurationOptions builder - */ - public Builder addEnrichment(Enrichment enrichment) { - com.ibm.cloud.sdk.core.util.Validator.notNull(enrichment, "enrichment cannot be null"); - if (this.enrichments == null) { - this.enrichments = new ArrayList(); - } - this.enrichments.add(enrichment); - return this; - } - - /** - * Adds a new element to normalizations. - * - * @param normalization the new element to be added - * @return the UpdateConfigurationOptions builder - */ - public Builder addNormalization(NormalizationOperation normalization) { - com.ibm.cloud.sdk.core.util.Validator.notNull(normalization, "normalization cannot be null"); - if (this.normalizations == null) { - this.normalizations = new ArrayList(); - } - this.normalizations.add(normalization); - return this; - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the UpdateConfigurationOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the configurationId. - * - * @param configurationId the configurationId - * @return the UpdateConfigurationOptions builder - */ - public Builder configurationId(String configurationId) { - this.configurationId = configurationId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the UpdateConfigurationOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the UpdateConfigurationOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the conversions. - * - * @param conversions the conversions - * @return the UpdateConfigurationOptions builder - */ - public Builder conversions(Conversions conversions) { - this.conversions = conversions; - return this; - } - - /** - * Set the enrichments. Existing enrichments will be replaced. - * - * @param enrichments the enrichments - * @return the UpdateConfigurationOptions builder - */ - public Builder enrichments(List enrichments) { - this.enrichments = enrichments; - return this; - } - - /** - * Set the normalizations. Existing normalizations will be replaced. - * - * @param normalizations the normalizations - * @return the UpdateConfigurationOptions builder - */ - public Builder normalizations(List normalizations) { - this.normalizations = normalizations; - return this; - } - - /** - * Set the source. - * - * @param source the source - * @return the UpdateConfigurationOptions builder - */ - public Builder source(Source source) { - this.source = source; - return this; - } - - /** - * Set the configuration. - * - * @param configuration the configuration - * @return the UpdateConfigurationOptions builder - */ - public Builder configuration(Configuration configuration) { - this.name = configuration.name(); - this.description = configuration.description(); - this.conversions = configuration.conversions(); - this.enrichments = configuration.enrichments(); - this.normalizations = configuration.normalizations(); - this.source = configuration.source(); - return this; - } - } - - protected UpdateConfigurationOptions() {} - - protected UpdateConfigurationOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.configurationId, "configurationId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notNull(builder.name, "name cannot be null"); - environmentId = builder.environmentId; - configurationId = builder.configurationId; - name = builder.name; - description = builder.description; - conversions = builder.conversions; - enrichments = builder.enrichments; - normalizations = builder.normalizations; - source = builder.source; - } - - /** - * New builder. - * - * @return a UpdateConfigurationOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the configurationId. - * - *

The ID of the configuration. - * - * @return the configurationId - */ - public String configurationId() { - return configurationId; - } - - /** - * Gets the name. - * - *

The name of the configuration. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - *

The description of the configuration, if available. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the conversions. - * - *

Document conversion settings. - * - * @return the conversions - */ - public Conversions conversions() { - return conversions; - } - - /** - * Gets the enrichments. - * - *

An array of document enrichment settings for the configuration. - * - * @return the enrichments - */ - public List enrichments() { - return enrichments; - } - - /** - * Gets the normalizations. - * - *

Defines operations that can be used to transform the final output JSON into a normalized - * form. Operations are executed in the order that they appear in the array. - * - * @return the normalizations - */ - public List normalizations() { - return normalizations; - } - - /** - * Gets the source. - * - *

Object containing source parameters for the configuration. - * - * @return the source - */ - public Source source() { - return source; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptions.java deleted file mode 100644 index 02c906333e4..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptions.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2018, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The updateCredentials options. */ -public class UpdateCredentialsOptions extends GenericModel { - - /** - * The source that this credentials object connects to. - `box` indicates the credentials are used - * to connect an instance of Enterprise Box. - `salesforce` indicates the credentials are used to - * connect to Salesforce. - `sharepoint` indicates the credentials are used to connect to - * Microsoft SharePoint Online. - `web_crawl` indicates the credentials are used to perform a web - * crawl. = `cloud_object_storage` indicates the credentials are used to connect to an IBM Cloud - * Object Store. - */ - public interface SourceType { - /** box. */ - String BOX = "box"; - /** salesforce. */ - String SALESFORCE = "salesforce"; - /** sharepoint. */ - String SHAREPOINT = "sharepoint"; - /** web_crawl. */ - String WEB_CRAWL = "web_crawl"; - /** cloud_object_storage. */ - String CLOUD_OBJECT_STORAGE = "cloud_object_storage"; - } - - protected String environmentId; - protected String credentialId; - protected String sourceType; - protected CredentialDetails credentialDetails; - protected StatusDetails status; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String credentialId; - private String sourceType; - private CredentialDetails credentialDetails; - private StatusDetails status; - - /** - * Instantiates a new Builder from an existing UpdateCredentialsOptions instance. - * - * @param updateCredentialsOptions the instance to initialize the Builder with - */ - private Builder(UpdateCredentialsOptions updateCredentialsOptions) { - this.environmentId = updateCredentialsOptions.environmentId; - this.credentialId = updateCredentialsOptions.credentialId; - this.sourceType = updateCredentialsOptions.sourceType; - this.credentialDetails = updateCredentialsOptions.credentialDetails; - this.status = updateCredentialsOptions.status; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param credentialId the credentialId - */ - public Builder(String environmentId, String credentialId) { - this.environmentId = environmentId; - this.credentialId = credentialId; - } - - /** - * Builds a UpdateCredentialsOptions. - * - * @return the new UpdateCredentialsOptions instance - */ - public UpdateCredentialsOptions build() { - return new UpdateCredentialsOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the UpdateCredentialsOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the credentialId. - * - * @param credentialId the credentialId - * @return the UpdateCredentialsOptions builder - */ - public Builder credentialId(String credentialId) { - this.credentialId = credentialId; - return this; - } - - /** - * Set the sourceType. - * - * @param sourceType the sourceType - * @return the UpdateCredentialsOptions builder - */ - public Builder sourceType(String sourceType) { - this.sourceType = sourceType; - return this; - } - - /** - * Set the credentialDetails. - * - * @param credentialDetails the credentialDetails - * @return the UpdateCredentialsOptions builder - */ - public Builder credentialDetails(CredentialDetails credentialDetails) { - this.credentialDetails = credentialDetails; - return this; - } - - /** - * Set the status. - * - * @param status the status - * @return the UpdateCredentialsOptions builder - */ - public Builder status(StatusDetails status) { - this.status = status; - return this; - } - - /** - * Set the credentials. - * - * @param credentials the credentials - * @return the UpdateCredentialsOptions builder - */ - public Builder credentials(Credentials credentials) { - this.sourceType = credentials.sourceType(); - this.credentialDetails = credentials.credentialDetails(); - this.status = credentials.status(); - return this; - } - } - - protected UpdateCredentialsOptions() {} - - protected UpdateCredentialsOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.credentialId, "credentialId cannot be empty"); - environmentId = builder.environmentId; - credentialId = builder.credentialId; - sourceType = builder.sourceType; - credentialDetails = builder.credentialDetails; - status = builder.status; - } - - /** - * New builder. - * - * @return a UpdateCredentialsOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the credentialId. - * - *

The unique identifier for a set of source credentials. - * - * @return the credentialId - */ - public String credentialId() { - return credentialId; - } - - /** - * Gets the sourceType. - * - *

The source that this credentials object connects to. - `box` indicates the credentials are - * used to connect an instance of Enterprise Box. - `salesforce` indicates the credentials are - * used to connect to Salesforce. - `sharepoint` indicates the credentials are used to connect to - * Microsoft SharePoint Online. - `web_crawl` indicates the credentials are used to perform a web - * crawl. = `cloud_object_storage` indicates the credentials are used to connect to an IBM Cloud - * Object Store. - * - * @return the sourceType - */ - public String sourceType() { - return sourceType; - } - - /** - * Gets the credentialDetails. - * - *

Object containing details of the stored credentials. - * - *

Obtain credentials for your source from the administrator of the source. - * - * @return the credentialDetails - */ - public CredentialDetails credentialDetails() { - return credentialDetails; - } - - /** - * Gets the status. - * - *

Object that contains details about the status of the authentication process. - * - * @return the status - */ - public StatusDetails status() { - return status; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateDocumentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateDocumentOptions.java deleted file mode 100644 index e6bda70ece7..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateDocumentOptions.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; - -/** The updateDocument options. */ -public class UpdateDocumentOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String documentId; - protected InputStream file; - protected String filename; - protected String fileContentType; - protected String metadata; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String documentId; - private InputStream file; - private String filename; - private String fileContentType; - private String metadata; - - /** - * Instantiates a new Builder from an existing UpdateDocumentOptions instance. - * - * @param updateDocumentOptions the instance to initialize the Builder with - */ - private Builder(UpdateDocumentOptions updateDocumentOptions) { - this.environmentId = updateDocumentOptions.environmentId; - this.collectionId = updateDocumentOptions.collectionId; - this.documentId = updateDocumentOptions.documentId; - this.file = updateDocumentOptions.file; - this.filename = updateDocumentOptions.filename; - this.fileContentType = updateDocumentOptions.fileContentType; - this.metadata = updateDocumentOptions.metadata; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param documentId the documentId - */ - public Builder(String environmentId, String collectionId, String documentId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.documentId = documentId; - } - - /** - * Builds a UpdateDocumentOptions. - * - * @return the new UpdateDocumentOptions instance - */ - public UpdateDocumentOptions build() { - return new UpdateDocumentOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the UpdateDocumentOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the UpdateDocumentOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the documentId. - * - * @param documentId the documentId - * @return the UpdateDocumentOptions builder - */ - public Builder documentId(String documentId) { - this.documentId = documentId; - return this; - } - - /** - * Set the file. - * - * @param file the file - * @return the UpdateDocumentOptions builder - */ - public Builder file(InputStream file) { - this.file = file; - return this; - } - - /** - * Set the filename. - * - * @param filename the filename - * @return the UpdateDocumentOptions builder - */ - public Builder filename(String filename) { - this.filename = filename; - return this; - } - - /** - * Set the fileContentType. - * - * @param fileContentType the fileContentType - * @return the UpdateDocumentOptions builder - */ - public Builder fileContentType(String fileContentType) { - this.fileContentType = fileContentType; - return this; - } - - /** - * Set the metadata. - * - * @param metadata the metadata - * @return the UpdateDocumentOptions builder - */ - public Builder metadata(String metadata) { - this.metadata = metadata; - return this; - } - - /** - * Set the file. - * - * @param file the file - * @return the UpdateDocumentOptions builder - * @throws FileNotFoundException if the file could not be found - */ - public Builder file(File file) throws FileNotFoundException { - this.file = new FileInputStream(file); - this.filename = file.getName(); - return this; - } - } - - protected UpdateDocumentOptions() {} - - protected UpdateDocumentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.documentId, "documentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.isTrue( - (builder.file == null) || (builder.filename != null), - "filename cannot be null if file is not null."); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - documentId = builder.documentId; - file = builder.file; - filename = builder.filename; - fileContentType = builder.fileContentType; - metadata = builder.metadata; - } - - /** - * New builder. - * - * @return a UpdateDocumentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the documentId. - * - *

The ID of the document. - * - * @return the documentId - */ - public String documentId() { - return documentId; - } - - /** - * Gets the file. - * - *

The content of the document to ingest. The maximum supported file size when adding a file to - * a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 - * megabyte. Files larger than the supported size are rejected. - * - * @return the file - */ - public InputStream file() { - return file; - } - - /** - * Gets the filename. - * - *

The filename for file. - * - * @return the filename - */ - public String filename() { - return filename; - } - - /** - * Gets the fileContentType. - * - *

The content type of file. Values for this parameter can be obtained from the HttpMediaType - * class. - * - * @return the fileContentType - */ - public String fileContentType() { - return fileContentType; - } - - /** - * Gets the metadata. - * - *

The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are - * rejected. Example: ``` { "Creator": "Johnny Appleseed", "Subject": "Apples" } ```. - * - * @return the metadata - */ - public String metadata() { - return metadata; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateEnvironmentOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateEnvironmentOptions.java deleted file mode 100644 index 930d02e74fa..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateEnvironmentOptions.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The updateEnvironment options. */ -public class UpdateEnvironmentOptions extends GenericModel { - - /** - * Size to change the environment to. **Note:** Lite plan users cannot change the environment - * size. - */ - public interface Size { - /** S. */ - String S = "S"; - /** MS. */ - String MS = "MS"; - /** M. */ - String M = "M"; - /** ML. */ - String ML = "ML"; - /** L. */ - String L = "L"; - /** XL. */ - String XL = "XL"; - /** XXL. */ - String XXL = "XXL"; - /** XXXL. */ - String XXXL = "XXXL"; - } - - protected String environmentId; - protected String name; - protected String description; - protected String size; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String name; - private String description; - private String size; - - /** - * Instantiates a new Builder from an existing UpdateEnvironmentOptions instance. - * - * @param updateEnvironmentOptions the instance to initialize the Builder with - */ - private Builder(UpdateEnvironmentOptions updateEnvironmentOptions) { - this.environmentId = updateEnvironmentOptions.environmentId; - this.name = updateEnvironmentOptions.name; - this.description = updateEnvironmentOptions.description; - this.size = updateEnvironmentOptions.size; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - */ - public Builder(String environmentId) { - this.environmentId = environmentId; - } - - /** - * Builds a UpdateEnvironmentOptions. - * - * @return the new UpdateEnvironmentOptions instance - */ - public UpdateEnvironmentOptions build() { - return new UpdateEnvironmentOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the UpdateEnvironmentOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the name. - * - * @param name the name - * @return the UpdateEnvironmentOptions builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Set the description. - * - * @param description the description - * @return the UpdateEnvironmentOptions builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Set the size. - * - * @param size the size - * @return the UpdateEnvironmentOptions builder - */ - public Builder size(String size) { - this.size = size; - return this; - } - } - - protected UpdateEnvironmentOptions() {} - - protected UpdateEnvironmentOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - environmentId = builder.environmentId; - name = builder.name; - description = builder.description; - size = builder.size; - } - - /** - * New builder. - * - * @return a UpdateEnvironmentOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the name. - * - *

Name that identifies the environment. - * - * @return the name - */ - public String name() { - return name; - } - - /** - * Gets the description. - * - *

Description of the environment. - * - * @return the description - */ - public String description() { - return description; - } - - /** - * Gets the size. - * - *

Size to change the environment to. **Note:** Lite plan users cannot change the environment - * size. - * - * @return the size - */ - public String size() { - return size; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateTrainingExampleOptions.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateTrainingExampleOptions.java deleted file mode 100644 index a2f9d197b9c..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/UpdateTrainingExampleOptions.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** The updateTrainingExample options. */ -public class UpdateTrainingExampleOptions extends GenericModel { - - protected String environmentId; - protected String collectionId; - protected String queryId; - protected String exampleId; - protected String crossReference; - protected Long relevance; - - /** Builder. */ - public static class Builder { - private String environmentId; - private String collectionId; - private String queryId; - private String exampleId; - private String crossReference; - private Long relevance; - - /** - * Instantiates a new Builder from an existing UpdateTrainingExampleOptions instance. - * - * @param updateTrainingExampleOptions the instance to initialize the Builder with - */ - private Builder(UpdateTrainingExampleOptions updateTrainingExampleOptions) { - this.environmentId = updateTrainingExampleOptions.environmentId; - this.collectionId = updateTrainingExampleOptions.collectionId; - this.queryId = updateTrainingExampleOptions.queryId; - this.exampleId = updateTrainingExampleOptions.exampleId; - this.crossReference = updateTrainingExampleOptions.crossReference; - this.relevance = updateTrainingExampleOptions.relevance; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Instantiates a new builder with required properties. - * - * @param environmentId the environmentId - * @param collectionId the collectionId - * @param queryId the queryId - * @param exampleId the exampleId - */ - public Builder(String environmentId, String collectionId, String queryId, String exampleId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.queryId = queryId; - this.exampleId = exampleId; - } - - /** - * Builds a UpdateTrainingExampleOptions. - * - * @return the new UpdateTrainingExampleOptions instance - */ - public UpdateTrainingExampleOptions build() { - return new UpdateTrainingExampleOptions(this); - } - - /** - * Set the environmentId. - * - * @param environmentId the environmentId - * @return the UpdateTrainingExampleOptions builder - */ - public Builder environmentId(String environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Set the collectionId. - * - * @param collectionId the collectionId - * @return the UpdateTrainingExampleOptions builder - */ - public Builder collectionId(String collectionId) { - this.collectionId = collectionId; - return this; - } - - /** - * Set the queryId. - * - * @param queryId the queryId - * @return the UpdateTrainingExampleOptions builder - */ - public Builder queryId(String queryId) { - this.queryId = queryId; - return this; - } - - /** - * Set the exampleId. - * - * @param exampleId the exampleId - * @return the UpdateTrainingExampleOptions builder - */ - public Builder exampleId(String exampleId) { - this.exampleId = exampleId; - return this; - } - - /** - * Set the crossReference. - * - * @param crossReference the crossReference - * @return the UpdateTrainingExampleOptions builder - */ - public Builder crossReference(String crossReference) { - this.crossReference = crossReference; - return this; - } - - /** - * Set the relevance. - * - * @param relevance the relevance - * @return the UpdateTrainingExampleOptions builder - */ - public Builder relevance(long relevance) { - this.relevance = relevance; - return this; - } - } - - protected UpdateTrainingExampleOptions() {} - - protected UpdateTrainingExampleOptions(Builder builder) { - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.environmentId, "environmentId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty( - builder.collectionId, "collectionId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.queryId, "queryId cannot be empty"); - com.ibm.cloud.sdk.core.util.Validator.notEmpty(builder.exampleId, "exampleId cannot be empty"); - environmentId = builder.environmentId; - collectionId = builder.collectionId; - queryId = builder.queryId; - exampleId = builder.exampleId; - crossReference = builder.crossReference; - relevance = builder.relevance; - } - - /** - * New builder. - * - * @return a UpdateTrainingExampleOptions builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the environmentId. - * - *

The ID of the environment. - * - * @return the environmentId - */ - public String environmentId() { - return environmentId; - } - - /** - * Gets the collectionId. - * - *

The ID of the collection. - * - * @return the collectionId - */ - public String collectionId() { - return collectionId; - } - - /** - * Gets the queryId. - * - *

The ID of the query used for training. - * - * @return the queryId - */ - public String queryId() { - return queryId; - } - - /** - * Gets the exampleId. - * - *

The ID of the document as it is indexed. - * - * @return the exampleId - */ - public String exampleId() { - return exampleId; - } - - /** - * Gets the crossReference. - * - *

The example to add. - * - * @return the crossReference - */ - public String crossReference() { - return crossReference; - } - - /** - * Gets the relevance. - * - *

The relevance value for this example. - * - * @return the relevance - */ - public Long relevance() { - return relevance; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordHeadingDetection.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordHeadingDetection.java deleted file mode 100644 index bf3d38a458e..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordHeadingDetection.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** Object containing heading detection conversion settings for Microsoft Word documents. */ -public class WordHeadingDetection extends GenericModel { - - protected List fonts; - protected List styles; - - /** Builder. */ - public static class Builder { - private List fonts; - private List styles; - - /** - * Instantiates a new Builder from an existing WordHeadingDetection instance. - * - * @param wordHeadingDetection the instance to initialize the Builder with - */ - private Builder(WordHeadingDetection wordHeadingDetection) { - this.fonts = wordHeadingDetection.fonts; - this.styles = wordHeadingDetection.styles; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a WordHeadingDetection. - * - * @return the new WordHeadingDetection instance - */ - public WordHeadingDetection build() { - return new WordHeadingDetection(this); - } - - /** - * Adds a new element to fonts. - * - * @param fontSetting the new element to be added - * @return the WordHeadingDetection builder - */ - public Builder addFontSetting(FontSetting fontSetting) { - com.ibm.cloud.sdk.core.util.Validator.notNull(fontSetting, "fontSetting cannot be null"); - if (this.fonts == null) { - this.fonts = new ArrayList(); - } - this.fonts.add(fontSetting); - return this; - } - - /** - * Adds a new element to styles. - * - * @param wordStyle the new element to be added - * @return the WordHeadingDetection builder - */ - public Builder addWordStyle(WordStyle wordStyle) { - com.ibm.cloud.sdk.core.util.Validator.notNull(wordStyle, "wordStyle cannot be null"); - if (this.styles == null) { - this.styles = new ArrayList(); - } - this.styles.add(wordStyle); - return this; - } - - /** - * Set the fonts. Existing fonts will be replaced. - * - * @param fonts the fonts - * @return the WordHeadingDetection builder - */ - public Builder fonts(List fonts) { - this.fonts = fonts; - return this; - } - - /** - * Set the styles. Existing styles will be replaced. - * - * @param styles the styles - * @return the WordHeadingDetection builder - */ - public Builder styles(List styles) { - this.styles = styles; - return this; - } - } - - protected WordHeadingDetection() {} - - protected WordHeadingDetection(Builder builder) { - fonts = builder.fonts; - styles = builder.styles; - } - - /** - * New builder. - * - * @return a WordHeadingDetection builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the fonts. - * - *

Array of font matching configurations. - * - * @return the fonts - */ - public List fonts() { - return fonts; - } - - /** - * Gets the styles. - * - *

Array of Microsoft Word styles to convert. - * - * @return the styles - */ - public List styles() { - return styles; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordSettings.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordSettings.java deleted file mode 100644 index 858ae9a60cf..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordSettings.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; - -/** A list of Word conversion settings. */ -public class WordSettings extends GenericModel { - - protected WordHeadingDetection heading; - - /** Builder. */ - public static class Builder { - private WordHeadingDetection heading; - - /** - * Instantiates a new Builder from an existing WordSettings instance. - * - * @param wordSettings the instance to initialize the Builder with - */ - private Builder(WordSettings wordSettings) { - this.heading = wordSettings.heading; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a WordSettings. - * - * @return the new WordSettings instance - */ - public WordSettings build() { - return new WordSettings(this); - } - - /** - * Set the heading. - * - * @param heading the heading - * @return the WordSettings builder - */ - public Builder heading(WordHeadingDetection heading) { - this.heading = heading; - return this; - } - } - - protected WordSettings() {} - - protected WordSettings(Builder builder) { - heading = builder.heading; - } - - /** - * New builder. - * - * @return a WordSettings builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the heading. - * - *

Object containing heading detection conversion settings for Microsoft Word documents. - * - * @return the heading - */ - public WordHeadingDetection heading() { - return heading; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordStyle.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordStyle.java deleted file mode 100644 index 64994622932..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/WordStyle.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2017, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** Microsoft Word styles to convert into a specified HTML head level. */ -public class WordStyle extends GenericModel { - - protected Long level; - protected List names; - - /** Builder. */ - public static class Builder { - private Long level; - private List names; - - /** - * Instantiates a new Builder from an existing WordStyle instance. - * - * @param wordStyle the instance to initialize the Builder with - */ - private Builder(WordStyle wordStyle) { - this.level = wordStyle.level; - this.names = wordStyle.names; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a WordStyle. - * - * @return the new WordStyle instance - */ - public WordStyle build() { - return new WordStyle(this); - } - - /** - * Adds a new element to names. - * - * @param names the new element to be added - * @return the WordStyle builder - */ - public Builder addNames(String names) { - com.ibm.cloud.sdk.core.util.Validator.notNull(names, "names cannot be null"); - if (this.names == null) { - this.names = new ArrayList(); - } - this.names.add(names); - return this; - } - - /** - * Set the level. - * - * @param level the level - * @return the WordStyle builder - */ - public Builder level(long level) { - this.level = level; - return this; - } - - /** - * Set the names. Existing names will be replaced. - * - * @param names the names - * @return the WordStyle builder - */ - public Builder names(List names) { - this.names = names; - return this; - } - } - - protected WordStyle() {} - - protected WordStyle(Builder builder) { - level = builder.level; - names = builder.names; - } - - /** - * New builder. - * - * @return a WordStyle builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the level. - * - *

HTML head level that content matching this style is tagged with. - * - * @return the level - */ - public Long level() { - return level; - } - - /** - * Gets the names. - * - *

Array of word style names to convert. - * - * @return the names - */ - public List names() { - return names; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/XPathPatterns.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/model/XPathPatterns.java deleted file mode 100644 index af4b0b123eb..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/model/XPathPatterns.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.model; - -import com.ibm.cloud.sdk.core.service.model.GenericModel; -import java.util.ArrayList; -import java.util.List; - -/** Object containing an array of XPaths. */ -public class XPathPatterns extends GenericModel { - - protected List xpaths; - - /** Builder. */ - public static class Builder { - private List xpaths; - - /** - * Instantiates a new Builder from an existing XPathPatterns instance. - * - * @param xPathPatterns the instance to initialize the Builder with - */ - private Builder(XPathPatterns xPathPatterns) { - this.xpaths = xPathPatterns.xpaths; - } - - /** Instantiates a new builder. */ - public Builder() {} - - /** - * Builds a XPathPatterns. - * - * @return the new XPathPatterns instance - */ - public XPathPatterns build() { - return new XPathPatterns(this); - } - - /** - * Adds a new element to xpaths. - * - * @param xpaths the new element to be added - * @return the XPathPatterns builder - */ - public Builder addXpaths(String xpaths) { - com.ibm.cloud.sdk.core.util.Validator.notNull(xpaths, "xpaths cannot be null"); - if (this.xpaths == null) { - this.xpaths = new ArrayList(); - } - this.xpaths.add(xpaths); - return this; - } - - /** - * Set the xpaths. Existing xpaths will be replaced. - * - * @param xpaths the xpaths - * @return the XPathPatterns builder - */ - public Builder xpaths(List xpaths) { - this.xpaths = xpaths; - return this; - } - } - - protected XPathPatterns() {} - - protected XPathPatterns(Builder builder) { - xpaths = builder.xpaths; - } - - /** - * New builder. - * - * @return a XPathPatterns builder - */ - public Builder newBuilder() { - return new Builder(this); - } - - /** - * Gets the xpaths. - * - *

An array to XPaths. - * - * @return the xpaths - */ - public List xpaths() { - return xpaths; - } -} diff --git a/discovery/src/main/java/com/ibm/watson/discovery/v1/package-info.java b/discovery/src/main/java/com/ibm/watson/discovery/v1/package-info.java deleted file mode 100644 index 7918da3fedc..00000000000 --- a/discovery/src/main/java/com/ibm/watson/discovery/v1/package-info.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -/** Discovery v1. */ -package com.ibm.watson.discovery.v1; diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java deleted file mode 100644 index b7a1039e877..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceIT.java +++ /dev/null @@ -1,2401 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.google.gson.internal.LazilyParsedNumber; -import com.ibm.cloud.sdk.core.http.HttpConfigOptions; -import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.BasicAuthenticator; -import com.ibm.cloud.sdk.core.security.BearerTokenAuthenticator; -import com.ibm.cloud.sdk.core.security.IamAuthenticator; -import com.ibm.cloud.sdk.core.service.exception.*; -import com.ibm.cloud.sdk.core.util.GsonSingleton; -import com.ibm.watson.common.RetryRunner; -import com.ibm.watson.common.WaitFor; -import com.ibm.watson.common.WatsonServiceTest; -import com.ibm.watson.discovery.query.AggregationType; -import com.ibm.watson.discovery.query.Operator; -import com.ibm.watson.discovery.v1.model.*; -import com.ibm.watson.discovery.v1.model.NormalizationOperation.Operation; -import java.awt.*; -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; - -/** Integration tests for {@link Discovery}. */ -@RunWith(RetryRunner.class) -public class DiscoveryServiceIT extends WatsonServiceTest { - - private static final String DISCOVERY1_TEST_CONFIG_FILE = - "src/test/resources/discovery/v1/issue517.json"; - private static final String DISCOVERY2_TEST_CONFIG_FILE = - "src/test/resources/discovery/v1/issue518.json"; - private static final String PASSAGES_TEST_FILE_1 = - "src/test/resources/discovery/v1/passages_test_doc_1.json"; - private static final String PASSAGES_TEST_FILE_2 = - "src/test/resources/discovery/v1/passages_test_doc_2.json"; - private static final String STOPWORDS_TEST_FILE = "src/test/resources/discovery/v1/stopwords.txt"; - private static String environmentId; - private static String collectionId; - private Discovery discovery; - private String uniqueName; - - private Set configurationIds = new HashSet<>(); - private Set collectionIds = new HashSet<>(); - - private static DiscoveryServiceIT dummyTest; - - /** - * Setup class. - * - * @throws Exception the exception - */ - @BeforeClass - public static void setupClass() throws Exception { - // get the properties - dummyTest = new DiscoveryServiceIT(); - String apiKey = System.getenv("DISCOVERY_APIKEY"); - - if (apiKey == null) { - apiKey = dummyTest.getProperty("discovery.apikey"); - } - - assertNotNull( - "DISCOVERY_APIKEY is not defined and config.properties doesn't have valid credentials.", - apiKey); - - dummyTest.setup(); - - ListEnvironmentsOptions listOptions = new ListEnvironmentsOptions.Builder().build(); - ListEnvironmentsResponse listResponse = - dummyTest.discovery.listEnvironments(listOptions).execute().getResult(); - for (Environment environment : listResponse.getEnvironments()) { - // look for an existing environment that isn't read only - if (!environment.isReadOnly()) { - environmentId = environment.getEnvironmentId(); - break; - } - } - - if (environmentId == null) { - // no environment found, create a new one (assuming we are a FREE plan) - String environmentName = "watson_developer_cloud_test_environment"; - CreateEnvironmentOptions createOptions = - new CreateEnvironmentOptions.Builder().name(environmentName).build(); - Environment createResponse = - dummyTest.discovery.createEnvironment(createOptions).execute().getResult(); - environmentId = createResponse.getEnvironmentId(); - WaitFor.Condition environmentReady = new EnvironmentReady(dummyTest.discovery, environmentId); - WaitFor.waitFor(environmentReady, 30, TimeUnit.SECONDS, 500); - } - - collectionId = dummyTest.setupTestDocuments(); - } - - /** - * Cleanup class. - * - * @throws Exception the exception - */ - @AfterClass - public static void cleanupClass() throws Exception { - dummyTest.cleanup(); - } - - /** - * Setup. - * - * @throws Exception the exception - */ - @Before - public void setup() throws Exception { - super.setUp(); - String apiKey = System.getenv("DISCOVERY_APIKEY"); - String serviceUrl = System.getenv("DISCOVERY_URL"); - - if (apiKey == null) { - apiKey = getProperty("discovery.apikey"); - serviceUrl = getProperty("discovery.url"); - } - - Authenticator authenticator = new IamAuthenticator(apiKey); - discovery = new Discovery("2019-04-30", authenticator); - discovery.setServiceUrl(serviceUrl); - discovery.setDefaultHeaders(getDefaultHeaders()); - - uniqueName = UUID.randomUUID().toString(); - } - - /** Cleanup. */ - public void cleanup() { - for (String collectionId : collectionIds) { - DeleteCollectionOptions deleteOptions = - new DeleteCollectionOptions.Builder(environmentId, collectionId).build(); - try { - discovery.deleteCollection(deleteOptions).execute(); - } catch (NotFoundException ex) { - // Ignore this failure - just print msg - // System.out.println("deleteCollection failed. Collection " + collectionId + " not found"); - } - } - - for (String configurationId : configurationIds) { - DeleteConfigurationOptions deleteOptions = - new DeleteConfigurationOptions.Builder(environmentId, configurationId).build(); - try { - discovery.deleteConfiguration(deleteOptions).execute(); - } catch (NotFoundException ex) { - // Ignore this failure - just print msg - // System.out.println("deleteConfiguration failed. Configuration " + configurationId + " not - // found"); - } - } - - ListCollectionsOptions listCollectionsOptions = - new ListCollectionsOptions.Builder().environmentId(environmentId).build(); - ListCollectionsResponse response = - discovery.listCollections(listCollectionsOptions).execute().getResult(); - for (Collection collection : response.getCollections()) { - if (collection.getName().matches("java-sdk-.*collection") - || collection.getName().matches("my_watson_developer_cloud_collection.*") - || collection.getName().matches("tokenization-dict-testing-collection.*")) { - DeleteCollectionOptions deleteCollectionOptions = - new DeleteCollectionOptions.Builder() - .collectionId(collection.getCollectionId()) - .environmentId(environmentId) - .build(); - try { - DeleteCollectionResponse deleteCollectionResponse = - discovery.deleteCollection(deleteCollectionOptions).execute().getResult(); - } catch (NotFoundException ex) { - // System.out.println("deleteCollection failed. Collection " + collectionId + " not - // found"); - } - } - } - collectionId = null; - } - - /** - * Ping. - * - * @throws RuntimeException the runtime exception - */ - public boolean ping() throws RuntimeException { - discovery.listEnvironments(null).execute().getResult(); - return true; - } - - private static final String DEFAULT_CONFIG_NAME = "Default Configuration"; - - /** Example is successful. */ - @Test - public void exampleIsSuccessful() { - // Discovery discovery = new Discovery("2016-12-15"); - // discovery.setServiceUrl("https://api.us-south.discovery.watson.cloud.ibm.com"); - // discovery.setUsernameAndPassword("", " normalizations = Collections.singletonList(operation); - - NluEnrichmentSentiment sentiment = new NluEnrichmentSentiment.Builder().document(true).build(); - NluEnrichmentEmotion emotion = new NluEnrichmentEmotion.Builder().document(true).build(); - NluEnrichmentEntities entities = - new NluEnrichmentEntities.Builder() - .emotion(true) - .sentiment(true) - .model("WhatComesAfterQux") - .build(); - NluEnrichmentKeywords keywords = - new NluEnrichmentKeywords.Builder().emotion(true).sentiment(true).build(); - NluEnrichmentSemanticRoles semanticRoles = - new NluEnrichmentSemanticRoles.Builder().entities(true).build(); - NluEnrichmentFeatures features = - new NluEnrichmentFeatures.Builder() - .sentiment(sentiment) - .emotion(emotion) - .entities(entities) - .keywords(keywords) - .semanticRoles(semanticRoles) - .build(); - EnrichmentOptions options = - new EnrichmentOptions.Builder() - .features(features) - .language(EnrichmentOptions.Language.EN) - .build(); - - Enrichment enrichment = - new Enrichment.Builder() - .sourceField("foo") - .destinationField("bar") - .enrichment("baz") - .description("Erich foo to bar with baz") - .ignoreDownstreamErrors(true) - .overwrite(false) - .options(options) - .build(); - List enrichments = Collections.singletonList(enrichment); - - CreateConfigurationOptions createOptions = - new CreateConfigurationOptions.Builder() - .environmentId(environmentId) - .name(uniqueConfigName) - .description(description) - .conversions(conversionsBuilder.build()) - .normalizations(normalizations) - .enrichments(enrichments) - .build(); - Configuration createResponse = createConfiguration(createOptions); - - assertEquals(uniqueConfigName, createResponse.name()); - assertEquals(description, createResponse.description()); - assertEquals(conversionsBuilder.build(), createResponse.conversions()); - assertEquals(normalizations, createResponse.normalizations()); - assertEquals(enrichments, createResponse.enrichments()); - - Date now = new Date(); - assertTrue(fuzzyBefore(createResponse.created(), now)); - assertTrue(fuzzyAfter(createResponse.created(), start)); - assertTrue(fuzzyBefore(createResponse.updated(), now)); - assertTrue(fuzzyAfter(createResponse.updated(), start)); - } - - /** Delete configuration is successful. */ - @Test - public void deleteConfigurationIsSuccessful() { - Configuration createResponse = createTestConfig(); - - DeleteConfigurationOptions deleteOptions = - new DeleteConfigurationOptions.Builder(environmentId, createResponse.configurationId()) - .build(); - deleteConfiguration(deleteOptions); - } - - /** Gets the configuration is successful. */ - @Test - public void getConfigurationIsSuccessful() { - Configuration createResponse = createTestConfig(); - - GetConfigurationOptions getOptions = - new GetConfigurationOptions.Builder(environmentId, createResponse.configurationId()) - .build(); - Configuration getResponse = discovery.getConfiguration(getOptions).execute().getResult(); - - assertEquals(createResponse.name(), getResponse.name()); - } - - /** Gets the configurations by name is successful. */ - @Test - public void getConfigurationsByNameIsSuccessful() { - Configuration createResponse = createTestConfig(); - - ListConfigurationsOptions.Builder getBuilder = - new ListConfigurationsOptions.Builder(environmentId); - getBuilder.name(createResponse.name()); - ListConfigurationsResponse getResponse = - discovery.listConfigurations(getBuilder.build()).execute().getResult(); - - assertEquals(1, getResponse.getConfigurations().size()); - assertEquals(createResponse.name(), getResponse.getConfigurations().get(0).name()); - } - - /** Gets the configurations with funky name is successful. */ - @Test - public void getConfigurationsWithFunkyNameIsSuccessful() { - String uniqueConfigName = - uniqueName + " with \"funky\" ?x=y&foo=bar ,[x](y) ~!@#$%^&*()-+ {} | ;:<>\\/ chars"; - - CreateConfigurationOptions.Builder createBuilder = - new CreateConfigurationOptions.Builder(environmentId, uniqueConfigName); - createConfiguration(createBuilder.build()); - - ListConfigurationsOptions.Builder getBuilder = - new ListConfigurationsOptions.Builder(environmentId); - getBuilder.name(uniqueConfigName); - ListConfigurationsResponse getResponse = - discovery.listConfigurations(getBuilder.build()).execute().getResult(); - - assertEquals(1, getResponse.getConfigurations().size()); - assertEquals(uniqueConfigName, getResponse.getConfigurations().get(0).name()); - } - - /** Update configuration is successful. */ - @Test - public void updateConfigurationIsSuccessful() { - - Configuration testConfig = createTestConfig(); - - Date start = new Date(); - - String updatedName = testConfig.name() + UUID.randomUUID().toString(); - String updatedDescription = "Description of " + updatedName; - HtmlSettings newHtmlSettings = - new HtmlSettings.Builder() - .excludeTagsCompletely(Arrays.asList("table", "h6", "header")) - .build(); - Conversions updatedConversions = new Conversions.Builder().html(newHtmlSettings).build(); - NormalizationOperation operation = - new NormalizationOperation.Builder() - .operation("foo") - .sourceField("bar") - .destinationField("baz") - .build(); - List updatedNormalizations = Arrays.asList(operation); - - NluEnrichmentSentiment sentiment = new NluEnrichmentSentiment.Builder().document(true).build(); - NluEnrichmentEmotion emotion = new NluEnrichmentEmotion.Builder().document(true).build(); - NluEnrichmentEntities entities = - new NluEnrichmentEntities.Builder() - .emotion(true) - .sentiment(true) - .model("WhatComesAfterQux") - .build(); - NluEnrichmentKeywords keywords = - new NluEnrichmentKeywords.Builder().emotion(true).sentiment(true).build(); - NluEnrichmentSemanticRoles semanticRoles = - new NluEnrichmentSemanticRoles.Builder().entities(true).build(); - NluEnrichmentFeatures features = - new NluEnrichmentFeatures.Builder() - .sentiment(sentiment) - .emotion(emotion) - .entities(entities) - .keywords(keywords) - .semanticRoles(semanticRoles) - .build(); - EnrichmentOptions options = new EnrichmentOptions.Builder().features(features).build(); - - Enrichment enrichment = - new Enrichment.Builder() - .sourceField("foo") - .destinationField("bar") - .enrichment("baz") - .description("Erich foo to bar with baz") - .ignoreDownstreamErrors(true) - .overwrite(false) - .options(options) - .build(); - List updatedEnrichments = Collections.singletonList(enrichment); - - UpdateConfigurationOptions.Builder updateBuilder = - new UpdateConfigurationOptions.Builder( - environmentId, testConfig.configurationId(), updatedName); - updateBuilder.description(updatedDescription); - updateBuilder.conversions(updatedConversions); - updateBuilder.normalizations(updatedNormalizations); - updateBuilder.enrichments(updatedEnrichments); - Configuration updatedConfiguration = - discovery.updateConfiguration(updateBuilder.build()).execute().getResult(); - - assertEquals(updatedName, updatedConfiguration.name()); - assertEquals(updatedDescription, updatedConfiguration.description()); - assertEquals(updatedConversions, updatedConfiguration.conversions()); - assertEquals(updatedNormalizations, updatedConfiguration.normalizations()); - assertEquals(updatedEnrichments, updatedConfiguration.enrichments()); - - Date now = new Date(); - assertTrue(fuzzyBefore(updatedConfiguration.created(), start)); - assertTrue(fuzzyBefore(updatedConfiguration.updated(), now)); - assertTrue(fuzzyAfter(updatedConfiguration.updated(), start)); - } - - // Collections - - /** List collections is successful. */ - @Test - public void listCollectionsIsSuccessful() { - createTestCollection(); - ListCollectionsOptions listOptions = new ListCollectionsOptions.Builder(environmentId).build(); - ListCollectionsResponse listResponse = - discovery.listCollections(listOptions).execute().getResult(); - - assertFalse(listResponse.getCollections().isEmpty()); - } - - /** Creates the collection is successful. */ - @Test - public void createCollectionIsSuccessful() { - Configuration createConfigResponse = createTestConfig(); - - String uniqueCollectionName = uniqueName + "-collection"; - String uniqueCollectionDescription = "Description of " + uniqueCollectionName; - - CreateCollectionOptions.Builder createCollectionBuilder = - new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName) - .configurationId(createConfigResponse.configurationId()) - .description(uniqueCollectionDescription); - Collection createResponse = createCollection(createCollectionBuilder.build()); - - assertEquals(createConfigResponse.configurationId(), createResponse.getConfigurationId()); - assertEquals(uniqueCollectionName, createResponse.getName()); - assertEquals(uniqueCollectionDescription, createResponse.getDescription()); - } - - /** Creates the collection with minimal parameters is successful. */ - @Test - public void createCollectionWithMinimalParametersIsSuccessful() { - String uniqueCollectionName = uniqueName + "-collection"; - CreateCollectionOptions createOptions = - new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName).build(); - Collection createResponse = createCollection(createOptions); - - assertNotNull(createResponse.getCollectionId()); - } - - /** Update collection is successful. */ - @Test - public void updateCollectionIsSuccessful() { - String uniqueCollectionName = uniqueName + "-collection"; - CreateCollectionOptions createOptions = - new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName).build(); - Collection collection = createCollection(createOptions); - assertNotNull(collection.getCollectionId()); - - Configuration testConfig = createTestConfig(); - String updatedCollectionName = UUID.randomUUID().toString() + "-collection"; - String updatedCollectionDescription = "Description for " + updatedCollectionName; - String newCollectionId = collection.getCollectionId(); - - UpdateCollectionOptions updateOptions = - new UpdateCollectionOptions.Builder() - .environmentId(environmentId) - .collectionId(newCollectionId) - .name(updatedCollectionName) - .description(updatedCollectionDescription) - .configurationId(testConfig.configurationId()) - .build(); - Collection updatedCollection = discovery.updateCollection(updateOptions).execute().getResult(); - - assertEquals(updatedCollectionName, updatedCollection.getName()); - assertEquals(updatedCollectionDescription, updatedCollection.getDescription()); - assertEquals(testConfig.configurationId(), updatedCollection.getConfigurationId()); - } - - /** Delete collection is successful. */ - @Test - public void deleteCollectionIsSuccessful() { - Configuration createConfigResponse = createTestConfig(); - - String uniqueCollectionName = uniqueName + "-collection"; - CreateCollectionOptions.Builder createCollectionBuilder = - new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName) - .configurationId(createConfigResponse.configurationId()); - Collection createResponse = createCollection(createCollectionBuilder.build()); - - // need to wait for collection to be ready - - DeleteCollectionOptions deleteOptions = - new DeleteCollectionOptions.Builder(environmentId, createResponse.getCollectionId()) - .build(); - deleteCollection(deleteOptions); - } - - /** Gets the collection is successful. */ - @Test - public void getCollectionIsSuccessful() { - Configuration createConfigResponse = createTestConfig(); - - String uniqueCollectionName = uniqueName + "-collection"; - CreateCollectionOptions.Builder createCollectionBuilder = - new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName) - .configurationId(createConfigResponse.configurationId()); - Collection createResponse = createCollection(createCollectionBuilder.build()); - - GetCollectionOptions getOptions = - new GetCollectionOptions.Builder(environmentId, createResponse.getCollectionId()).build(); - - // need to wait for collection to be ready - - Collection getResponse = discovery.getCollection(getOptions).execute().getResult(); - - assertEquals(createResponse.getName(), getResponse.getName()); - } - - /** Gets the collections by name is successful. */ - @Test - public void getCollectionsByNameIsSuccessful() { - Configuration createConfigResponse = createTestConfig(); - - String uniqueCollectionName = uniqueName + "-collection"; - CreateCollectionOptions.Builder createCollectionBuilder = - new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName) - .configurationId(createConfigResponse.configurationId()); - createCollection(createCollectionBuilder.build()); - - ListCollectionsOptions.Builder getBuilder = new ListCollectionsOptions.Builder(environmentId); - getBuilder.name(uniqueCollectionName); - ListCollectionsResponse getResponse = - discovery.listCollections(getBuilder.build()).execute().getResult(); - - assertEquals(1, getResponse.getCollections().size()); - assertEquals(uniqueCollectionName, getResponse.getCollections().get(0).getName()); - } - - /** Adds the document is successful. */ - @SuppressWarnings("deprecation") - @Test - public void addDocumentIsSuccessful() { - String myDocumentJson = "{\"field\":\"value\"}"; - InputStream documentStream = new ByteArrayInputStream(myDocumentJson.getBytes()); - - AddDocumentOptions.Builder builder = new AddDocumentOptions.Builder(); - builder.environmentId(environmentId); - builder.collectionId(collectionId); - builder.file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON); - builder.filename(UUID.randomUUID().toString()); - DocumentAccepted createResponse = discovery.addDocument(builder.build()).execute().getResult(); - - assertFalse(createResponse.getDocumentId().isEmpty()); - assertNull(createResponse.getNotices()); - } - - /** Adds the document with configuration is successful. */ - @Test - public void addDocumentWithConfigurationIsSuccessful() { - uniqueName = UUID.randomUUID().toString(); - - String myDocumentJson = "{\"field\":\"value\"}"; - InputStream documentStream = new ByteArrayInputStream(myDocumentJson.getBytes()); - - AddDocumentOptions.Builder builder = new AddDocumentOptions.Builder(); - builder.environmentId(environmentId); - builder.collectionId(collectionId); - builder.file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON); - builder.filename(UUID.randomUUID().toString()); - DocumentAccepted createResponse = discovery.addDocument(builder.build()).execute().getResult(); - - assertFalse(createResponse.getDocumentId().isEmpty()); - assertNull(createResponse.getNotices()); - } - - /** Adds the document with metadata is successful. */ - @Ignore - @SuppressWarnings("deprecation") - @Test - public void addDocumentWithMetadataIsSuccessful() { - String myDocumentJson = "{\"field\":\"value\"}"; - InputStream documentStream = new ByteArrayInputStream(myDocumentJson.getBytes()); - - JsonObject myMetadata = new JsonObject(); - myMetadata.add("foo", new JsonPrimitive("bar")); - - AddDocumentOptions.Builder builder = - new AddDocumentOptions.Builder(environmentId, collectionId); - builder.file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON); - builder.filename(UUID.randomUUID().toString()); - builder.metadata(myMetadata.toString()); - - DocumentAccepted createResponse = discovery.addDocument(builder.build()).execute().getResult(); - - WaitFor.Condition documentAccepted = - new WaitForDocumentAccepted(environmentId, collectionId, createResponse.getDocumentId()); - WaitFor.waitFor(documentAccepted, 5, TimeUnit.SECONDS, 500); - - QueryOptions queryOptions = new QueryOptions.Builder(environmentId, collectionId).build(); - QueryResponse queryResponse = discovery.query(queryOptions).execute().getResult(); - - assertTrue(queryResponse.getResults().get(0).getMetadata() != null); - } - - /** Delete document is successful. */ - @Ignore - @Test - public void deleteDocumentIsSuccessful() { - DocumentAccepted createResponse = createTestDocument(collectionId); - String documentId = createResponse.getDocumentId(); - - WaitFor.Condition documentAccepted = - new WaitForDocumentAccepted(environmentId, collectionId, documentId); - WaitFor.waitFor(documentAccepted, 5, TimeUnit.SECONDS, 500); - - DeleteDocumentOptions deleteOptions = - new DeleteDocumentOptions.Builder(environmentId, collectionId, documentId).build(); - discovery.deleteDocument(deleteOptions).execute(); - } - - /** Gets the document is successful. */ - @Ignore - @Test - public void getDocumentIsSuccessful() { - DocumentAccepted documentAccepted = createTestDocument(collectionId); - - GetDocumentStatusOptions getOptions = - new GetDocumentStatusOptions.Builder( - environmentId, collectionId, documentAccepted.getDocumentId()) - .build(); - DocumentStatus getResponse = discovery.getDocumentStatus(getOptions).execute().getResult(); - - assertEquals(DocumentStatus.Status.AVAILABLE, getResponse.getStatus()); - } - - /** Update document is successful. */ - @Test - public void updateDocumentIsSuccessful() { - DocumentAccepted documentAccepted = createTestDocument(collectionId); - - uniqueName = UUID.randomUUID().toString(); - String myDocumentJson = "{\"field\":\"value2\"}"; - InputStream documentStream = new ByteArrayInputStream(myDocumentJson.getBytes()); - - UpdateDocumentOptions.Builder updateBuilder = - new UpdateDocumentOptions.Builder( - environmentId, collectionId, documentAccepted.getDocumentId()); - updateBuilder.file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON); - updateBuilder.filename(UUID.randomUUID().toString()); - DocumentAccepted updateResponse = - discovery.updateDocument(updateBuilder.build()).execute().getResult(); - - GetDocumentStatusOptions getOptions = - new GetDocumentStatusOptions.Builder( - environmentId, collectionId, updateResponse.getDocumentId()) - .build(); - DocumentStatus getResponse = discovery.getDocumentStatus(getOptions).execute().getResult(); - - assertNotNull(getResponse); - } - - /** Update another document is successful. */ - @Test - public void updateAnotherDocumentIsSuccessful() { - JsonObject myMetadata = new JsonObject(); - myMetadata.add("foo", new JsonPrimitive("bar")); - - AddDocumentOptions.Builder builder = - new AddDocumentOptions.Builder(environmentId, collectionId); - builder.metadata(myMetadata.toString()); - DocumentAccepted documentAccepted = - discovery.addDocument(builder.build()).execute().getResult(); - - String myDocumentJson = "{\"field\":\"value2\"}"; - InputStream documentStream = new ByteArrayInputStream(myDocumentJson.getBytes()); - - UpdateDocumentOptions.Builder updateBuilder = - new UpdateDocumentOptions.Builder( - environmentId, collectionId, documentAccepted.getDocumentId()); - updateBuilder.file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON); - updateBuilder.filename(UUID.randomUUID().toString()); - DocumentAccepted updateResponse = - discovery.updateDocument(updateBuilder.build()).execute().getResult(); - - GetDocumentStatusOptions getOptions = - new GetDocumentStatusOptions.Builder( - environmentId, collectionId, updateResponse.getDocumentId()) - .build(); - DocumentStatus getResponse = discovery.getDocumentStatus(getOptions).execute().getResult(); - - assertNotNull(getResponse); - } - - /** Update document with metadata is successful. */ - @Test - @Ignore("Pending implementation of 'processing' after document update") - public void updateDocumentWithMetadataIsSuccessful() { - Collection collection = createTestCollection(); - String collectionId = collection.getCollectionId(); - DocumentAccepted documentAccepted = createTestDocument(collectionId); - - String myDocumentJson = "{\"field\":\"value2\"}"; - InputStream documentStream = new ByteArrayInputStream(myDocumentJson.getBytes()); - - JsonObject myMetadata = new JsonObject(); - myMetadata.add("foo", new JsonPrimitive("bar")); - - UpdateDocumentOptions.Builder updateBuilder = - new UpdateDocumentOptions.Builder( - environmentId, collectionId, documentAccepted.getDocumentId()); - updateBuilder.file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON); - updateBuilder.metadata(myMetadata.toString()); - DocumentAccepted updateResponse = - discovery.updateDocument(updateBuilder.build()).execute().getResult(); - - WaitFor.Condition waitForDocumentAccepted = - new WaitForDocumentAccepted(environmentId, collectionId, updateResponse.getDocumentId()); - WaitFor.waitFor(waitForDocumentAccepted, 5, TimeUnit.SECONDS, 500); - - QueryOptions queryOptions = new QueryOptions.Builder(environmentId, collectionId).build(); - QueryResponse queryResponse = discovery.query(queryOptions).execute().getResult(); - - assertTrue(queryResponse.getResults().get(0).getMetadata() != null); - } - - /** Gets the collection fields is successful. */ - @Ignore - @Test - public void getCollectionFieldsIsSuccessful() { - ListCollectionFieldsOptions getOptions = - new ListCollectionFieldsOptions.Builder(environmentId, collectionId).build(); - ListCollectionFieldsResponse getResponse = - discovery.listCollectionFields(getOptions).execute().getResult(); - - assertFalse(getResponse.getFields().isEmpty()); - } - - // query tests - - /** Query with count is successful. */ - @Test - public void queryWithCountIsSuccessful() { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - queryBuilder.count(5L); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - assertTrue(queryResponse.getMatchingResults() > 0); - } - - /** Query with offset is successful. */ - @Test - public void queryWithOffsetIsSuccessful() { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - queryBuilder.offset(5L); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - assertTrue(queryResponse.getMatchingResults() > 0); - } - - /** Query with query is successful. */ - @Ignore - @Test - public void queryWithQueryIsSuccessful() { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - queryBuilder.query("field" + Operator.CONTAINS + 1); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - assertEquals(new Long(1), queryResponse.getMatchingResults()); - assertEquals(1, queryResponse.getResults().size()); - } - - /** Query with filter is successful. */ - @Test - public void queryWithFilterIsSuccessful() { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - queryBuilder.filter("field" + Operator.CONTAINS + 1); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - assertEquals(new Long(1), queryResponse.getMatchingResults()); - assertEquals(1, queryResponse.getResults().size()); - } - - /** Query with sort is successful. */ - @Test - public void queryWithSortIsSuccessful() { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - String sortList = "field"; - queryBuilder.sort(sortList); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - assertTrue(queryResponse.getResults().size() > 1); - int v0 = ((LazilyParsedNumber) queryResponse.getResults().get(0).get("field")).intValue(); - int v1 = ((LazilyParsedNumber) queryResponse.getResults().get(1).get("field")).intValue(); - assertTrue(v0 <= v1); - } - - /** Query with aggregation term is successful. */ - @Test - public void queryWithAggregationTermIsSuccessful() { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - StringBuilder sb = new StringBuilder(); - sb.append(AggregationType.TERM); - sb.append(Operator.OPENING_GROUPING); - sb.append("field"); - sb.append(Operator.AND); - sb.append(10L); - sb.append(Operator.CLOSING_GROUPING); - String aggregation = sb.toString(); - queryBuilder.aggregation(aggregation); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - QueryTermAggregation term = (QueryTermAggregation) queryResponse.getAggregations().get(0); - assertEquals(1, queryResponse.getAggregations().size()); - assertEquals(new Long(10), term.getCount()); - } - - /** - * Query with aggregation histogram is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void queryWithAggregationHistogramIsSuccessful() throws InterruptedException { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - StringBuilder sb = new StringBuilder(); - sb.append(AggregationType.HISTOGRAM); - sb.append(Operator.OPENING_GROUPING); - sb.append("field"); - sb.append(Operator.AND); - sb.append(5L); - sb.append(Operator.CLOSING_GROUPING); - String aggregation = sb.toString(); - queryBuilder.aggregation(aggregation); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - QueryHistogramAggregation histogram = - (QueryHistogramAggregation) queryResponse.getAggregations().get(0); - Long interval = histogram.getInterval(); - assertEquals(new Long(5), interval); - assertEquals(2, histogram.getResults().size()); - } - - /** - * Query with aggregation maximum is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void queryWithAggregationMaximumIsSuccessful() throws InterruptedException { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - StringBuilder sb = new StringBuilder(); - sb.append(AggregationType.MAX); - sb.append(Operator.OPENING_GROUPING); - sb.append("field"); - sb.append(Operator.CLOSING_GROUPING); - String aggregation = sb.toString(); - queryBuilder.aggregation(aggregation); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - QueryCalculationAggregation max = - (QueryCalculationAggregation) queryResponse.getAggregations().get(0); - assertEquals(AggregationType.MAX.getName(), max.getType()); - assertEquals(new Double(9), max.getValue()); - } - - /** - * Query with aggregation minimum is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void queryWithAggregationMinimumIsSuccessful() throws InterruptedException { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - StringBuilder sb = new StringBuilder(); - sb.append(AggregationType.MIN); - sb.append(Operator.OPENING_GROUPING); - sb.append("field"); - sb.append(Operator.CLOSING_GROUPING); - String aggregation = sb.toString(); - queryBuilder.aggregation(aggregation); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - QueryCalculationAggregation min = - (QueryCalculationAggregation) queryResponse.getAggregations().get(0); - assertEquals(AggregationType.MIN.getName(), min.getType()); - assertEquals(new Double(0), min.getValue()); - } - - /** - * Query with aggregation summation is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void queryWithAggregationSummationIsSuccessful() throws InterruptedException { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - StringBuilder sb = new StringBuilder(); - sb.append(AggregationType.SUM); - sb.append(Operator.OPENING_GROUPING); - sb.append("field"); - sb.append(Operator.CLOSING_GROUPING); - String aggregation = sb.toString(); - queryBuilder.aggregation(aggregation); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - QueryCalculationAggregation sum = - (QueryCalculationAggregation) queryResponse.getAggregations().get(0); - assertEquals(AggregationType.SUM.getName(), sum.getType()); - assertEquals(new Double(45), sum.getValue()); - } - - /** - * Query with aggregation average is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void queryWithAggregationAverageIsSuccessful() throws InterruptedException { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - StringBuilder sb = new StringBuilder(); - sb.append(AggregationType.AVERAGE); - sb.append(Operator.OPENING_GROUPING); - sb.append("field"); - sb.append(Operator.CLOSING_GROUPING); - String aggregation = sb.toString(); - queryBuilder.aggregation(aggregation); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - QueryCalculationAggregation avg = - (QueryCalculationAggregation) queryResponse.getAggregations().get(0); - assertEquals(AggregationType.AVERAGE.getName(), avg.getType()); - assertEquals(new Double(4.5), avg.getValue()); - } - - /** Query with aggregation filter is successful. */ - @Test - public void queryWithAggregationFilterIsSuccessful() { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - StringBuilder sb = new StringBuilder(); - sb.append(AggregationType.FILTER); - sb.append(Operator.OPENING_GROUPING); - sb.append("field:9"); - sb.append(Operator.CLOSING_GROUPING); - String aggregation = sb.toString(); - queryBuilder.aggregation(aggregation); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - QueryFilterAggregation filter = (QueryFilterAggregation) queryResponse.getAggregations().get(0); - assertEquals(AggregationType.FILTER.getName(), filter.getType()); - assertEquals("field:9", filter.getMatch()); - assertEquals(new Long(1), filter.getMatchingResults()); - } - - /** - * Query with aggregation nested is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void queryWithAggregationNestedIsSuccessful() throws InterruptedException { - DocumentAccepted testDocument = createNestedTestDocument(collectionId); - String documentId = testDocument.getDocumentId(); - - WaitFor.Condition documentAccepted = - new WaitForDocumentAccepted(environmentId, collectionId, documentId); - WaitFor.waitFor(documentAccepted, 5, TimeUnit.SECONDS, 500); - - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - StringBuilder sb = new StringBuilder(); - sb.append(AggregationType.NESTED); - sb.append(Operator.OPENING_GROUPING); - sb.append("nested_fields"); - sb.append(Operator.CLOSING_GROUPING); - sb.append(Operator.NEST_AGGREGATION); - sb.append(AggregationType.TERM); - sb.append(Operator.OPENING_GROUPING); - sb.append("field"); - sb.append(Operator.CLOSING_GROUPING); - String aggregation = sb.toString(); - queryBuilder.aggregation(aggregation); - - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - assertNotNull(queryResponse.getAggregations()); - } - - /** - * Query with aggregation timeslice is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void queryWithAggregationTimesliceIsSuccessful() throws InterruptedException { - String myDocumentJson = "{\"time\":\"1999-02-16T00:00:00.000-05:00\"}"; - DocumentAccepted testDocument1 = - createTestDocument(myDocumentJson, UUID.randomUUID().toString(), collectionId); - String documentId1 = testDocument1.getDocumentId(); - myDocumentJson = "{\"time\":\"1999-04-16T00:00:00.000-05:00\"}"; - DocumentAccepted testDocument2 = - createTestDocument(myDocumentJson, UUID.randomUUID().toString(), collectionId); - String documentId2 = testDocument2.getDocumentId(); - - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - StringBuilder sb = new StringBuilder(); - sb.append(AggregationType.TIMESLICE); - sb.append(Operator.OPENING_GROUPING); - sb.append("time,1day,EST"); - sb.append(Operator.CLOSING_GROUPING); - String aggregation = sb.toString(); - queryBuilder.aggregation(aggregation); - - GetDocumentStatusOptions getOptions1 = - new GetDocumentStatusOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .documentId(documentId1) - .build(); - DocumentStatus status1 = discovery.getDocumentStatus(getOptions1).execute().getResult(); - GetDocumentStatusOptions getOptions2 = - new GetDocumentStatusOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .documentId(documentId2) - .build(); - DocumentStatus status2 = discovery.getDocumentStatus(getOptions2).execute().getResult(); - while (status1.getStatus().equals(DocumentAccepted.Status.PROCESSING) - || status2.getStatus().equals(DocumentAccepted.Status.PROCESSING)) { - Thread.sleep(3000); - status1 = discovery.getDocumentStatus(getOptions1).execute().getResult(); - status2 = discovery.getDocumentStatus(getOptions2).execute().getResult(); - } - - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - QueryTimesliceAggregation timeslice = - (QueryTimesliceAggregation) queryResponse.getAggregations().get(0); - assertEquals(AggregationType.TIMESLICE.getName(), timeslice.getType()); - assertNotNull(timeslice.getResults()); - } - - /** Query with aggregation top hits is successful. */ - @Test - public void queryWithAggregationTopHitsIsSuccessful() { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - StringBuilder sb = new StringBuilder(); - sb.append(AggregationType.TERM); - sb.append(Operator.OPENING_GROUPING); - sb.append("field"); - sb.append(Operator.CLOSING_GROUPING); - sb.append(Operator.NEST_AGGREGATION); - sb.append(AggregationType.TOP_HITS); - sb.append(Operator.OPENING_GROUPING); - sb.append("3"); - sb.append(Operator.CLOSING_GROUPING); - String aggregation = sb.toString(); - queryBuilder.aggregation(aggregation); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - QueryTermAggregation term = (QueryTermAggregation) queryResponse.getAggregations().get(0); - QueryTopHitsAggregation topHits = - (QueryTopHitsAggregation) term.getResults().get(0).getAggregations().get(0); - assertEquals(new Long(3), topHits.getSize()); - assertNotNull(topHits.getHits()); - } - - /** Query with aggregation unique count is successful. */ - public void queryWithAggregationUniqueCountIsSuccessful() { - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - StringBuilder sb = new StringBuilder(); - sb.append(AggregationType.UNIQUE_COUNT); - sb.append(Operator.OPENING_GROUPING); - sb.append("field"); - sb.append(Operator.CLOSING_GROUPING); - String aggregation = sb.toString(); - queryBuilder.aggregation(aggregation); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - QueryCalculationAggregation uniqueCount = - (QueryCalculationAggregation) queryResponse.getAggregations().get(0); - assertEquals(new Double(10), uniqueCount.getValue()); - } - - /** - * Query with passages is successful. - * - * @throws InterruptedException the interrupted exception - * @throws FileNotFoundException the file not found exception - */ - @Test - public void queryWithPassagesIsSuccessful() throws InterruptedException, FileNotFoundException { - createTestDocument( - getStringFromInputStream(new FileInputStream(PASSAGES_TEST_FILE_1)), - UUID.randomUUID().toString(), - collectionId); - createTestDocument( - getStringFromInputStream(new FileInputStream(PASSAGES_TEST_FILE_2)), - UUID.randomUUID().toString(), - collectionId); - - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - queryBuilder.passages(true); - queryBuilder.naturalLanguageQuery("Watson"); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - List passages = queryResponse.getPassages(); - assertNotNull(passages); - } - - // queryNotices tests - - /** Query notices count is successful. */ - @Test - public void queryNoticesCountIsSuccessful() { - QueryNoticesOptions.Builder queryBuilder = - new QueryNoticesOptions.Builder(environmentId, collectionId); - queryBuilder.count(5L); - QueryNoticesResponse queryResponse = - discovery.queryNotices(queryBuilder.build()).execute().getResult(); - assertTrue(queryResponse.getResults().size() <= 5); - } - - // Tests for reported issues - - /** Issue number 517. */ - @Test - public void issueNumber517() { - String uniqueConfigName = uniqueName + "-config"; - CreateConfigurationOptions.Builder createBuilder = new CreateConfigurationOptions.Builder(); - createBuilder.environmentId(environmentId); - Configuration configuration = getTestConfiguration(DISCOVERY1_TEST_CONFIG_FILE); - - configuration = configuration.newBuilder().name(uniqueConfigName).build(); - createBuilder.configuration(configuration); - Configuration createResponse = createConfiguration(createBuilder.build()); - - GetConfigurationOptions getOptions = - new GetConfigurationOptions.Builder(environmentId, createResponse.configurationId()) - .build(); - Configuration getResponse = discovery.getConfiguration(getOptions).execute().getResult(); - - // returned config should have some json data - assertEquals(1, getResponse.conversions().jsonNormalizations().size()); - } - - /** Issue number 518. */ - @Test - public void issueNumber518() { - String[] operations = - new String[] { - Operation.MOVE, Operation.COPY, Operation.MERGE, Operation.REMOVE, Operation.REMOVE_NULLS - }; - - String uniqueConfigName = uniqueName + "-config"; - CreateConfigurationOptions.Builder createBuilder = new CreateConfigurationOptions.Builder(); - createBuilder.environmentId(environmentId); - Configuration configuration = getTestConfiguration(DISCOVERY2_TEST_CONFIG_FILE); - - configuration = configuration.newBuilder().name(uniqueConfigName).build(); - createBuilder.configuration(configuration); - Configuration createResponse = createConfiguration(createBuilder.build()); - - GetConfigurationOptions getOptions = - new GetConfigurationOptions.Builder(environmentId, createResponse.configurationId()) - .build(); - Configuration getResponse = discovery.getConfiguration(getOptions).execute().getResult(); - - // verify getResponse deserializes the operations appropriately - for (NormalizationOperation normalization : getResponse.normalizations()) { - String operation = normalization.operation(); - assertEquals(true, Arrays.asList(operations).contains(operation)); - } - } - - /** Issue number 654. */ - @Test - public void issueNumber654() { - String collectionId = setupTestDocuments(); - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - queryBuilder.query("field:1|3"); - QueryResponse queryResponse = discovery.query(queryBuilder.build()).execute().getResult(); - - assertEquals(new Long(2), queryResponse.getMatchingResults()); - assertEquals(2, queryResponse.getResults().size()); - } - - /** Issue number 659. */ - /* Issue 659: creating a collection does not use the configuration id */ - @Test - public void issueNumber659() { - String uniqueConfigName = UUID.randomUUID().toString() + "-config"; - CreateConfigurationOptions configOptions = - new CreateConfigurationOptions.Builder() - .environmentId(environmentId) - .name(uniqueConfigName) - .build(); - Configuration configuration = - discovery.createConfiguration(configOptions).execute().getResult(); - configurationIds.add(configuration.configurationId()); - - String uniqueCollectionName = UUID.randomUUID().toString() + "-collection"; - CreateCollectionOptions collectionOptions = - new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName) - .configurationId(configuration.configurationId()) - .build(); - Collection collection = discovery.createCollection(collectionOptions).execute().getResult(); - collectionIds.add(collection.getCollectionId()); - - assertEquals(collection.getConfigurationId(), configuration.configurationId()); - } - - /** Adds the training data is successful. */ - @Test - public void addTrainingDataIsSuccessful() { - AddTrainingDataOptions.Builder builder = - new AddTrainingDataOptions.Builder(environmentId, collectionId); - String naturalLanguageQuery = "Example query" + UUID.randomUUID().toString(); - builder.naturalLanguageQuery(naturalLanguageQuery); - String documentId = createTestDocument(collectionId).getDocumentId(); - int relevance = 0; - TrainingExample example = - new TrainingExample.Builder().documentId(documentId).relevance(relevance).build(); - builder.addExamples(example); - TrainingQuery response = discovery.addTrainingData(builder.build()).execute().getResult(); - - assertFalse(response.getQueryId().isEmpty()); - assertEquals(response.getNaturalLanguageQuery(), naturalLanguageQuery); - assertTrue(response.getFilter().isEmpty()); - assertEquals(response.getExamples().size(), 1); - - TrainingExample returnedExample = response.getExamples().get(0); - assertEquals(returnedExample.documentId(), documentId); - assertTrue(returnedExample.crossReference().isEmpty()); - assertEquals(returnedExample.relevance(), new Long(relevance)); - } - - /** Adds the training example is successful. */ - @Test - public void addTrainingExampleIsSuccessful() { - TrainingQuery query = createTestQuery(collectionId, "Query" + UUID.randomUUID().toString()); - int startingExampleCount = query.getExamples().size(); - String queryId = query.getQueryId(); - - String documentId = "document_id"; - String crossReference = "cross_reference"; - int relevance = 50; - CreateTrainingExampleOptions.Builder exampleBuilder = - new CreateTrainingExampleOptions.Builder(environmentId, collectionId, queryId); - exampleBuilder.documentId(documentId); - exampleBuilder.crossReference(crossReference); - exampleBuilder.relevance(relevance); - discovery.createTrainingExample(exampleBuilder.build()).execute().getResult(); - - GetTrainingDataOptions.Builder queryBuilder = - new GetTrainingDataOptions.Builder(environmentId, collectionId, queryId); - TrainingQuery updatedQuery = - discovery.getTrainingData(queryBuilder.build()).execute().getResult(); - - assertTrue(updatedQuery.getExamples().size() > startingExampleCount); - TrainingExample newExample = updatedQuery.getExamples().get(0); - assertEquals(newExample.documentId(), documentId); - assertEquals(newExample.crossReference(), crossReference); - assertEquals(newExample.relevance(), new Long(relevance)); - } - - /** Delete all collection training data is successful. */ - @Test - public void deleteAllCollectionTrainingDataIsSuccessful() { - String collId = setupTestQueries(collectionId); - DeleteAllTrainingDataOptions.Builder deleteBuilder = - new DeleteAllTrainingDataOptions.Builder(environmentId, collId); - discovery.deleteAllTrainingData(deleteBuilder.build()).execute(); - - ListTrainingDataOptions.Builder listBuilder = - new ListTrainingDataOptions.Builder(environmentId, collId); - TrainingDataSet trainingData = - discovery.listTrainingData(listBuilder.build()).execute().getResult(); - - assertEquals(trainingData.getQueries().size(), 0); - } - - /** Delete training data query is successful. */ - @Test - public void deleteTrainingDataQueryIsSuccessful() { - TrainingQuery query = createTestQuery(collectionId, "Query" + UUID.randomUUID().toString()); - String queryId = query.getQueryId(); - - ListTrainingDataOptions.Builder listBuilder = - new ListTrainingDataOptions.Builder(environmentId, collectionId); - TrainingDataSet trainingData = - discovery.listTrainingData(listBuilder.build()).execute().getResult(); - List queryList = trainingData.getQueries(); - boolean doesQueryExist = false; - for (TrainingQuery q : queryList) { - if (q.getQueryId().equals(queryId)) { - doesQueryExist = true; - break; - } - } - assertTrue(doesQueryExist); - - DeleteTrainingDataOptions.Builder deleteBuilder = - new DeleteTrainingDataOptions.Builder(environmentId, collectionId, queryId); - discovery.deleteTrainingData(deleteBuilder.build()).execute(); - - listBuilder = new ListTrainingDataOptions.Builder(environmentId, collectionId); - trainingData = discovery.listTrainingData(listBuilder.build()).execute().getResult(); - queryList = trainingData.getQueries(); - doesQueryExist = false; - for (TrainingQuery q : queryList) { - if (q.getQueryId().equals(queryId)) { - doesQueryExist = true; - break; - } - } - assertFalse(doesQueryExist); - } - - /** Delete training data example is successful. */ - @Test - public void deleteTrainingDataExampleIsSuccessful() { - TrainingQuery newQuery = createTestQuery(collectionId, "Query" + UUID.randomUUID().toString()); - String queryId = newQuery.getQueryId(); - - String documentId = "document_id"; - String crossReference = "cross_reference"; - int relevance = 50; - CreateTrainingExampleOptions.Builder exampleBuilder = - new CreateTrainingExampleOptions.Builder(environmentId, collectionId, queryId); - exampleBuilder.documentId(documentId); - exampleBuilder.crossReference(crossReference); - exampleBuilder.relevance(relevance); - TrainingExample createdExample = - discovery.createTrainingExample(exampleBuilder.build()).execute().getResult(); - String exampleId = createdExample.documentId(); - - GetTrainingDataOptions.Builder queryBuilder = - new GetTrainingDataOptions.Builder(environmentId, collectionId, queryId); - TrainingQuery queryWithAddedExample = - discovery.getTrainingData(queryBuilder.build()).execute().getResult(); - int startingCount = queryWithAddedExample.getExamples().size(); - - DeleteTrainingExampleOptions.Builder deleteBuilder = - new DeleteTrainingExampleOptions.Builder(environmentId, collectionId, queryId, exampleId); - discovery.deleteTrainingExample(deleteBuilder.build()).execute(); - - GetTrainingDataOptions.Builder newQueryBuilder = - new GetTrainingDataOptions.Builder(environmentId, collectionId, queryId); - TrainingQuery queryWithDeletedExample = - discovery.getTrainingData(newQueryBuilder.build()).execute().getResult(); - - assertTrue(startingCount > queryWithDeletedExample.getExamples().size()); - } - - /** Gets the training data is successful. */ - @Test - public void getTrainingDataIsSuccessful() { - String naturalLanguageQuery = "Query" + UUID.randomUUID().toString(); - TrainingQuery newQuery = createTestQuery(collectionId, naturalLanguageQuery); - String queryId = newQuery.getQueryId(); - - GetTrainingDataOptions.Builder queryBuilder = - new GetTrainingDataOptions.Builder(environmentId, collectionId, queryId); - TrainingQuery queryResponse = - discovery.getTrainingData(queryBuilder.build()).execute().getResult(); - - assertEquals(queryResponse.getNaturalLanguageQuery(), naturalLanguageQuery); - } - - /** Gets the training example is successful. */ - @Test - public void getTrainingExampleIsSuccessful() { - AddTrainingDataOptions.Builder builder = - new AddTrainingDataOptions.Builder(environmentId, collectionId); - String naturalLanguageQuery = "Query" + UUID.randomUUID().toString(); - builder.naturalLanguageQuery(naturalLanguageQuery); - String documentId = "Document" + UUID.randomUUID().toString(); - int relevance = 0; - TrainingExample example = - new TrainingExample.Builder().documentId(documentId).relevance(relevance).build(); - builder.addExamples(example); - TrainingQuery response = discovery.addTrainingData(builder.build()).execute().getResult(); - String queryId = response.getQueryId(); - - GetTrainingExampleOptions.Builder getExampleBuilder = - new GetTrainingExampleOptions.Builder(environmentId, collectionId, queryId, documentId); - TrainingExample returnedExample = - discovery.getTrainingExample(getExampleBuilder.build()).execute().getResult(); - - assertEquals(returnedExample.documentId(), documentId); - } - - /** Update training example is successful. */ - @Test - public void updateTrainingExampleIsSuccessful() { - AddTrainingDataOptions.Builder builder = - new AddTrainingDataOptions.Builder(environmentId, collectionId); - String naturalLanguageQuery = "Query" + UUID.randomUUID().toString(); - builder.naturalLanguageQuery(naturalLanguageQuery); - String documentId = "Document" + UUID.randomUUID().toString(); - int relevance = 0; - TrainingExample example = - new TrainingExample.Builder().documentId(documentId).relevance(relevance).build(); - builder.addExamples(example); - TrainingQuery response = discovery.addTrainingData(builder.build()).execute().getResult(); - String queryId = response.getQueryId(); - - UpdateTrainingExampleOptions.Builder updateBuilder = - new UpdateTrainingExampleOptions.Builder(environmentId, collectionId, queryId, documentId); - String newCrossReference = "cross_reference"; - updateBuilder.crossReference(newCrossReference); - int newRelevance = 50; - updateBuilder.relevance(newRelevance); - TrainingExample updatedExample = - discovery.updateTrainingExample(updateBuilder.build()).execute().getResult(); - - assertEquals(updatedExample.crossReference(), newCrossReference); - assertEquals(updatedExample.relevance(), new Long(newRelevance)); - } - - /** Expansions operations are successful. */ - @Test - public void expansionsOperationsAreSuccessful() { - List expansion1InputTerms = Arrays.asList("weekday", "week day"); - List expansion1ExpandedTerms = - Arrays.asList("monday", "tuesday", "wednesday", "thursday", "friday"); - List expansion2InputTerms = Arrays.asList("weekend", "week end"); - List expansion2ExpandedTerms = Arrays.asList("saturday", "sunday"); - Expansion expansion1 = - new Expansion.Builder() - .inputTerms(expansion1InputTerms) - .expandedTerms(expansion1ExpandedTerms) - .build(); - Expansion expansion2 = - new Expansion.Builder() - .inputTerms(expansion2InputTerms) - .expandedTerms(expansion2ExpandedTerms) - .build(); - Expansions expansions = - new Expansions.Builder().expansions(Arrays.asList(expansion1, expansion2)).build(); - CreateExpansionsOptions createOptions = - new CreateExpansionsOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .expansions(expansions) - .build(); - try { - Expansions createResults = discovery.createExpansions(createOptions).execute().getResult(); - assertEquals(createResults.expansions().size(), 2); - assertEquals(createResults.expansions().get(0).inputTerms(), expansion1InputTerms); - assertEquals(createResults.expansions().get(0).expandedTerms(), expansion1ExpandedTerms); - assertEquals(createResults.expansions().get(1).inputTerms(), expansion2InputTerms); - assertEquals(createResults.expansions().get(1).expandedTerms(), expansion2ExpandedTerms); - - ListExpansionsOptions listOptions = - new ListExpansionsOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .build(); - Expansions listResults = discovery.listExpansions(listOptions).execute().getResult(); - - assertEquals(listResults.expansions().size(), 2); - - DeleteExpansionsOptions deleteOptions = - new DeleteExpansionsOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .build(); - discovery.deleteExpansions(deleteOptions).execute(); - - Expansions emptyListResults = discovery.listExpansions(listOptions).execute().getResult(); - - assertTrue( - emptyListResults.expansions().get(0).inputTerms() == null - || emptyListResults.expansions().get(0).inputTerms().isEmpty()); - assertTrue( - emptyListResults.expansions().get(0).expandedTerms() == null - || emptyListResults.expansions().get(0).expandedTerms().get(0).isEmpty()); - } catch (InternalServerErrorException e) { - /** - * System.out.println( "Internal server error while trying to create expansion ¯\\_(ツ)_/¯ - * Probably not our issue" + " but may be worth looking into."); * - */ - e.printStackTrace(); - } - } - - /** Delete user data is successful. */ - @Test - public void deleteUserDataIsSuccessful() { - String customerId = "java_sdk_test_id"; - - try { - DeleteUserDataOptions deleteOptions = - new DeleteUserDataOptions.Builder().customerId(customerId).build(); - discovery.deleteUserData(deleteOptions).execute(); - } catch (Exception ex) { - fail(ex.getMessage()); - } - } - - /** Credentials operations are successful. */ - @Test - public void credentialsOperationsAreSuccessful() { - String url = "https://login.salesforce.com"; - String username = "test@username.com"; - String password = "test_password"; // pragma: whitelist secret - CredentialDetails credentialDetails = - new CredentialDetails.Builder() - .credentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD) - .url(url) - .username(username) - .password(password) - .build(); - Credentials credentials = - new Credentials.Builder() - .sourceType(Credentials.SourceType.SALESFORCE) - .credentialDetails(credentialDetails) - .build(); - - CreateCredentialsOptions createOptions = - new CreateCredentialsOptions.Builder() - .environmentId(environmentId) - .credentials(credentials) - .build(); - Credentials createdCredentials = - discovery.createCredentials(createOptions).execute().getResult(); - String credentialId = createdCredentials.credentialId(); - - // Create assertions - assertEquals(Credentials.SourceType.SALESFORCE, createdCredentials.sourceType()); - assertEquals( - CredentialDetails.CredentialType.USERNAME_PASSWORD, - createdCredentials.credentialDetails().credentialType()); - assertEquals(url, createdCredentials.credentialDetails().url()); - assertEquals(username, createdCredentials.credentialDetails().username()); - - String newUrl = "https://newlogin.salesforce.com"; - CredentialDetails updatedDetails = - new CredentialDetails.Builder() - .credentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD) - .url(newUrl) - .username(username) - .password(password) - .build(); - - UpdateCredentialsOptions updateOptions = - new UpdateCredentialsOptions.Builder() - .environmentId(environmentId) - .credentialId(credentialId) - .sourceType(Credentials.SourceType.SALESFORCE) - .credentialDetails(updatedDetails) - .build(); - Credentials updatedCredentials = - discovery.updateCredentials(updateOptions).execute().getResult(); - - // Update assertion - assertEquals(newUrl, updatedCredentials.credentialDetails().url()); - - GetCredentialsOptions getOptions = - new GetCredentialsOptions.Builder() - .environmentId(environmentId) - .credentialId(credentialId) - .build(); - Credentials retrievedCredentials = discovery.getCredentials(getOptions).execute().getResult(); - - // Get assertions - assertEquals(Credentials.SourceType.SALESFORCE, retrievedCredentials.sourceType()); - assertEquals( - CredentialDetails.CredentialType.USERNAME_PASSWORD, - retrievedCredentials.credentialDetails().credentialType()); - assertEquals(newUrl, retrievedCredentials.credentialDetails().url()); - assertEquals(username, retrievedCredentials.credentialDetails().username()); - - ListCredentialsOptions listOptions = - new ListCredentialsOptions.Builder().environmentId(environmentId).build(); - CredentialsList credentialsList = discovery.listCredentials(listOptions).execute().getResult(); - - // List assertion - assertTrue(!credentialsList.getCredentials().isEmpty()); - - DeleteCredentialsOptions deleteOptions = - new DeleteCredentialsOptions.Builder() - .environmentId(environmentId) - .credentialId(credentialId) - .build(); - discovery.deleteCredentials(deleteOptions).execute(); - } - - /** Creates the event is successful. */ - @Test - public void createEventIsSuccessful() { - // create test document - DocumentAccepted accepted = createTestDocument(collectionId); - - // make query to get session_token - QueryOptions queryOptions = - new QueryOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .naturalLanguageQuery("field number 1") - .build(); - QueryResponse queryResponse = discovery.query(queryOptions).execute().getResult(); - String sessionToken = queryResponse.getSessionToken(); - - // make createEvent call - EventData eventData = - new EventData.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .documentId(accepted.getDocumentId()) - .sessionToken(sessionToken) - .build(); - CreateEventOptions createEventOptions = - new CreateEventOptions.Builder() - .type(CreateEventOptions.Type.CLICK) - .data(eventData) - .build(); - CreateEventResponse response = discovery.createEvent(createEventOptions).execute().getResult(); - - assertNotNull(response); - } - - /** Query log is successful. */ - // @Test - public void queryLogIsSuccessful() { - LogQueryResponse response = discovery.queryLog().execute().getResult(); - assertNotNull(response); - } - - /** Gets the metrics event rate is successful. */ - // @Test - public void getMetricsEventRateIsSuccessful() { - MetricResponse response = discovery.getMetricsEventRate().execute().getResult(); - assertNotNull(response); - } - - /** Gets the metrics query is successful. */ - // @Test - public void getMetricsQueryIsSuccessful() { - MetricResponse response = discovery.getMetricsQuery().execute().getResult(); - assertNotNull(response); - } - - /** Gets the metrics query event is successful. */ - // @Test - public void getMetricsQueryEventIsSuccessful() { - MetricResponse response = discovery.getMetricsQueryEvent().execute().getResult(); - assertNotNull(response); - } - - /** Gets the metrics query no results is successful. */ - // @Test - public void getMetricsQueryNoResultsIsSuccessful() { - MetricResponse response = discovery.getMetricsQueryNoResults().execute().getResult(); - assertNotNull(response); - } - - /** Gets the metrics query token event is successful. */ - // @Test - public void getMetricsQueryTokenEventIsSuccessful() { - MetricTokenResponse response = discovery.getMetricsQueryTokenEvent().execute().getResult(); - assertNotNull(response); - } - - /** - * Tokenization dictionary operations are successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void tokenizationDictionaryOperationsAreSuccessful() throws InterruptedException { - // create collection first because creating a tokenization dictionary currently is only - // supported in Japanese - // collections - CreateCollectionOptions createCollectionOptions = - new CreateCollectionOptions.Builder() - .environmentId(environmentId) - .name("tokenization-dict-testing-collection " + UUID.randomUUID().toString()) - .language(CreateCollectionOptions.Language.JA) - .build(); - Collection tokenDictTestCollection = - discovery.createCollection(createCollectionOptions).execute().getResult(); - String testCollectionId = tokenDictTestCollection.getCollectionId(); - - // System.out.println("Test collection created!"); - - try { - TokenDictRule tokenDictRule = - new TokenDictRule.Builder() - .text("token") - .partOfSpeech("noun") - .readings(Arrays.asList("reading_1", "reading_2")) - .tokens(Arrays.asList("token_1", "token_2")) - .build(); - - // the service doesn't seem to like when we try and move too fast - Thread.sleep(5000); - - // test creating tokenization dictionary - CreateTokenizationDictionaryOptions createOptions = - new CreateTokenizationDictionaryOptions.Builder() - .environmentId(environmentId) - .collectionId(testCollectionId) - .addTokenizationRules(tokenDictRule) - .build(); - TokenDictStatusResponse createResponse = - discovery.createTokenizationDictionary(createOptions).execute().getResult(); - assertNotNull(createResponse); - - // test getting tokenization dictionary - GetTokenizationDictionaryStatusOptions getOptions = - new GetTokenizationDictionaryStatusOptions.Builder() - .environmentId(environmentId) - .collectionId(testCollectionId) - .build(); - TokenDictStatusResponse getResponse = - discovery.getTokenizationDictionaryStatus(getOptions).execute().getResult(); - assertNotNull(getResponse); - - Thread.sleep(5000); - - // test deleting tokenization dictionary - DeleteTokenizationDictionaryOptions deleteOptions = - new DeleteTokenizationDictionaryOptions.Builder() - .environmentId(environmentId) - .collectionId(testCollectionId) - .build(); - discovery.deleteTokenizationDictionary(deleteOptions).execute(); - } catch (BadRequestException ex) { - // this most likely means the environment wasn't ready to handle another tokenization file - - // this is fine - // System.out.println("Service wasn't ready yet! Error: " + ex.getMessage()); - } finally { - // delete test collection - DeleteCollectionOptions deleteCollectionOptions = - new DeleteCollectionOptions.Builder() - .environmentId(environmentId) - .collectionId(testCollectionId) - .build(); - discovery.deleteCollection(deleteCollectionOptions).execute(); - - // System.out.println("Test collection deleted"); - } - } - - /** - * Stopword list operations are successful. - * - * @throws FileNotFoundException the file not found exception - * @throws InterruptedException the interrupted exception - */ - @Test - public void stopwordListOperationsAreSuccessful() - throws FileNotFoundException, InterruptedException { - CreateCollectionOptions createCollectionOptions = - new CreateCollectionOptions.Builder() - .environmentId(environmentId) - .name("stopword-list-testing-collection " + UUID.randomUUID().toString()) - .language(CreateCollectionOptions.Language.EN) - .build(); - Collection tokenDictTestCollection = - discovery.createCollection(createCollectionOptions).execute().getResult(); - String testCollectionId = tokenDictTestCollection.getCollectionId(); - // System.out.println("Test collection created!"); - - try { - CreateStopwordListOptions createStopwordListOptions = - new CreateStopwordListOptions.Builder() - .environmentId(environmentId) - .collectionId(testCollectionId) - .stopwordFile(new FileInputStream(STOPWORDS_TEST_FILE)) - .stopwordFilename("test_stopword_file") - .build(); - TokenDictStatusResponse createResponse = - discovery.createStopwordList(createStopwordListOptions).execute().getResult(); - assertEquals("stopwords", createResponse.getType()); - - GetStopwordListStatusOptions getStopwordListStatusOptions = - new GetStopwordListStatusOptions.Builder() - .environmentId(environmentId) - .collectionId(testCollectionId) - .build(); - TokenDictStatusResponse getResponse = - discovery.getStopwordListStatus(getStopwordListStatusOptions).execute().getResult(); - assertEquals("stopwords", getResponse.getType()); - - DeleteStopwordListOptions deleteStopwordListOptions = - new DeleteStopwordListOptions.Builder() - .environmentId(environmentId) - .collectionId(testCollectionId) - .build(); - discovery.deleteStopwordList(deleteStopwordListOptions).execute(); - } catch (BadRequestException ex) { - // this most likely means the environment wasn't ready to handle another stopwords file - this - // is fine - // System.out.println("Service wasn't ready yet! Error: " + ex.getMessage()); - } finally { - DeleteCollectionOptions deleteCollectionOptions = - new DeleteCollectionOptions.Builder() - .environmentId(environmentId) - .collectionId(testCollectionId) - .build(); - discovery.deleteCollection(deleteCollectionOptions).execute(); - // System.out.println("Test collection deleted"); - } - } - - /** Gateway operations are successful. */ - @Test - public void gatewayOperationsAreSuccessful() { - String gatewayName = "java-sdk-test-gateway"; - - ListGatewaysOptions listGatewaysOptions = - new ListGatewaysOptions.Builder().environmentId(environmentId).build(); - GatewayList gatewayList = discovery.listGateways(listGatewaysOptions).execute().getResult(); - assertNotNull(gatewayList); - int originalListSize = gatewayList.getGateways().size(); - - CreateGatewayOptions createGatewayOptions = - new CreateGatewayOptions.Builder().environmentId(environmentId).name(gatewayName).build(); - Gateway gatewayResponse = discovery.createGateway(createGatewayOptions).execute().getResult(); - assertNotNull(gatewayResponse); - assertEquals(gatewayName, gatewayResponse.getName()); - String testGatewayId = gatewayResponse.getGatewayId(); - - gatewayList = discovery.listGateways(listGatewaysOptions).execute().getResult(); - assertTrue(gatewayList.getGateways().size() > originalListSize); - - GetGatewayOptions getGatewayOptions = - new GetGatewayOptions.Builder() - .environmentId(environmentId) - .gatewayId(testGatewayId) - .build(); - Gateway getGatewayResponse = discovery.getGateway(getGatewayOptions).execute().getResult(); - assertNotNull(getGatewayResponse); - assertEquals(gatewayName, getGatewayResponse.getName()); - - DeleteGatewayOptions deleteGatewayOptions = - new DeleteGatewayOptions.Builder() - .environmentId(environmentId) - .gatewayId(testGatewayId) - .build(); - discovery.deleteGateway(deleteGatewayOptions).execute(); - } - - private Environment createEnvironment(CreateEnvironmentOptions createOptions) { - return discovery.createEnvironment(createOptions).execute().getResult(); - } - - private void deleteEnvironment(DeleteEnvironmentOptions deleteOptions) { - discovery.deleteEnvironment(deleteOptions).execute(); - } - - private Configuration createConfiguration(CreateConfigurationOptions createOptions) { - Configuration createResponse = - discovery.createConfiguration(createOptions).execute().getResult(); - configurationIds.add(createResponse.configurationId()); - return createResponse; - } - - private void deleteConfiguration(DeleteConfigurationOptions deleteOptions) { - discovery.deleteConfiguration(deleteOptions).execute(); - configurationIds.remove(deleteOptions.configurationId()); - } - - private Configuration createTestConfig() { - String uniqueConfigName = uniqueName + "-config"; - CreateConfigurationOptions.Builder createBuilder = - new CreateConfigurationOptions.Builder(environmentId, uniqueConfigName); - return createConfiguration(createBuilder.build()); - } - - private Collection createCollection(CreateCollectionOptions createOptions) { - Collection createResponse = discovery.createCollection(createOptions).execute().getResult(); - collectionIds.add(createResponse.getCollectionId()); - return createResponse; - } - - private void deleteCollection(DeleteCollectionOptions deleteOptions) { - discovery.deleteCollection(deleteOptions).execute(); - collectionIds.remove(deleteOptions.collectionId()); - } - - private Collection createTestCollection() { - Configuration createConfigResponse = createTestConfig(); - - String uniqueCollectionName = "java-sdk-" + uniqueName + "-collection"; - CreateCollectionOptions.Builder createCollectionBuilder = - new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName) - .configurationId(createConfigResponse.configurationId()); - return createCollection(createCollectionBuilder.build()); - } - - private DocumentAccepted createNestedTestDocument(String collectionId) { - String myDocumentJson = "{\"nested_fields\":{\"field\":\"value\"}}"; - return createTestDocument(myDocumentJson, UUID.randomUUID().toString(), collectionId); - } - - private DocumentAccepted createTestDocument(String collectionId) { - String myDocumentJson = "{\"field\":\"value\"}"; - return createTestDocument(myDocumentJson, UUID.randomUUID().toString(), collectionId); - } - - private DocumentAccepted createTestDocument(String filename, String collectionId) { - String myDocumentJson = "{\"field\":\"value\"}"; - return createTestDocument(myDocumentJson, filename, collectionId); - } - - @SuppressWarnings("deprecation") - private DocumentAccepted createTestDocument(String json, String filename, String collectionId) { - InputStream documentStream = new ByteArrayInputStream(json.getBytes()); - AddDocumentOptions.Builder builder = - new AddDocumentOptions.Builder(environmentId, collectionId); - builder.file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON); - builder.filename(filename); - DocumentAccepted createResponse = discovery.addDocument(builder.build()).execute().getResult(); - WaitFor.Condition documentAccepted = - new WaitForDocumentAccepted(environmentId, collectionId, createResponse.getDocumentId()); - WaitFor.waitFor(documentAccepted, 5, TimeUnit.SECONDS, 500); - return createResponse; - } - - private List createTestDocuments(String collectionId, int totalDocuments) { - List responses = new ArrayList(); - String baseDocumentJson = "{\"field\":"; - for (int i = 0; i < totalDocuments; i++) { - String json = baseDocumentJson + i + "}"; - String filename = "test_document_" + i; - responses.add(createTestDocument(json, filename, collectionId)); - } - return responses; - } - - private synchronized String setupTestDocuments() { - if (collectionId != null) { - return collectionId; - } - Collection collection = createTestCollection(); - String collectionId = collection.getCollectionId(); - @SuppressWarnings("unused") - List documentAccepted = createTestDocuments(collectionId, 10); - - WaitFor.Condition collectionAvailable = - new WaitForCollectionAvailable(environmentId, collectionId); - WaitFor.waitFor(collectionAvailable, 5, TimeUnit.SECONDS, 500); - - return collectionId; - } - - private TrainingQuery createTestQuery(String collectionId, String naturalLanguageQuery) { - AddTrainingDataOptions.Builder builder = - new AddTrainingDataOptions.Builder(environmentId, collectionId); - builder.naturalLanguageQuery(naturalLanguageQuery); - return discovery.addTrainingData(builder.build()).execute().getResult(); - } - - private List createTestQueries(String collectionId, int totalQueries) { - List responses = new ArrayList<>(); - for (int i = 0; i < totalQueries; i++) { - String naturalLanguageQuery = "Test query " + i; - responses.add(createTestQuery(collectionId, naturalLanguageQuery)); - } - return responses; - } - - private synchronized String setupTestQueries(String collectionId) { - ListTrainingDataOptions.Builder builder = - new ListTrainingDataOptions.Builder(environmentId, collectionId); - if (discovery.listTrainingData(builder.build()).execute().getResult().getQueries().size() > 0) { - return collectionId; - } - createTestQueries(collectionId, 10); - - WaitFor.Condition collectionAvailable = - new WaitForCollectionAvailable(environmentId, collectionId); - WaitFor.waitFor(collectionAvailable, 5, TimeUnit.SECONDS, 500); - - return collectionId; - } - - /** - * Gets the test configuration. - * - * @param jsonFile the json file - */ - public static Configuration getTestConfiguration(String jsonFile) { - try { - return GsonSingleton.getGson().fromJson(new FileReader(jsonFile), Configuration.class); - } catch (FileNotFoundException e) { - return null; - } - } - - private static class EnvironmentReady implements WaitFor.Condition { - private final Discovery discovery; - private final String environmentId; - - private EnvironmentReady(Discovery discovery, String environmentId) { - this.discovery = discovery; - this.environmentId = environmentId; - } - - @Override - public boolean isSatisfied() { - GetEnvironmentOptions getOptions = new GetEnvironmentOptions.Builder(environmentId).build(); - String status = discovery.getEnvironment(getOptions).execute().getResult().getStatus(); - return status.equals(Environment.Status.ACTIVE); - } - } - - private class WaitForDocumentAccepted implements WaitFor.Condition { - WaitForDocumentAccepted(String environmentId, String collectionId, String documentId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - this.documentId = documentId; - } - - @Override - public boolean isSatisfied() { - GetDocumentStatusOptions getOptions = - new GetDocumentStatusOptions.Builder(environmentId, collectionId, documentId).build(); - String status = discovery.getDocumentStatus(getOptions).execute().getResult().getStatus(); - return status.equals(DocumentStatus.Status.AVAILABLE); - } - - private final String environmentId; - private final String collectionId; - private final String documentId; - } - - private class WaitForCollectionAvailable implements WaitFor.Condition { - WaitForCollectionAvailable(String environmentId, String collectionId) { - this.environmentId = environmentId; - this.collectionId = collectionId; - } - - @Override - public boolean isSatisfied() { - GetCollectionOptions getOptions = - new GetCollectionOptions.Builder(environmentId, collectionId).build(); - Collection collectionResult = discovery.getCollection(getOptions).execute().getResult(); - String status = collectionResult.getStatus(); - return status.equals(Collection.Status.ACTIVE); - } - - private final String environmentId; - private final String collectionId; - } - - /** This only works on a Cloud Pak for Data instance, so ignoring to just run manually. */ - @Test - @Ignore - public void testQueryWithSpellingSuggestions() { - Authenticator authenticator = new BearerTokenAuthenticator(""); // fill in - Discovery service = new Discovery("2019-10-03", authenticator); - service.setServiceUrl(""); - - HttpConfigOptions configOptions = - new HttpConfigOptions.Builder().disableSslVerification(true).build(); - service.configureClient(configOptions); - - QueryOptions options = - new QueryOptions.Builder() - .naturalLanguageQuery("cluod") - .spellingSuggestions(true) - .environmentId("") // fill in - .collectionId("") // fill in - .build(); - QueryResponse response = service.query(options).execute().getResult(); - // System.out.println(response); - } - - /** This only works on a Cloud Pak for Data instance, so ignoring to just run manually. */ - @Test - @Ignore - public void testGetAutocompletion() { - Authenticator authenticator = new BearerTokenAuthenticator(""); // fill in - Discovery service = new Discovery("2019-10-03", authenticator); - service.setServiceUrl(""); - - HttpConfigOptions configOptions = - new HttpConfigOptions.Builder().disableSslVerification(true).build(); - service.configureClient(configOptions); - - GetAutocompletionOptions options = - new GetAutocompletionOptions.Builder() - .environmentId("") // fill in - .collectionId("") // fill in - .prefix("Ba") - .count(10L) - .build(); - Completions response = service.getAutocompletion(options).execute().getResult(); - // System.out.println(response); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceTest.java deleted file mode 100644 index 381ce68bcf2..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryServiceTest.java +++ /dev/null @@ -1,2553 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2019, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import com.google.gson.JsonIOException; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSyntaxException; -import com.ibm.cloud.sdk.core.http.HttpMediaType; -import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; -import com.ibm.cloud.sdk.core.util.GsonSingleton; -import com.ibm.watson.common.WatsonServiceUnitTest; -import com.ibm.watson.discovery.query.AggregationType; -import com.ibm.watson.discovery.query.Operator; -import com.ibm.watson.discovery.v1.model.AddDocumentOptions; -import com.ibm.watson.discovery.v1.model.AddTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.Collection; -import com.ibm.watson.discovery.v1.model.Configuration; -import com.ibm.watson.discovery.v1.model.Conversions; -import com.ibm.watson.discovery.v1.model.CreateCollectionOptions; -import com.ibm.watson.discovery.v1.model.CreateConfigurationOptions; -import com.ibm.watson.discovery.v1.model.CreateCredentialsOptions; -import com.ibm.watson.discovery.v1.model.CreateEnvironmentOptions; -import com.ibm.watson.discovery.v1.model.CreateEventOptions; -import com.ibm.watson.discovery.v1.model.CreateEventResponse; -import com.ibm.watson.discovery.v1.model.CreateExpansionsOptions; -import com.ibm.watson.discovery.v1.model.CreateGatewayOptions; -import com.ibm.watson.discovery.v1.model.CreateStopwordListOptions; -import com.ibm.watson.discovery.v1.model.CreateTokenizationDictionaryOptions; -import com.ibm.watson.discovery.v1.model.CreateTrainingExampleOptions; -import com.ibm.watson.discovery.v1.model.CredentialDetails; -import com.ibm.watson.discovery.v1.model.Credentials; -import com.ibm.watson.discovery.v1.model.CredentialsList; -import com.ibm.watson.discovery.v1.model.DeleteAllTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.DeleteCollectionOptions; -import com.ibm.watson.discovery.v1.model.DeleteCollectionResponse; -import com.ibm.watson.discovery.v1.model.DeleteConfigurationOptions; -import com.ibm.watson.discovery.v1.model.DeleteConfigurationResponse; -import com.ibm.watson.discovery.v1.model.DeleteCredentials; -import com.ibm.watson.discovery.v1.model.DeleteCredentialsOptions; -import com.ibm.watson.discovery.v1.model.DeleteDocumentOptions; -import com.ibm.watson.discovery.v1.model.DeleteDocumentResponse; -import com.ibm.watson.discovery.v1.model.DeleteEnvironmentOptions; -import com.ibm.watson.discovery.v1.model.DeleteEnvironmentResponse; -import com.ibm.watson.discovery.v1.model.DeleteExpansionsOptions; -import com.ibm.watson.discovery.v1.model.DeleteGatewayOptions; -import com.ibm.watson.discovery.v1.model.DeleteStopwordListOptions; -import com.ibm.watson.discovery.v1.model.DeleteTokenizationDictionaryOptions; -import com.ibm.watson.discovery.v1.model.DeleteTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.DeleteTrainingExampleOptions; -import com.ibm.watson.discovery.v1.model.DeleteUserDataOptions; -import com.ibm.watson.discovery.v1.model.DocumentAccepted; -import com.ibm.watson.discovery.v1.model.DocumentStatus; -import com.ibm.watson.discovery.v1.model.Enrichment; -import com.ibm.watson.discovery.v1.model.Environment; -import com.ibm.watson.discovery.v1.model.EventData; -import com.ibm.watson.discovery.v1.model.Expansion; -import com.ibm.watson.discovery.v1.model.Expansions; -import com.ibm.watson.discovery.v1.model.FederatedQueryNoticesOptions; -import com.ibm.watson.discovery.v1.model.FederatedQueryOptions; -import com.ibm.watson.discovery.v1.model.Gateway; -import com.ibm.watson.discovery.v1.model.GatewayDelete; -import com.ibm.watson.discovery.v1.model.GatewayList; -import com.ibm.watson.discovery.v1.model.GetCollectionOptions; -import com.ibm.watson.discovery.v1.model.GetConfigurationOptions; -import com.ibm.watson.discovery.v1.model.GetCredentialsOptions; -import com.ibm.watson.discovery.v1.model.GetDocumentStatusOptions; -import com.ibm.watson.discovery.v1.model.GetEnvironmentOptions; -import com.ibm.watson.discovery.v1.model.GetGatewayOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsEventRateOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsQueryEventOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsQueryNoResultsOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsQueryOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsQueryTokenEventOptions; -import com.ibm.watson.discovery.v1.model.GetStopwordListStatusOptions; -import com.ibm.watson.discovery.v1.model.GetTokenizationDictionaryStatusOptions; -import com.ibm.watson.discovery.v1.model.GetTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.GetTrainingExampleOptions; -import com.ibm.watson.discovery.v1.model.ListCollectionFieldsOptions; -import com.ibm.watson.discovery.v1.model.ListCollectionFieldsResponse; -import com.ibm.watson.discovery.v1.model.ListCollectionsOptions; -import com.ibm.watson.discovery.v1.model.ListCollectionsResponse; -import com.ibm.watson.discovery.v1.model.ListConfigurationsOptions; -import com.ibm.watson.discovery.v1.model.ListConfigurationsResponse; -import com.ibm.watson.discovery.v1.model.ListCredentialsOptions; -import com.ibm.watson.discovery.v1.model.ListEnvironmentsResponse; -import com.ibm.watson.discovery.v1.model.ListExpansionsOptions; -import com.ibm.watson.discovery.v1.model.ListFieldsOptions; -import com.ibm.watson.discovery.v1.model.ListGatewaysOptions; -import com.ibm.watson.discovery.v1.model.ListTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.ListTrainingExamplesOptions; -import com.ibm.watson.discovery.v1.model.LogQueryResponse; -import com.ibm.watson.discovery.v1.model.MetricResponse; -import com.ibm.watson.discovery.v1.model.MetricTokenResponse; -import com.ibm.watson.discovery.v1.model.NormalizationOperation; -import com.ibm.watson.discovery.v1.model.QueryLogOptions; -import com.ibm.watson.discovery.v1.model.QueryNoticesOptions; -import com.ibm.watson.discovery.v1.model.QueryNoticesResponse; -import com.ibm.watson.discovery.v1.model.QueryOptions; -import com.ibm.watson.discovery.v1.model.QueryResponse; -import com.ibm.watson.discovery.v1.model.Source; -import com.ibm.watson.discovery.v1.model.SourceOptions; -import com.ibm.watson.discovery.v1.model.SourceOptionsBuckets; -import com.ibm.watson.discovery.v1.model.SourceOptionsFolder; -import com.ibm.watson.discovery.v1.model.SourceOptionsObject; -import com.ibm.watson.discovery.v1.model.SourceOptionsSiteColl; -import com.ibm.watson.discovery.v1.model.SourceOptionsWebCrawl; -import com.ibm.watson.discovery.v1.model.TokenDictRule; -import com.ibm.watson.discovery.v1.model.TokenDictStatusResponse; -import com.ibm.watson.discovery.v1.model.TrainingDataSet; -import com.ibm.watson.discovery.v1.model.TrainingExample; -import com.ibm.watson.discovery.v1.model.TrainingExampleList; -import com.ibm.watson.discovery.v1.model.TrainingQuery; -import com.ibm.watson.discovery.v1.model.UpdateConfigurationOptions; -import com.ibm.watson.discovery.v1.model.UpdateCredentialsOptions; -import com.ibm.watson.discovery.v1.model.UpdateDocumentOptions; -import com.ibm.watson.discovery.v1.model.UpdateEnvironmentOptions; -import com.ibm.watson.discovery.v1.model.UpdateTrainingExampleOptions; -import java.io.ByteArrayInputStream; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.RecordedRequest; -import org.junit.*; - -/** Unit tests for {@link Discovery}. */ -@Ignore -public class DiscoveryServiceTest extends WatsonServiceUnitTest { - private Discovery discoveryService; - - private static final String VERSION = "2019-04-30"; - - private static final String RESOURCE = "src/test/resources/discovery/v1/"; - private static final String DISCOVERY_TEST_CONFIG_FILE = RESOURCE + "test-config.json"; - private static final String ENV1_PATH = "/v1/environments/mock_envid?version=" + VERSION; - private static final String ENV2_PATH = "/v1/environments?version=" + VERSION; - private static final String CONF1_PATH = - "/v1/environments/mock_envid/configurations?version=" + VERSION; - private static final String CONF2_PATH = - "/v1/environments/mock_envid/configurations/mock_confid?version=" + VERSION; - private static final String COLL1_PATH = - "/v1/environments/mock_envid/collections?version=" + VERSION; - private static final String COLL2_PATH = - "/v1/environments/mock_envid/collections/mock_collid?version=" + VERSION; - private static final String COLL3_PATH = - "/v1/environments/mock_envid/collections/mock_collid/fields?version=" + VERSION; - private static final String DOCS1_PATH = - "/v1/environments/mock_envid/collections/mock_collid/documents?version=" + VERSION; - private static final String DOCS2_PATH = - "/v1/environments/mock_envid/collections/mock_collid/documents/mock_docid?version=" + VERSION; - private static final String Q1_PATH = - "/v1/environments/mock_envid/collections/mock_collid/query?version=" + VERSION; - private static final String Q2_PATH = "/v1/environments/mock_envid/query?version=" + VERSION; - private static final String Q3_PATH = - "/v1/environments/mock_envid/notices?version=" + VERSION + "&collection_ids=mock_collid"; - private static final String Q4_PATH = - "/v1/environments/mock_envid/collections/mock_collid/notices?version=" + VERSION; - private static final String TRAINING1_PATH = - "/v1/environments/mock_envid/collections/mock_collid/training_data?version=" + VERSION; - private static final String TRAINING2_PATH = - "/v1/environments/mock_envid/collections/mock_collid/training_data/mock_queryid/examples?version=" - + VERSION; - private static final String TRAINING3_PATH = - "/v1/environments/mock_envid/collections/mock_collid/training_data/mock_queryid?version=" - + VERSION; - private static final String TRAINING4_PATH = - "/v1/environments/mock_envid/collections/mock_collid/training_data/mock_queryid/examples/mock_docid?version=" - + VERSION; - private static final String FIELD_PATH = - "/v1/environments/mock_envid/fields?version=" + VERSION + "&collection_ids=mock_collid"; - private static final String EXPANSIONS_PATH = - "/v1/environments/mock_envid/collections/mock_collid/expansions?version=" + VERSION; - private static final String DELETE_USER_DATA_PATH = - "/v1/user_data?version=" + VERSION + "&customer_id=java_sdk_test_id"; - private static final String CREATE_CREDENTIALS_PATH = - "/v1/environments/mock_envid/credentials?version=" + VERSION; - private static final String DELETE_CREDENTIALS_PATH = - "/v1/environments/mock_envid/credentials/credential_id?version=" + VERSION; - private static final String GET_CREDENTIALS_PATH = - "/v1/environments/mock_envid/credentials/credential_id?version=" + VERSION; - private static final String LIST_CREDENTIALS_PATH = - "/v1/environments/mock_envid/credentials?version=" + VERSION; - private static final String UPDATE_CREDENTIALS_PATH = - "/v1/environments/mock_envid/credentials/new_credential_id?version=" + VERSION; - private static final String CREATE_EVENT_PATH = "/v1/events?version=" + VERSION; - private static final String GET_METRICS_EVENT_RATE_PATH = - "/v1/metrics/event_rate?version=" + VERSION; - private static final String GET_METRICS_QUERY_PATH = - "/v1/metrics/number_of_queries?version=" + VERSION; - private static final String GET_METRICS_QUERY_EVENT_PATH = - "/v1/metrics/number_of_queries_with_event?version=" + VERSION; - private static final String GET_METRICS_QUERY_NO_RESULTS_PATH = - "/v1/metrics/number_of_queries_with_no_search_results?version=" + VERSION; - private static final String GET_METRICS_QUERY_TOKEN_EVENT_PATH = - "/v1/metrics/top_query_tokens_with_event_rate?version=" + VERSION; - private static final String QUERY_LOG_PATH = "/v1/logs?version=" + VERSION; - - private String environmentId; - private String environmentName; - private String environmentDesc; - private String uniqueConfigName; - private String configurationId; - private String uniqueCollectionName; - private String collectionId; - private String documentId; - private String queryId; - private Date date; - private InputStream testStream; - - private Environment envResp; - private ListEnvironmentsResponse envsResp; - private Environment createEnvResp; - private DeleteEnvironmentResponse deleteEnvResp; - private Environment updateEnvResp; - private Configuration createConfResp; - private ListConfigurationsResponse getConfsResp; - private Configuration getConfResp; - private DeleteConfigurationResponse deleteConfResp; - private Configuration updateConfResp; - private Collection createCollResp; - private ListCollectionsResponse getCollsResp; - private Collection getCollResp; - private DeleteCollectionResponse deleteCollResp; - private ListCollectionFieldsResponse listfieldsCollResp; - private DocumentAccepted createDocResp; - private DocumentAccepted updateDocResp; - private DocumentStatus getDocResp; - private DeleteDocumentResponse deleteDocResp; - private QueryResponse queryResp; - private QueryNoticesResponse queryNoticesResp; - private TrainingQuery addTrainingQueryResp; - private TrainingDataSet listTrainingDataResp; - private TrainingExample createTrainingExampleResp; - private TrainingQuery getTrainingDataResp; - private TrainingExample getTrainingExampleResp; - private TrainingExample updateTrainingExampleResp; - private TrainingExampleList listTrainingExamplesResp; - private ListCollectionFieldsResponse listFieldsResp; - private Expansions expansionsResp; - private Credentials credentialsResp; - private CredentialsList listCredentialsResp; - private DeleteCredentials deleteCredentialsResp; - private CreateEventResponse createEventResp; - private MetricResponse metricResp; - private MetricTokenResponse metricTokenResp; - private LogQueryResponse logQueryResp; - private TokenDictStatusResponse tokenDictStatusResponse; - private TokenDictStatusResponse tokenDictStatusResponseStopwords; - private Gateway gatewayResponse; - private GatewayList listGatewaysResponse; - private GatewayDelete deleteGatewayResponse; - - /** Setup class. */ - @BeforeClass - public static void setupClass() {} - - /** - * Setup. - * - * @throws Exception the exception - */ - @Before - public void setup() throws Exception { - super.setUp(); - discoveryService = new Discovery(VERSION, new NoAuthAuthenticator()); - discoveryService.setServiceUrl(getMockWebServerUrl()); - - environmentId = "mock_envid"; - environmentName = "my_environment"; - environmentDesc = "My environment"; - uniqueConfigName = "my-config"; - configurationId = "mock_confid"; - uniqueCollectionName = "mock_collname"; - collectionId = "mock_collid"; - documentId = "mock_docid"; - queryId = "mock_queryid"; - date = new Date(); - testStream = new FileInputStream(RESOURCE + "get_env_resp.json"); - - envResp = loadFixture(RESOURCE + "get_env_resp.json", Environment.class); - envsResp = loadFixture(RESOURCE + "get_envs_resp.json", ListEnvironmentsResponse.class); - createEnvResp = loadFixture(RESOURCE + "create_env_resp.json", Environment.class); - deleteEnvResp = loadFixture(RESOURCE + "delete_env_resp.json", DeleteEnvironmentResponse.class); - updateEnvResp = loadFixture(RESOURCE + "update_env_resp.json", Environment.class); - createConfResp = loadFixture(RESOURCE + "create_conf_resp.json", Configuration.class); - getConfsResp = loadFixture(RESOURCE + "get_confs_resp.json", ListConfigurationsResponse.class); - getConfResp = loadFixture(RESOURCE + "get_conf_resp.json", Configuration.class); - deleteConfResp = - loadFixture(RESOURCE + "delete_conf_resp.json", DeleteConfigurationResponse.class); - updateConfResp = loadFixture(RESOURCE + "update_conf_resp.json", Configuration.class); - createCollResp = loadFixture(RESOURCE + "create_coll_resp.json", Collection.class); - getCollsResp = loadFixture(RESOURCE + "get_coll_resp.json", ListCollectionsResponse.class); - getCollResp = loadFixture(RESOURCE + "get_coll1_resp.json", Collection.class); - deleteCollResp = - loadFixture(RESOURCE + "delete_coll_resp.json", DeleteCollectionResponse.class); - listfieldsCollResp = - loadFixture(RESOURCE + "listfields_coll_resp.json", ListCollectionFieldsResponse.class); - createDocResp = loadFixture(RESOURCE + "create_doc_resp.json", DocumentAccepted.class); - updateDocResp = loadFixture(RESOURCE + "update_doc_resp.json", DocumentAccepted.class); - getDocResp = loadFixture(RESOURCE + "get_doc_resp.json", DocumentStatus.class); - deleteDocResp = loadFixture(RESOURCE + "delete_doc_resp.json", DeleteDocumentResponse.class); - queryResp = loadFixture(RESOURCE + "query1_resp.json", QueryResponse.class); - queryNoticesResp = loadFixture(RESOURCE + "query1_resp.json", QueryNoticesResponse.class); - addTrainingQueryResp = - loadFixture(RESOURCE + "add_training_query_resp.json", TrainingQuery.class); - listTrainingDataResp = - loadFixture(RESOURCE + "list_training_data_resp.json", TrainingDataSet.class); - createTrainingExampleResp = - loadFixture(RESOURCE + "add_training_example_resp.json", TrainingExample.class); - getTrainingDataResp = - loadFixture(RESOURCE + "get_training_data_resp.json", TrainingQuery.class); - getTrainingExampleResp = - loadFixture(RESOURCE + "get_training_example_resp.json", TrainingExample.class); - updateTrainingExampleResp = - loadFixture(RESOURCE + "update_training_example_resp.json", TrainingExample.class); - listTrainingExamplesResp = - loadFixture(RESOURCE + "list_training_examples_resp.json", TrainingExampleList.class); - listFieldsResp = - loadFixture(RESOURCE + "list_fields_resp.json", ListCollectionFieldsResponse.class); - expansionsResp = loadFixture(RESOURCE + "expansions_resp.json", Expansions.class); - credentialsResp = loadFixture(RESOURCE + "credentials_resp.json", Credentials.class); - listCredentialsResp = - loadFixture(RESOURCE + "list_credentials_resp.json", CredentialsList.class); - deleteCredentialsResp = - loadFixture(RESOURCE + "delete_credentials_resp.json", DeleteCredentials.class); - createEventResp = loadFixture(RESOURCE + "create_event_resp.json", CreateEventResponse.class); - metricResp = loadFixture(RESOURCE + "metric_resp.json", MetricResponse.class); - metricTokenResp = loadFixture(RESOURCE + "metric_token_resp.json", MetricTokenResponse.class); - logQueryResp = loadFixture(RESOURCE + "log_query_resp.json", LogQueryResponse.class); - tokenDictStatusResponse = - loadFixture(RESOURCE + "token_dict_status_resp.json", TokenDictStatusResponse.class); - tokenDictStatusResponseStopwords = - loadFixture( - RESOURCE + "token_dict_status_resp_stopwords.json", TokenDictStatusResponse.class); - gatewayResponse = loadFixture(RESOURCE + "gateway_resp.json", Gateway.class); - listGatewaysResponse = loadFixture(RESOURCE + "list_gateways_resp.json", GatewayList.class); - deleteGatewayResponse = loadFixture(RESOURCE + "delete_gateway_resp.json", GatewayDelete.class); - } - - /** Cleanup. */ - @After - public void cleanup() {} - - /** Negative - Test constructor with null version date. */ - @Test(expected = IllegalArgumentException.class) - public void testConstructorWithNullVersionDate() { - new Discovery(null, new NoAuthAuthenticator()); - } - - /** Negative - Test constructor with empty version date. */ - @Test(expected = IllegalArgumentException.class) - public void testConstructorWithEmptyVersionDate() { - new Discovery("", new NoAuthAuthenticator()); - } - - /** - * Gets the environment is successful. - * - * @throws InterruptedException the interrupted exception - */ - // Environment tests - @Test - public void getEnvironmentIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(envResp)); - GetEnvironmentOptions getRequest = new GetEnvironmentOptions.Builder(environmentId).build(); - Environment response = discoveryService.getEnvironment(getRequest).execute().getResult(); - final RecordedRequest request = server.takeRequest(); - - assertEquals(ENV1_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(envResp, response); - } - - /** Gets the environment fails 1. */ - @Test(expected = IllegalArgumentException.class) - public void getEnvironmentFails1() { - GetEnvironmentOptions getRequest = new GetEnvironmentOptions.Builder().build(); - @SuppressWarnings("unused") - Environment response = discoveryService.getEnvironment(getRequest).execute().getResult(); - } - - /** Gets the environment fails 2. */ - @Test(expected = IllegalArgumentException.class) - public void getEnvironmentFails2() { - @SuppressWarnings("unused") - Environment response = discoveryService.getEnvironment(null).execute().getResult(); - } - - /** - * List environments is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void listEnvironmentsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(envsResp)); - ListEnvironmentsResponse response = - discoveryService.listEnvironments(null).execute().getResult(); - final RecordedRequest request = server.takeRequest(); - - assertEquals(ENV2_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(envsResp, response); - } - - // Deleted test for listEnvironments with null name as this does not fail in the current SDK - - /** - * Creates the environment is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void createEnvironmentIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(createEnvResp)); - CreateEnvironmentOptions.Builder createRequestBuilder = - new CreateEnvironmentOptions.Builder() - .name(environmentName) - .size(CreateEnvironmentOptions.Size.XS); - createRequestBuilder.description(environmentDesc); - Environment response = - discoveryService.createEnvironment(createRequestBuilder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(ENV2_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals(createEnvResp, response); - } - - // Deleted test for createEnvironment with null name as this does not fail in the current SDK - - /** - * Delete environment is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void deleteEnvironmentIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(deleteEnvResp)); - DeleteEnvironmentOptions deleteRequest = - new DeleteEnvironmentOptions.Builder(environmentId).build(); - DeleteEnvironmentResponse response = - discoveryService.deleteEnvironment(deleteRequest).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(ENV1_PATH, request.getPath()); - assertEquals(DELETE, request.getMethod()); - assertEquals(deleteEnvResp.getEnvironmentId(), response.getEnvironmentId()); - assertEquals(deleteEnvResp.getStatus(), response.getStatus()); - } - - /** Delete environment fails. */ - @Test(expected = IllegalArgumentException.class) - public void deleteEnvironmentFails() { - discoveryService.deleteEnvironment(null).execute().getResult(); - } - - /** - * Update environment is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void updateEnvironmentIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(updateEnvResp)); - UpdateEnvironmentOptions updateOptions = - new UpdateEnvironmentOptions.Builder(environmentId) - .name(environmentName) - .description(environmentDesc) - .size(UpdateEnvironmentOptions.Size.L) - .build(); - - assertEquals(environmentId, updateOptions.environmentId()); - assertEquals(environmentName, updateOptions.name()); - assertEquals(environmentDesc, updateOptions.description()); - assertEquals(UpdateEnvironmentOptions.Size.L, updateOptions.size()); - - Environment response = discoveryService.updateEnvironment(updateOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(ENV1_PATH, request.getPath()); - assertEquals(PUT, request.getMethod()); - assertEquals(updateEnvResp, response); - } - - /** Test source options. */ - @Test - public void testSourceOptions() { - String folderOwnerUserId = "folder_owner_user_id"; - String folderId = "folder_id"; - Long limit = 10L; - String objectName = "object_name"; - String siteCollectionPath = "site_collection_path"; - String url = "url"; - Long maximumHops = 5L; - Long requestTimeout = 2L; - String bucketName = "bucket_name"; - - SourceOptionsFolder folder = - new SourceOptionsFolder.Builder() - .ownerUserId(folderOwnerUserId) - .folderId(folderId) - .limit(limit) - .build(); - SourceOptionsObject object = - new SourceOptionsObject.Builder().name(objectName).limit(limit).build(); - SourceOptionsSiteColl siteColl = - new SourceOptionsSiteColl.Builder() - .siteCollectionPath(siteCollectionPath) - .limit(limit) - .build(); - SourceOptionsWebCrawl webCrawl = - new SourceOptionsWebCrawl.Builder() - .url(url) - .limitToStartingHosts(true) - .crawlSpeed(SourceOptionsWebCrawl.CrawlSpeed.AGGRESSIVE) - .allowUntrustedCertificate(true) - .maximumHops(maximumHops) - .requestTimeout(requestTimeout) - .overrideRobotsTxt(true) - .build(); - SourceOptionsBuckets buckets = - new SourceOptionsBuckets.Builder().name(bucketName).limit(limit).build(); - SourceOptions sourceOptions = - new SourceOptions.Builder() - .folders(Collections.singletonList(folder)) - .objects(Collections.singletonList(object)) - .siteCollections(Collections.singletonList(siteColl)) - .urls(Collections.singletonList(webCrawl)) - .buckets(Collections.singletonList(buckets)) - .crawlAllBuckets(true) - .build(); - - assertEquals(folderOwnerUserId, sourceOptions.folders().get(0).ownerUserId()); - assertEquals(folderId, sourceOptions.folders().get(0).folderId()); - assertEquals(limit, sourceOptions.folders().get(0).limit()); - assertEquals(objectName, sourceOptions.objects().get(0).name()); - assertEquals(limit, sourceOptions.objects().get(0).limit()); - assertEquals(siteCollectionPath, sourceOptions.siteCollections().get(0).siteCollectionPath()); - assertEquals(limit, sourceOptions.siteCollections().get(0).limit()); - assertEquals(url, sourceOptions.urls().get(0).url()); - assertTrue(sourceOptions.urls().get(0).limitToStartingHosts()); - assertEquals( - SourceOptionsWebCrawl.CrawlSpeed.AGGRESSIVE, sourceOptions.urls().get(0).crawlSpeed()); - assertTrue(sourceOptions.urls().get(0).allowUntrustedCertificate()); - assertEquals(maximumHops, sourceOptions.urls().get(0).maximumHops()); - assertEquals(requestTimeout, sourceOptions.urls().get(0).requestTimeout()); - assertTrue(sourceOptions.urls().get(0).overrideRobotsTxt()); - assertEquals(bucketName, sourceOptions.buckets().get(0).name()); - assertEquals(limit, sourceOptions.buckets().get(0).limit()); - assertTrue(sourceOptions.crawlAllBuckets()); - } - - /** Test create configuration options. */ - // Configuration tests - @Test - public void testCreateConfigurationOptions() { - String name = "name"; - String description = "description"; - Conversions conversions = new Conversions.Builder().build(); - String firstEnrichmentName = "first"; - String secondEnrichmentName = "second"; - String sourceField = "source_field"; - String destinationField = "destination_field"; - List enrichments = new ArrayList<>(); - Enrichment firstEnrichment = - new Enrichment.Builder() - .enrichment(firstEnrichmentName) - .sourceField(sourceField) - .destinationField(destinationField) - .build(); - enrichments.add(firstEnrichment); - Enrichment secondEnrichment = - new Enrichment.Builder() - .enrichment(secondEnrichmentName) - .sourceField(sourceField) - .destinationField(destinationField) - .build(); - List normalizationOperations = new ArrayList<>(); - NormalizationOperation firstOp = - new NormalizationOperation.Builder() - .operation(NormalizationOperation.Operation.MERGE) - .build(); - NormalizationOperation secondOp = - new NormalizationOperation.Builder() - .operation(NormalizationOperation.Operation.COPY) - .build(); - normalizationOperations.add(firstOp); - Source source = new Source.Builder().build(); - - CreateConfigurationOptions createConfigurationOptions = - new CreateConfigurationOptions.Builder() - .environmentId(environmentId) - .name(name) - .description(description) - .conversions(conversions) - .enrichments(enrichments) - .addEnrichment(secondEnrichment) - .normalizations(normalizationOperations) - .addNormalization(secondOp) - .source(source) - .build(); - createConfigurationOptions = createConfigurationOptions.newBuilder().build(); - - enrichments.add(secondEnrichment); - normalizationOperations.add(secondOp); - - assertEquals(environmentId, createConfigurationOptions.environmentId()); - assertEquals(name, createConfigurationOptions.name()); - assertEquals(description, createConfigurationOptions.description()); - assertEquals(conversions, createConfigurationOptions.conversions()); - assertEquals(enrichments, createConfigurationOptions.enrichments()); - assertEquals(normalizationOperations, createConfigurationOptions.normalizations()); - assertEquals(source, createConfigurationOptions.source()); - } - - /** - * Creates the configuration is successful. - * - * @throws JsonSyntaxException the json syntax exception - * @throws JsonIOException the json IO exception - * @throws FileNotFoundException the file not found exception - * @throws InterruptedException the interrupted exception - */ - @Test - public void createConfigurationIsSuccessful() - throws JsonSyntaxException, JsonIOException, FileNotFoundException, InterruptedException { - server.enqueue(jsonResponse(createConfResp)); - CreateConfigurationOptions.Builder createBuilder = new CreateConfigurationOptions.Builder(); - Configuration configuration = - GsonSingleton.getGson() - .fromJson(new FileReader(DISCOVERY_TEST_CONFIG_FILE), Configuration.class); - createBuilder.configuration(configuration); - createBuilder.environmentId(environmentId); - createBuilder.name(uniqueConfigName); - Configuration response = - discoveryService.createConfiguration(createBuilder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(CONF1_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals(createConfResp, response); - } - - /** - * Gets the configuration is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getConfigurationIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(getConfResp)); - - GetConfigurationOptions getRequest = - new GetConfigurationOptions.Builder(environmentId, configurationId).build(); - Configuration response = discoveryService.getConfiguration(getRequest).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(CONF2_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(getConfResp, response); - } - - /** - * Gets the configurations is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getConfigurationsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(getConfsResp)); - ListConfigurationsOptions getRequest = - new ListConfigurationsOptions.Builder(environmentId).build(); - ListConfigurationsResponse response = - discoveryService.listConfigurations(getRequest).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(CONF1_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(getConfsResp, response); - } - - /** - * Delete configuration is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void deleteConfigurationIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(deleteConfResp)); - DeleteConfigurationOptions deleteRequest = - new DeleteConfigurationOptions.Builder(environmentId, configurationId).build(); - DeleteConfigurationResponse response = - discoveryService.deleteConfiguration(deleteRequest).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(CONF2_PATH, request.getPath()); - assertEquals(DELETE, request.getMethod()); - assertEquals(deleteConfResp.getConfigurationId(), response.getConfigurationId()); - assertEquals(DeleteConfigurationResponse.Status.DELETED, response.getStatus()); - assertNotNull(response.getNotices()); - } - - /** - * Update configuration is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void updateConfigurationIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(updateConfResp)); - UpdateConfigurationOptions.Builder updateBuilder = new UpdateConfigurationOptions.Builder(); - updateBuilder.configurationId(configurationId); - updateBuilder.environmentId(environmentId); - Configuration newConf = new Configuration.Builder().name("newName").build(); - updateBuilder.configuration(newConf); - - Configuration response = - discoveryService.updateConfiguration(updateBuilder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(CONF2_PATH, request.getPath()); - assertEquals(PUT, request.getMethod()); - assertEquals(updateConfResp, response); - } - - /** - * Creates the collection is successful. - * - * @throws InterruptedException the interrupted exception - */ - // Collection tests - @Test - public void createCollectionIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(createCollResp)); - CreateCollectionOptions.Builder createCollectionBuilder = - new CreateCollectionOptions.Builder(environmentId, uniqueCollectionName) - .configurationId(configurationId); - Collection response = - discoveryService.createCollection(createCollectionBuilder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(COLL1_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals(createCollResp, response); - } - - /** - * Gets the collections is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getCollectionsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(getCollsResp)); - ListCollectionsOptions getRequest = new ListCollectionsOptions.Builder(environmentId).build(); - ListCollectionsResponse response = - discoveryService.listCollections(getRequest).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(COLL1_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(getCollsResp, response); - } - - /** - * Gets the collection is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getCollectionIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(getCollResp)); - GetCollectionOptions getRequest = - new GetCollectionOptions.Builder(environmentId, collectionId).build(); - Collection response = discoveryService.getCollection(getRequest).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(COLL2_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(getCollResp, response); - } - - // no updateCollection yet? - - /** - * Listfields collection is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void listfieldsCollectionIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(listfieldsCollResp)); - ListCollectionFieldsOptions getRequest = - new ListCollectionFieldsOptions.Builder(environmentId, collectionId).build(); - ListCollectionFieldsResponse response = - discoveryService.listCollectionFields(getRequest).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(COLL3_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(listfieldsCollResp, response); - } - - /** - * Delete collection is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void deleteCollectionIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(deleteCollResp)); - DeleteCollectionOptions deleteRequest = - new DeleteCollectionOptions.Builder(environmentId, collectionId).build(); - DeleteCollectionResponse response = - discoveryService.deleteCollection(deleteRequest).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(COLL2_PATH, request.getPath()); - assertEquals(DELETE, request.getMethod()); - assertEquals(DeleteCollectionResponse.Status.DELETED, response.getStatus()); - assertEquals(deleteCollResp.getCollectionId(), response.getCollectionId()); - } - - /** - * Adds the document is successful. - * - * @throws InterruptedException the interrupted exception - */ - // Document tests - @Test - public void addDocumentIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(createDocResp)); - String myDocumentJson = "{\"field\":\"value\"}"; - JsonObject myMetadata = new JsonObject(); - myMetadata.add("foo", new JsonPrimitive("bar")); - InputStream documentStream = new ByteArrayInputStream(myDocumentJson.getBytes()); - - AddDocumentOptions.Builder builder = - new AddDocumentOptions.Builder(environmentId, collectionId); - builder.file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON); - builder.filename("test_file"); - builder.metadata(myMetadata.toString()); - DocumentAccepted response = discoveryService.addDocument(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(DOCS1_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals(createDocResp, response); - } - - /** - * Adds the document from input stream is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void addDocumentFromInputStreamIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(createDocResp)); - String myDocumentJson = "{\"field\":\"value\"}"; - JsonObject myMetadata = new JsonObject(); - myMetadata.add("foo", new JsonPrimitive("bar")); - InputStream documentStream = new ByteArrayInputStream(myDocumentJson.getBytes()); - - AddDocumentOptions.Builder builder = - new AddDocumentOptions.Builder(environmentId, collectionId); - builder.file(documentStream); - builder.filename("test_file"); - builder.metadata(myMetadata.toString()); - DocumentAccepted response = discoveryService.addDocument(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(DOCS1_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals(createDocResp, response); - } - - /** - * Adds the document from input stream with media type is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void addDocumentFromInputStreamWithMediaTypeIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(createDocResp)); - String myDocumentJson = "{\"field\":\"value\"}"; - JsonObject myMetadata = new JsonObject(); - myMetadata.add("foo", new JsonPrimitive("bar")); - InputStream documentStream = new ByteArrayInputStream(myDocumentJson.getBytes()); - - AddDocumentOptions.Builder builder = - new AddDocumentOptions.Builder(environmentId, collectionId); - builder.file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON); - builder.filename("test_file"); - builder.metadata(myMetadata.toString()); - DocumentAccepted response = discoveryService.addDocument(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(DOCS1_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals(createDocResp, response); - } - - /** Adds the document without required parameters fails. */ - @Test(expected = IllegalArgumentException.class) - public void addDocumentWithoutRequiredParametersFails() { - AddDocumentOptions options = - new AddDocumentOptions.Builder(environmentId, collectionId).build(); - discoveryService.addDocument(options).execute().getResult(); - } - - /** - * Adds the document from input stream with file name and media type is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void addDocumentFromInputStreamWithFileNameAndMediaTypeIsSuccessful() - throws InterruptedException { - server.enqueue(jsonResponse(createDocResp)); - String myDocumentJson = "{\"field\":\"value\"}"; - JsonObject myMetadata = new JsonObject(); - myMetadata.add("foo", new JsonPrimitive("bar")); - InputStream documentStream = new ByteArrayInputStream(myDocumentJson.getBytes()); - - AddDocumentOptions.Builder builder = - new AddDocumentOptions.Builder(environmentId, collectionId); - builder.file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON); - builder.filename("test_file"); - builder.metadata(myMetadata.toString()); - DocumentAccepted response = discoveryService.addDocument(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(DOCS1_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals(createDocResp, response); - } - - // Deleted tests for (create)addDocument with file parameter as this is deprecated - - /** - * Update document is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void updateDocumentIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(updateDocResp)); - UpdateDocumentOptions.Builder updateBuilder = - new UpdateDocumentOptions.Builder(environmentId, collectionId, documentId); - String myDocumentJson = "{\"field\":\"value2\"}"; - JsonObject myMetadata = new JsonObject(); - myMetadata.add("foo", new JsonPrimitive("bar")); - - InputStream documentStream = new ByteArrayInputStream(myDocumentJson.getBytes()); - updateBuilder.file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON); - updateBuilder.filename("test_file"); - updateBuilder.metadata(myMetadata.toString()); - DocumentAccepted response = - discoveryService.updateDocument(updateBuilder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(DOCS2_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals(updateDocResp, response); - } - - /** Update document without required parameters fails. */ - @Test(expected = IllegalArgumentException.class) - public void updateDocumentWithoutRequiredParametersFails() { - UpdateDocumentOptions options = - new UpdateDocumentOptions.Builder(environmentId, collectionId, documentId).build(); - discoveryService.updateDocument(options).execute().getResult(); - } - - /** - * Gets the document is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getDocumentIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(getDocResp)); - GetDocumentStatusOptions getRequest = - new GetDocumentStatusOptions.Builder(environmentId, collectionId, documentId).build(); - DocumentStatus response = discoveryService.getDocumentStatus(getRequest).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(DOCS2_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(getDocResp, response); - } - - /** - * Delete document is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void deleteDocumentIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(deleteDocResp)); - DeleteDocumentOptions deleteRequest = - new DeleteDocumentOptions.Builder(environmentId, collectionId, documentId).build(); - DeleteDocumentResponse response = - discoveryService.deleteDocument(deleteRequest).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(DOCS2_PATH, request.getPath()); - assertEquals(DELETE, request.getMethod()); - assertEquals(deleteDocResp.getDocumentId(), response.getDocumentId()); - assertEquals(deleteDocResp.getStatus(), response.getStatus()); - } - - /** - * Query is successful. - * - * @throws InterruptedException the interrupted exception - */ - // Query tests - @Test - public void queryIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(queryResp)); - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - queryBuilder.count(5L); - queryBuilder.offset(5L); - String fieldNames = "field"; - queryBuilder.xReturn(fieldNames); - queryBuilder.query("field" + Operator.CONTAINS + 1); - queryBuilder.filter("field" + Operator.CONTAINS + 1); - queryBuilder.similar(true); - String similarDocumentIds = "doc1, doc2"; - queryBuilder.similarDocumentIds(similarDocumentIds); - String similarFields = "field1, field2"; - queryBuilder.similarFields(similarFields); - queryBuilder.xWatsonLoggingOptOut(true); - queryBuilder.bias("bias"); - QueryResponse response = discoveryService.query(queryBuilder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(Q1_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals( - GsonSingleton.getGson().toJsonTree(queryResp), - GsonSingleton.getGson().toJsonTree(response)); - } - - /** - * Query with aggregation term is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void queryWithAggregationTermIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(queryResp)); - QueryOptions.Builder queryBuilder = new QueryOptions.Builder(environmentId, collectionId); - StringBuilder sb = new StringBuilder(); - sb.append(AggregationType.TERM); - sb.append(Operator.OPENING_GROUPING); - sb.append("field"); - sb.append(Operator.CLOSING_GROUPING); - String aggregation = sb.toString(); - queryBuilder.aggregation(aggregation); - QueryResponse response = discoveryService.query(queryBuilder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(Q1_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals( - GsonSingleton.getGson().toJsonTree(queryResp), - GsonSingleton.getGson().toJsonTree(response)); - } - - /** - * Adds the training data is successful. - * - * @throws InterruptedException the interrupted exception - */ - // Training data tests - @Test - public void addTrainingDataIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(addTrainingQueryResp)); - AddTrainingDataOptions.Builder builder = - new AddTrainingDataOptions.Builder(environmentId, collectionId); - builder.naturalLanguageQuery("Example query"); - TrainingExample example = - new TrainingExample.Builder().documentId(documentId).relevance(0).build(); - builder.addExamples(example); - TrainingQuery response = - discoveryService.addTrainingData(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(TRAINING1_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals(addTrainingQueryResp, response); - } - - /** - * List training data is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void listTrainingDataIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(listTrainingDataResp)); - ListTrainingDataOptions getRequest = - new ListTrainingDataOptions.Builder(environmentId, collectionId).build(); - TrainingDataSet response = discoveryService.listTrainingData(getRequest).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(TRAINING1_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(listTrainingDataResp, response); - } - - /** - * Delete all collection training data is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void deleteAllCollectionTrainingDataIsSuccessful() throws InterruptedException { - MockResponse desiredResponse = new MockResponse().setResponseCode(204); - server.enqueue(desiredResponse); - DeleteAllTrainingDataOptions deleteRequest = - new DeleteAllTrainingDataOptions.Builder(environmentId, collectionId).build(); - discoveryService.deleteAllTrainingData(deleteRequest).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(TRAINING1_PATH, request.getPath()); - assertEquals(DELETE, request.getMethod()); - } - - /** - * Creates the training example is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void createTrainingExampleIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(createTrainingExampleResp)); - CreateTrainingExampleOptions.Builder builder = - new CreateTrainingExampleOptions.Builder(environmentId, collectionId, queryId); - builder.documentId(documentId); - builder.relevance(0); - TrainingExample response = - discoveryService.createTrainingExample(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(TRAINING2_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals(createTrainingExampleResp, response); - } - - /** - * Gets the training data is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getTrainingDataIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(getTrainingDataResp)); - GetTrainingDataOptions.Builder builder = - new GetTrainingDataOptions.Builder(environmentId, collectionId, queryId); - TrainingQuery response = - discoveryService.getTrainingData(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(TRAINING3_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(getTrainingDataResp, response); - } - - /** - * Gets the training example is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getTrainingExampleIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(getTrainingExampleResp)); - GetTrainingExampleOptions.Builder builder = - new GetTrainingExampleOptions.Builder(environmentId, collectionId, queryId, documentId); - TrainingExample response = - discoveryService.getTrainingExample(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(TRAINING4_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(getTrainingExampleResp, response); - } - - /** - * Delete training data is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void deleteTrainingDataIsSuccessful() throws InterruptedException { - MockResponse desiredResponse = new MockResponse().setResponseCode(204); - server.enqueue(desiredResponse); - DeleteTrainingDataOptions.Builder builder = - new DeleteTrainingDataOptions.Builder(environmentId, collectionId, queryId); - discoveryService.deleteTrainingData(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(TRAINING3_PATH, request.getPath()); - assertEquals(DELETE, request.getMethod()); - } - - /** - * Delete training example is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void deleteTrainingExampleIsSuccessful() throws InterruptedException { - MockResponse desiredResponse = new MockResponse().setResponseCode(204); - server.enqueue(desiredResponse); - DeleteTrainingExampleOptions.Builder builder = - new DeleteTrainingExampleOptions.Builder(environmentId, collectionId, queryId, documentId); - discoveryService.deleteTrainingExample(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(TRAINING4_PATH, request.getPath()); - assertEquals(DELETE, request.getMethod()); - } - - /** - * Update training example is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void updateTrainingExampleIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(updateTrainingExampleResp)); - UpdateTrainingExampleOptions.Builder builder = - new UpdateTrainingExampleOptions.Builder(environmentId, collectionId, queryId, documentId); - builder.relevance(100); - TrainingExample response = - discoveryService.updateTrainingExample(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(TRAINING4_PATH, request.getPath()); - assertEquals(PUT, request.getMethod()); - assertEquals(updateTrainingExampleResp, response); - } - - /** - * List training examples is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void listTrainingExamplesIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(listTrainingExamplesResp)); - ListTrainingExamplesOptions.Builder builder = - new ListTrainingExamplesOptions.Builder(environmentId, collectionId, queryId); - TrainingExampleList response = - discoveryService.listTrainingExamples(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(TRAINING2_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(listTrainingExamplesResp, response); - } - - /** - * List fields is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void listFieldsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(listFieldsResp)); - ListFieldsOptions.Builder builder = - new ListFieldsOptions.Builder(environmentId, new ArrayList<>(Arrays.asList(collectionId))); - ListCollectionFieldsResponse response = - discoveryService.listFields(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(FIELD_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(listFieldsResp, response); - } - - /** - * Query notices is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void queryNoticesIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(queryNoticesResp)); - QueryNoticesOptions.Builder builder = - new QueryNoticesOptions.Builder(environmentId, collectionId); - discoveryService.queryNotices(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(Q4_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - } - - /** - * Federated query is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void federatedQueryIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(queryResp)); - FederatedQueryOptions.Builder builder = - new FederatedQueryOptions.Builder() - .environmentId(environmentId) - .collectionIds(collectionId) - .bias("bias") - .xWatsonLoggingOptOut(true); - discoveryService.federatedQuery(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(Q2_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - } - - /** - * Federated query notices is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void federatedQueryNoticesIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(queryNoticesResp)); - FederatedQueryNoticesOptions.Builder builder = - new FederatedQueryNoticesOptions.Builder( - environmentId, new ArrayList<>(Arrays.asList(collectionId))); - discoveryService.federatedQueryNotices(builder.build()).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(Q3_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - } - - /** - * Creates the expansions is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void createExpansionsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(expansionsResp)); - - List expansion1InputTerms = Arrays.asList("weekday", "week day"); - List expansion1ExpandedTerms = - Arrays.asList("monday", "tuesday", "wednesday", "thursday", "friday"); - List expansion2InputTerms = Arrays.asList("weekend", "week end"); - List expansion2ExpandedTerms = Arrays.asList("saturday", "sunday"); - Expansion expansion1 = - new Expansion.Builder() - .inputTerms(expansion1InputTerms) - .expandedTerms(expansion1ExpandedTerms) - .build(); - Expansion expansion2 = - new Expansion.Builder() - .inputTerms(expansion2InputTerms) - .expandedTerms(expansion2ExpandedTerms) - .build(); - Expansions expansions = - new Expansions.Builder().expansions(Arrays.asList(expansion1, expansion2)).build(); - - CreateExpansionsOptions createOptions = - new CreateExpansionsOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .expansions(expansions) - .build(); - Expansions createResults = - discoveryService.createExpansions(createOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(EXPANSIONS_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals(expansion1, createResults.expansions().get(0)); - assertEquals(expansion2, createResults.expansions().get(1)); - } - - /** - * List expansions is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void listExpansionsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(expansionsResp)); - - List expansion1InputTerms = Arrays.asList("weekday", "week day"); - List expansion1ExpandedTerms = - Arrays.asList("monday", "tuesday", "wednesday", "thursday", "friday"); - List expansion2InputTerms = Arrays.asList("weekend", "week end"); - List expansion2ExpandedTerms = Arrays.asList("saturday", "sunday"); - Expansion expansion1 = - new Expansion.Builder() - .inputTerms(expansion1InputTerms) - .expandedTerms(expansion1ExpandedTerms) - .build(); - Expansion expansion2 = - new Expansion.Builder() - .inputTerms(expansion2InputTerms) - .expandedTerms(expansion2ExpandedTerms) - .build(); - - ListExpansionsOptions listOptions = - new ListExpansionsOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .build(); - Expansions listResults = discoveryService.listExpansions(listOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(EXPANSIONS_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(expansion1, listResults.expansions().get(0)); - assertEquals(expansion2, listResults.expansions().get(1)); - } - - /** - * Delete expansions is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void deleteExpansionsIsSuccessful() throws InterruptedException { - MockResponse desiredResponse = new MockResponse().setResponseCode(200); - server.enqueue(desiredResponse); - - DeleteExpansionsOptions deleteOptions = - new DeleteExpansionsOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .build(); - discoveryService.deleteExpansions(deleteOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(EXPANSIONS_PATH, request.getPath()); - assertEquals(DELETE, request.getMethod()); - } - - /** - * Delete user data is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void deleteUserDataIsSuccessful() throws InterruptedException { - MockResponse desiredResponse = new MockResponse().setResponseCode(200); - server.enqueue(desiredResponse); - - String customerId = "java_sdk_test_id"; - - DeleteUserDataOptions deleteOptions = - new DeleteUserDataOptions.Builder().customerId(customerId).build(); - discoveryService.deleteUserData(deleteOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(DELETE_USER_DATA_PATH, request.getPath()); - assertEquals(DELETE, request.getMethod()); - } - - /** Test credential details. */ - @Test - public void testCredentialDetails() { - String clientId = "client_id"; - String clientSecret = "client_secret"; // pragma: whitelist secret - String enterpriseId = "enterprise_id"; - String organizationUrl = "organization_url"; - String passphrase = "passphrase"; - String password = "password"; // pragma: whitelist secret - String privateKey = "private_key"; - String publicKeyId = "public_key_id"; - String siteCollectionPath = "site_collection_path"; - String url = "url"; - String username = "username"; - String gatewayId = "gateway_id"; - String sourceVersion = "source_version"; - String webApplicationUrl = "web_application_url"; - String domain = "domain"; - String endpoint = "endpoint"; - String accessKeyId = "access_key"; - String secretAccessKey = "secret_access_key"; - - CredentialDetails details = - new CredentialDetails.Builder() - .clientId(clientId) - .clientSecret(clientSecret) - .credentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD) - .enterpriseId(enterpriseId) - .organizationUrl(organizationUrl) - .passphrase(passphrase) - .password(password) - .privateKey(privateKey) - .publicKeyId(publicKeyId) - .siteCollectionPath(siteCollectionPath) - .url(url) - .username(username) - .gatewayId(gatewayId) - .sourceVersion(sourceVersion) - .webApplicationUrl(webApplicationUrl) - .domain(domain) - .endpoint(endpoint) - .accessKeyId(accessKeyId) - .secretAccessKey(secretAccessKey) - .build(); - - assertEquals(clientId, details.clientId()); - assertEquals(clientSecret, details.clientSecret()); - assertEquals(CredentialDetails.CredentialType.USERNAME_PASSWORD, details.credentialType()); - assertEquals(enterpriseId, details.enterpriseId()); - assertEquals(organizationUrl, details.organizationUrl()); - assertEquals(passphrase, details.passphrase()); - assertEquals(password, details.password()); - assertEquals(privateKey, details.privateKey()); - assertEquals(publicKeyId, details.publicKeyId()); - assertEquals(siteCollectionPath, details.siteCollectionPath()); - assertEquals(url, details.url()); - assertEquals(username, details.username()); - assertEquals(gatewayId, details.gatewayId()); - assertEquals(sourceVersion, details.sourceVersion()); - assertEquals(webApplicationUrl, details.webApplicationUrl()); - assertEquals(domain, details.domain()); - assertEquals(accessKeyId, details.accessKeyId()); - assertEquals(secretAccessKey, details.secretAccessKey()); - } - - /** - * Creates the credentials is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void createCredentialsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(credentialsResp)); - - CredentialDetails details = - new CredentialDetails.Builder() - .credentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD) - .url("url") - .username("username") - .build(); - Credentials credentials = - new Credentials.Builder() - .sourceType(Credentials.SourceType.SALESFORCE) - .credentialDetails(details) - .build(); - - CreateCredentialsOptions options = - new CreateCredentialsOptions.Builder() - .environmentId(environmentId) - .sourceType(Credentials.SourceType.SALESFORCE) - .credentials(credentials) - .credentialDetails(details) - .build(); - Credentials credentialsResponse = - discoveryService.createCredentials(options).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(CREATE_CREDENTIALS_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals(credentialsResp, credentialsResponse); - assertEquals(credentialsResp.credentialDetails(), credentialsResponse.credentialDetails()); - } - - /** - * Delete credentials is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void deleteCredentialsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(deleteCredentialsResp)); - - DeleteCredentialsOptions options = - new DeleteCredentialsOptions.Builder() - .environmentId(environmentId) - .credentialId("credential_id") - .build(); - DeleteCredentials response = discoveryService.deleteCredentials(options).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(DELETE_CREDENTIALS_PATH, request.getPath()); - assertEquals(DELETE, request.getMethod()); - assertEquals(deleteCredentialsResp.getCredentialId(), response.getCredentialId()); - assertEquals(deleteCredentialsResp.getStatus(), response.getStatus()); - } - - /** - * Gets the credentials is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getCredentialsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(credentialsResp)); - - GetCredentialsOptions options = - new GetCredentialsOptions.Builder() - .environmentId(environmentId) - .credentialId("credential_id") - .build(); - Credentials credentialsResponse = - discoveryService.getCredentials(options).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET_CREDENTIALS_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(credentialsResp, credentialsResponse); - } - - /** - * List credentials is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void listCredentialsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(listCredentialsResp)); - - ListCredentialsOptions options = - new ListCredentialsOptions.Builder().environmentId(environmentId).build(); - CredentialsList response = discoveryService.listCredentials(options).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(LIST_CREDENTIALS_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(listCredentialsResp, response); - assertTrue(response.getCredentials().size() == 3); - } - - /** - * Update credentials is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void updateCredentialsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(credentialsResp)); - - CredentialDetails newDetails = - new CredentialDetails.Builder() - .clientId("new_client_id") - .clientSecret("new_client_secret") - .credentialType(CredentialDetails.CredentialType.USERNAME_PASSWORD) - .enterpriseId("new_enterprise_id") - .organizationUrl("new_organization_url") - .passphrase("new_passphrase") - .password("new_password") - .privateKey("new_private_key") - .publicKeyId("new_public_key_id") - .siteCollectionPath("new_site_collection_path") - .url("new_url") - .username("new_username") - .build(); - Credentials newCredentials = - new Credentials.Builder() - .sourceType(Credentials.SourceType.SALESFORCE) - .credentialDetails(newDetails) - .build(); - - UpdateCredentialsOptions options = - new UpdateCredentialsOptions.Builder() - .environmentId(environmentId) - .credentialId("new_credential_id") - .sourceType(Credentials.SourceType.SALESFORCE) - .credentials(newCredentials) - .credentialDetails(newDetails) - .build(); - Credentials response = discoveryService.updateCredentials(options).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(UPDATE_CREDENTIALS_PATH, request.getPath()); - assertEquals(PUT, request.getMethod()); - assertEquals(credentialsResp, response); - } - - /** - * Creates the event is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void createEventIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(createEventResp)); - - Long displayRank = 1L; - String sessionToken = "mock_session_token"; - - EventData eventData = - new EventData.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .documentId(documentId) - .displayRank(displayRank) - .sessionToken(sessionToken) - .clientTimestamp(date) - .build(); - CreateEventOptions createEventOptions = - new CreateEventOptions.Builder() - .type(CreateEventOptions.Type.CLICK) - .data(eventData) - .build(); - - CreateEventResponse response = - discoveryService.createEvent(createEventOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(CREATE_EVENT_PATH, request.getPath()); - assertEquals(POST, request.getMethod()); - assertEquals(CreateEventOptions.Type.CLICK, response.getType()); - assertEquals(environmentId, response.getData().environmentId()); - assertEquals(collectionId, response.getData().collectionId()); - assertEquals(documentId, response.getData().documentId()); - assertNotNull(response.getData().clientTimestamp()); - assertEquals(displayRank, response.getData().displayRank()); - assertEquals(queryId, response.getData().queryId()); - assertEquals(sessionToken, response.getData().sessionToken()); - } - - /** - * Gets the metrics event rate is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getMetricsEventRateIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(metricResp)); - - String interval = "1d"; - Long key = 1533513600000L; - Double eventRate = 0.0; - - GetMetricsEventRateOptions options = - new GetMetricsEventRateOptions.Builder() - .startTime(date) - .endTime(date) - .resultType(GetMetricsEventRateOptions.ResultType.DOCUMENT) - .build(); - - MetricResponse response = discoveryService.getMetricsEventRate(options).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET, request.getMethod()); - assertTrue(!response.getAggregations().isEmpty()); - assertEquals(interval, response.getAggregations().get(0).getInterval()); - assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType()); - assertTrue(!response.getAggregations().get(0).getResults().isEmpty()); - assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey()); - assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString()); - assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate()); - } - - /** - * Gets the metrics event rate no args is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getMetricsEventRateNoArgsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(metricResp)); - - String interval = "1d"; - Long key = 1533513600000L; - Double eventRate = 0.0; - - MetricResponse response = discoveryService.getMetricsEventRate().execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET_METRICS_EVENT_RATE_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertTrue(!response.getAggregations().isEmpty()); - assertEquals(interval, response.getAggregations().get(0).getInterval()); - assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType()); - assertTrue(!response.getAggregations().get(0).getResults().isEmpty()); - assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey()); - assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString()); - assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate()); - } - - /** - * Gets the metrics query is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getMetricsQueryIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(metricResp)); - - String interval = "1d"; - Long key = 1533513600000L; - Double eventRate = 0.0; - - GetMetricsQueryOptions options = - new GetMetricsQueryOptions.Builder() - .startTime(date) - .endTime(date) - .resultType(GetMetricsQueryOptions.ResultType.DOCUMENT) - .build(); - - MetricResponse response = discoveryService.getMetricsQuery(options).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET, request.getMethod()); - assertTrue(!response.getAggregations().isEmpty()); - assertEquals(interval, response.getAggregations().get(0).getInterval()); - assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType()); - assertTrue(!response.getAggregations().get(0).getResults().isEmpty()); - assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey()); - assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString()); - assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate()); - } - - /** - * Gets the metrics query no args is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getMetricsQueryNoArgsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(metricResp)); - - String interval = "1d"; - Long key = 1533513600000L; - Double eventRate = 0.0; - - MetricResponse response = discoveryService.getMetricsQuery().execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET_METRICS_QUERY_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertTrue(!response.getAggregations().isEmpty()); - assertEquals(interval, response.getAggregations().get(0).getInterval()); - assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType()); - assertTrue(!response.getAggregations().get(0).getResults().isEmpty()); - assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey()); - assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString()); - assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate()); - } - - /** - * Gets the metrics query event is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getMetricsQueryEventIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(metricResp)); - - String interval = "1d"; - Long key = 1533513600000L; - Double eventRate = 0.0; - - GetMetricsQueryEventOptions options = - new GetMetricsQueryEventOptions.Builder() - .startTime(date) - .endTime(date) - .resultType(GetMetricsQueryEventOptions.ResultType.DOCUMENT) - .build(); - - MetricResponse response = discoveryService.getMetricsQueryEvent(options).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET, request.getMethod()); - assertTrue(!response.getAggregations().isEmpty()); - assertEquals(interval, response.getAggregations().get(0).getInterval()); - assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType()); - assertTrue(!response.getAggregations().get(0).getResults().isEmpty()); - assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey()); - assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString()); - assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate()); - } - - /** - * Gets the metrics query event no args is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getMetricsQueryEventNoArgsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(metricResp)); - - String interval = "1d"; - Long key = 1533513600000L; - Double eventRate = 0.0; - - MetricResponse response = discoveryService.getMetricsQueryEvent().execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET_METRICS_QUERY_EVENT_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertTrue(!response.getAggregations().isEmpty()); - assertEquals(interval, response.getAggregations().get(0).getInterval()); - assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType()); - assertTrue(!response.getAggregations().get(0).getResults().isEmpty()); - assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey()); - assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString()); - assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate()); - } - - /** - * Gets the metrics query no results is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getMetricsQueryNoResultsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(metricResp)); - - String interval = "1d"; - Long key = 1533513600000L; - Double eventRate = 0.0; - - GetMetricsQueryNoResultsOptions options = - new GetMetricsQueryNoResultsOptions.Builder() - .startTime(date) - .endTime(date) - .resultType(GetMetricsQueryEventOptions.ResultType.DOCUMENT) - .build(); - - MetricResponse response = - discoveryService.getMetricsQueryNoResults(options).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET, request.getMethod()); - assertTrue(!response.getAggregations().isEmpty()); - assertEquals(interval, response.getAggregations().get(0).getInterval()); - assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType()); - assertTrue(!response.getAggregations().get(0).getResults().isEmpty()); - assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey()); - assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString()); - assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate()); - } - - /** - * Gets the metrics query no results no args is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getMetricsQueryNoResultsNoArgsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(metricResp)); - - String interval = "1d"; - Long key = 1533513600000L; - Double eventRate = 0.0; - - MetricResponse response = discoveryService.getMetricsQueryNoResults().execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET_METRICS_QUERY_NO_RESULTS_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertTrue(!response.getAggregations().isEmpty()); - assertEquals(interval, response.getAggregations().get(0).getInterval()); - assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType()); - assertTrue(!response.getAggregations().get(0).getResults().isEmpty()); - assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey()); - assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString()); - assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate()); - } - - /** - * Gets the metrics query token event is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getMetricsQueryTokenEventIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(metricTokenResp)); - - Long count = 10L; - String key = "beat"; - Long matchingResults = 117L; - Double eventRate = 0.0; - - GetMetricsQueryTokenEventOptions options = - new GetMetricsQueryTokenEventOptions.Builder().count(count).build(); - - MetricTokenResponse response = - discoveryService.getMetricsQueryTokenEvent(options).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET, request.getMethod()); - assertTrue(!response.getAggregations().isEmpty()); - assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType()); - assertTrue(!response.getAggregations().get(0).getResults().isEmpty()); - assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey()); - assertEquals( - matchingResults, - response.getAggregations().get(0).getResults().get(0).getMatchingResults()); - assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate()); - } - - /** - * Gets the metrics query token event no args is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void getMetricsQueryTokenEventNoArgsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(metricTokenResp)); - - String key = "beat"; - Long matchingResults = 117L; - Double eventRate = 0.0; - - MetricTokenResponse response = - discoveryService.getMetricsQueryTokenEvent().execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET_METRICS_QUERY_TOKEN_EVENT_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertTrue(!response.getAggregations().isEmpty()); - assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType()); - assertTrue(!response.getAggregations().get(0).getResults().isEmpty()); - assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey()); - assertEquals( - matchingResults, - response.getAggregations().get(0).getResults().get(0).getMatchingResults()); - assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate()); - } - - /** - * Query log is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void queryLogIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(logQueryResp)); - - List sortList = new ArrayList<>(); - sortList.add("field_a"); - String extraSort = "field_b"; - String filter = "filter"; - String naturalLanguageQuery = "Who beat Ken Jennings in Jeopardy!"; - Long count = 5L; - Long offset = 5L; - Long matchingResults = 2L; - String customerId = ""; - String sessionToken = "mock_session_token"; - String eventType = "query"; - Long resultCount = 0L; - - QueryLogOptions options = - new QueryLogOptions.Builder() - .sort(sortList) - .addSort(extraSort) - .count(count) - .filter(filter) - .offset(offset) - .query(naturalLanguageQuery) - .build(); - - LogQueryResponse response = discoveryService.queryLog(options).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET, request.getMethod()); - assertEquals(matchingResults, response.getMatchingResults()); - assertTrue(!response.getResults().isEmpty()); - assertEquals(environmentId, response.getResults().get(0).getEnvironmentId()); - assertEquals(customerId, response.getResults().get(0).getCustomerId()); - assertNotNull(response.getResults().get(0).getCreatedTimestamp()); - assertEquals(queryId, response.getResults().get(0).getQueryId()); - assertEquals(sessionToken, response.getResults().get(0).getSessionToken()); - assertEquals(eventType, response.getResults().get(0).getEventType()); - assertNotNull(response.getResults().get(0).getDocumentResults().getResults()); - assertEquals(resultCount, response.getResults().get(0).getDocumentResults().getCount()); - } - - /** - * Query log no args is successful. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void queryLogNoArgsIsSuccessful() throws InterruptedException { - server.enqueue(jsonResponse(logQueryResp)); - - List sortList = new ArrayList<>(); - sortList.add("field_a"); - Long matchingResults = 2L; - String customerId = ""; - String sessionToken = "mock_session_token"; - String eventType = "query"; - Long resultCount = 0L; - - LogQueryResponse response = discoveryService.queryLog().execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(QUERY_LOG_PATH, request.getPath()); - assertEquals(GET, request.getMethod()); - assertEquals(matchingResults, response.getMatchingResults()); - assertTrue(!response.getResults().isEmpty()); - assertEquals(environmentId, response.getResults().get(0).getEnvironmentId()); - assertEquals(customerId, response.getResults().get(0).getCustomerId()); - assertNotNull(response.getResults().get(0).getCreatedTimestamp()); - assertEquals(queryId, response.getResults().get(0).getQueryId()); - assertEquals(sessionToken, response.getResults().get(0).getSessionToken()); - assertEquals(eventType, response.getResults().get(0).getEventType()); - assertNotNull(response.getResults().get(0).getDocumentResults().getResults()); - assertEquals(resultCount, response.getResults().get(0).getDocumentResults().getCount()); - } - - /** Test token dict rule. */ - @Test - public void testTokenDictRule() { - String text = "text"; - String partOfSpeech = "noun"; - List readings = Arrays.asList("reading 1", "reading 2"); - List tokens = Arrays.asList("token 1", "token 2"); - - TokenDictRule tokenDictRule = - new TokenDictRule.Builder() - .text(text) - .partOfSpeech(partOfSpeech) - .readings(readings) - .tokens(tokens) - .build(); - - assertEquals(text, tokenDictRule.text()); - assertEquals(partOfSpeech, tokenDictRule.partOfSpeech()); - assertEquals(readings, tokenDictRule.readings()); - assertEquals(tokens, tokenDictRule.tokens()); - } - - /** Test create tokenization dictionary options. */ - @Test - public void testCreateTokenizationDictionaryOptions() { - String text = "text"; - String partOfSpeech = "noun"; - List tokens = Arrays.asList("token 1", "token 2"); - - TokenDictRule firstTokenDictRule = - new TokenDictRule.Builder().text(text).partOfSpeech(partOfSpeech).tokens(tokens).build(); - TokenDictRule secondTokenDictRule = - new TokenDictRule.Builder().text(text).partOfSpeech(partOfSpeech).tokens(tokens).build(); - List tokenDictRuleList = new ArrayList<>(); - tokenDictRuleList.add(firstTokenDictRule); - - CreateTokenizationDictionaryOptions createOptions = - new CreateTokenizationDictionaryOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .tokenizationRules(tokenDictRuleList) - .addTokenizationRules(secondTokenDictRule) - .build(); - - tokenDictRuleList.add(secondTokenDictRule); - - assertEquals(environmentId, createOptions.environmentId()); - assertEquals(collectionId, createOptions.collectionId()); - assertEquals(tokenDictRuleList, createOptions.tokenizationRules()); - } - - /** Test get tokenization dictionary status options. */ - @Test - public void testGetTokenizationDictionaryStatusOptions() { - GetTokenizationDictionaryStatusOptions getOptions = - new GetTokenizationDictionaryStatusOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .build(); - - assertEquals(environmentId, getOptions.environmentId()); - assertEquals(collectionId, getOptions.collectionId()); - } - - /** Test delete tokenization dictionary options. */ - @Test - public void testDeleteTokenizationDictionaryOptions() { - DeleteTokenizationDictionaryOptions deleteOptions = - new DeleteTokenizationDictionaryOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .build(); - - assertEquals(environmentId, deleteOptions.environmentId()); - assertEquals(collectionId, deleteOptions.collectionId()); - } - - /** - * Test create tokenization dictionary. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void testCreateTokenizationDictionary() throws InterruptedException { - server.enqueue(jsonResponse(tokenDictStatusResponse)); - - String text = "text"; - String partOfSpeech = "noun"; - List tokens = Arrays.asList("token 1", "token 2"); - TokenDictRule tokenDictRule = - new TokenDictRule.Builder().text(text).tokens(tokens).partOfSpeech(partOfSpeech).build(); - CreateTokenizationDictionaryOptions createOptions = - new CreateTokenizationDictionaryOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .tokenizationRules(Collections.singletonList(tokenDictRule)) - .build(); - TokenDictStatusResponse response = - discoveryService.createTokenizationDictionary(createOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(POST, request.getMethod()); - assertEquals(tokenDictStatusResponse, response); - } - - /** - * Test get tokenization dictionary status. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void testGetTokenizationDictionaryStatus() throws InterruptedException { - server.enqueue(jsonResponse(tokenDictStatusResponse)); - - GetTokenizationDictionaryStatusOptions getOptions = - new GetTokenizationDictionaryStatusOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .build(); - TokenDictStatusResponse response = - discoveryService.getTokenizationDictionaryStatus(getOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET, request.getMethod()); - assertEquals(tokenDictStatusResponse, response); - } - - /** - * Test delete tokenization dictionary. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void testDeleteTokenizationDictionary() throws InterruptedException { - MockResponse desiredResponse = new MockResponse().setResponseCode(200); - server.enqueue(desiredResponse); - - DeleteTokenizationDictionaryOptions deleteOptions = - new DeleteTokenizationDictionaryOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .build(); - discoveryService.deleteTokenizationDictionary(deleteOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(DELETE, request.getMethod()); - } - - /** Test create stopword list options. */ - @Test - public void testCreateStopwordListOptions() { - String testFilename = "test_filename"; - - CreateStopwordListOptions createStopwordListOptions = - new CreateStopwordListOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .stopwordFile(testStream) - .stopwordFilename(testFilename) - .build(); - - assertEquals(environmentId, createStopwordListOptions.environmentId()); - assertEquals(collectionId, createStopwordListOptions.collectionId()); - assertEquals(testStream, createStopwordListOptions.stopwordFile()); - assertEquals(testFilename, createStopwordListOptions.stopwordFilename()); - } - - /** - * Test create stopword list. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void testCreateStopwordList() throws InterruptedException { - server.enqueue(jsonResponse(tokenDictStatusResponse)); - - String testFilename = "test_filename"; - - CreateStopwordListOptions createStopwordListOptions = - new CreateStopwordListOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .stopwordFile(testStream) - .stopwordFilename(testFilename) - .build(); - TokenDictStatusResponse response = - discoveryService.createStopwordList(createStopwordListOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(POST, request.getMethod()); - assertEquals(tokenDictStatusResponse, response); - } - - /** Test delete stopword list options. */ - @Test - public void testDeleteStopwordListOptions() { - DeleteStopwordListOptions deleteStopwordListOptions = - new DeleteStopwordListOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .build(); - - assertEquals(environmentId, deleteStopwordListOptions.environmentId()); - assertEquals(collectionId, deleteStopwordListOptions.collectionId()); - } - - /** - * Test delete stopword list. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void testDeleteStopwordList() throws InterruptedException { - MockResponse desiredResponse = new MockResponse().setResponseCode(200); - server.enqueue(desiredResponse); - - DeleteStopwordListOptions deleteStopwordListOptions = - new DeleteStopwordListOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .build(); - discoveryService.deleteStopwordList(deleteStopwordListOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(DELETE, request.getMethod()); - } - - /** Test get stopword list status options. */ - @Test - public void testGetStopwordListStatusOptions() { - GetStopwordListStatusOptions getStopwordListStatusOptions = - new GetStopwordListStatusOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .build(); - - assertEquals(environmentId, getStopwordListStatusOptions.environmentId()); - assertEquals(collectionId, getStopwordListStatusOptions.collectionId()); - } - - /** - * Test get stopword list status. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void testGetStopwordListStatus() throws InterruptedException { - server.enqueue(jsonResponse(tokenDictStatusResponseStopwords)); - - String type = "stopwords"; - - GetStopwordListStatusOptions getStopwordListStatusOptions = - new GetStopwordListStatusOptions.Builder() - .environmentId(environmentId) - .collectionId(collectionId) - .build(); - TokenDictStatusResponse response = - discoveryService.getStopwordListStatus(getStopwordListStatusOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET, request.getMethod()); - assertEquals(TokenDictStatusResponse.Status.ACTIVE, response.getStatus()); - assertEquals(type, response.getType()); - } - - /** Test create gateway options. */ - @Test - public void testCreateGatewayOptions() { - String name = "name"; - - CreateGatewayOptions createGatewayOptions = - new CreateGatewayOptions.Builder().environmentId(environmentId).name(name).build(); - - assertEquals(environmentId, createGatewayOptions.environmentId()); - assertEquals(name, createGatewayOptions.name()); - } - - /** - * Test create gateway. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void testCreateGateway() throws InterruptedException { - server.enqueue(jsonResponse(gatewayResponse)); - - String name = "name"; - - CreateGatewayOptions createGatewayOptions = - new CreateGatewayOptions.Builder().environmentId(environmentId).name(name).build(); - Gateway response = discoveryService.createGateway(createGatewayOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(POST, request.getMethod()); - assertEquals(gatewayResponse, response); - } - - /** Test delete gateway options. */ - @Test - public void testDeleteGatewayOptions() { - String gatewayId = "gateway_id"; - - DeleteGatewayOptions deleteGatewayOptions = - new DeleteGatewayOptions.Builder() - .environmentId(environmentId) - .gatewayId(gatewayId) - .build(); - - assertEquals(environmentId, deleteGatewayOptions.environmentId()); - assertEquals(gatewayId, deleteGatewayOptions.gatewayId()); - } - - /** - * Test delete gateway. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void testDeleteGateway() throws InterruptedException { - server.enqueue(jsonResponse(deleteGatewayResponse)); - - String gatewayId = "gateway_id"; - - DeleteGatewayOptions deleteGatewayOptions = - new DeleteGatewayOptions.Builder() - .environmentId(environmentId) - .gatewayId(gatewayId) - .build(); - GatewayDelete response = - discoveryService.deleteGateway(deleteGatewayOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(DELETE, request.getMethod()); - assertEquals(deleteGatewayResponse.getGatewayId(), response.getGatewayId()); - assertEquals(deleteGatewayResponse.getStatus(), response.getStatus()); - } - - /** Test get gateway options. */ - @Test - public void testGetGatewayOptions() { - String gatewayId = "gateway_id"; - - GetGatewayOptions getGatewayOptions = - new GetGatewayOptions.Builder().environmentId(environmentId).gatewayId(gatewayId).build(); - - assertEquals(environmentId, getGatewayOptions.environmentId()); - assertEquals(gatewayId, getGatewayOptions.gatewayId()); - } - - /** - * Test get gateway. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void testGetGateway() throws InterruptedException { - server.enqueue(jsonResponse(gatewayResponse)); - - String gatewayId = "gateway_id"; - - GetGatewayOptions getGatewayOptions = - new GetGatewayOptions.Builder().environmentId(environmentId).gatewayId(gatewayId).build(); - Gateway response = discoveryService.getGateway(getGatewayOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET, request.getMethod()); - assertEquals(gatewayResponse, response); - } - - /** Test list gateways options. */ - @Test - public void testListGatewaysOptions() { - ListGatewaysOptions listGatewaysOptions = - new ListGatewaysOptions.Builder().environmentId(environmentId).build(); - - assertEquals(environmentId, listGatewaysOptions.environmentId()); - } - - /** - * Test list gateways. - * - * @throws InterruptedException the interrupted exception - */ - @Test - public void testListGateways() throws InterruptedException { - server.enqueue(jsonResponse(listGatewaysResponse)); - - ListGatewaysOptions listGatewaysOptions = - new ListGatewaysOptions.Builder().environmentId(environmentId).build(); - GatewayList response = discoveryService.listGateways(listGatewaysOptions).execute().getResult(); - RecordedRequest request = server.takeRequest(); - - assertEquals(GET, request.getMethod()); - assertEquals(listGatewaysResponse, response); - } - - /** Test source options web crawl. */ - @Test - public void testSourceOptionsWebCrawl() { - String url = "url"; - String crawlSpeed = "crawl_speed"; - Long maximumHops = 1L; - Long requestTimeout = 2000L; - - SourceOptionsWebCrawl sourceOptionsWebCrawl = - new SourceOptionsWebCrawl.Builder() - .url(url) - .limitToStartingHosts(true) - .crawlSpeed(crawlSpeed) - .allowUntrustedCertificate(true) - .maximumHops(maximumHops) - .requestTimeout(requestTimeout) - .overrideRobotsTxt(true) - .build(); - - assertEquals(url, sourceOptionsWebCrawl.url()); - assertTrue(sourceOptionsWebCrawl.limitToStartingHosts()); - assertEquals(crawlSpeed, sourceOptionsWebCrawl.crawlSpeed()); - assertTrue(sourceOptionsWebCrawl.allowUntrustedCertificate()); - assertEquals(maximumHops, sourceOptionsWebCrawl.maximumHops()); - assertEquals(requestTimeout, sourceOptionsWebCrawl.requestTimeout()); - assertTrue(sourceOptionsWebCrawl.overrideRobotsTxt()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryTest.java deleted file mode 100644 index 9bea27d47de..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/DiscoveryTest.java +++ /dev/null @@ -1,4391 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.http.Response; -import com.ibm.cloud.sdk.core.security.Authenticator; -import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.cloud.sdk.core.util.RequestUtils; -import com.ibm.watson.discovery.v1.model.AddDocumentOptions; -import com.ibm.watson.discovery.v1.model.AddTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.Collection; -import com.ibm.watson.discovery.v1.model.Completions; -import com.ibm.watson.discovery.v1.model.Configuration; -import com.ibm.watson.discovery.v1.model.Conversions; -import com.ibm.watson.discovery.v1.model.CreateCollectionOptions; -import com.ibm.watson.discovery.v1.model.CreateConfigurationOptions; -import com.ibm.watson.discovery.v1.model.CreateCredentialsOptions; -import com.ibm.watson.discovery.v1.model.CreateEnvironmentOptions; -import com.ibm.watson.discovery.v1.model.CreateEventOptions; -import com.ibm.watson.discovery.v1.model.CreateEventResponse; -import com.ibm.watson.discovery.v1.model.CreateExpansionsOptions; -import com.ibm.watson.discovery.v1.model.CreateGatewayOptions; -import com.ibm.watson.discovery.v1.model.CreateStopwordListOptions; -import com.ibm.watson.discovery.v1.model.CreateTokenizationDictionaryOptions; -import com.ibm.watson.discovery.v1.model.CreateTrainingExampleOptions; -import com.ibm.watson.discovery.v1.model.CredentialDetails; -import com.ibm.watson.discovery.v1.model.Credentials; -import com.ibm.watson.discovery.v1.model.CredentialsList; -import com.ibm.watson.discovery.v1.model.DeleteAllTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.DeleteCollectionOptions; -import com.ibm.watson.discovery.v1.model.DeleteCollectionResponse; -import com.ibm.watson.discovery.v1.model.DeleteConfigurationOptions; -import com.ibm.watson.discovery.v1.model.DeleteConfigurationResponse; -import com.ibm.watson.discovery.v1.model.DeleteCredentials; -import com.ibm.watson.discovery.v1.model.DeleteCredentialsOptions; -import com.ibm.watson.discovery.v1.model.DeleteDocumentOptions; -import com.ibm.watson.discovery.v1.model.DeleteDocumentResponse; -import com.ibm.watson.discovery.v1.model.DeleteEnvironmentOptions; -import com.ibm.watson.discovery.v1.model.DeleteEnvironmentResponse; -import com.ibm.watson.discovery.v1.model.DeleteExpansionsOptions; -import com.ibm.watson.discovery.v1.model.DeleteGatewayOptions; -import com.ibm.watson.discovery.v1.model.DeleteStopwordListOptions; -import com.ibm.watson.discovery.v1.model.DeleteTokenizationDictionaryOptions; -import com.ibm.watson.discovery.v1.model.DeleteTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.DeleteTrainingExampleOptions; -import com.ibm.watson.discovery.v1.model.DeleteUserDataOptions; -import com.ibm.watson.discovery.v1.model.DocumentAccepted; -import com.ibm.watson.discovery.v1.model.DocumentStatus; -import com.ibm.watson.discovery.v1.model.Enrichment; -import com.ibm.watson.discovery.v1.model.EnrichmentOptions; -import com.ibm.watson.discovery.v1.model.Environment; -import com.ibm.watson.discovery.v1.model.EventData; -import com.ibm.watson.discovery.v1.model.Expansion; -import com.ibm.watson.discovery.v1.model.Expansions; -import com.ibm.watson.discovery.v1.model.FederatedQueryNoticesOptions; -import com.ibm.watson.discovery.v1.model.FederatedQueryOptions; -import com.ibm.watson.discovery.v1.model.FontSetting; -import com.ibm.watson.discovery.v1.model.Gateway; -import com.ibm.watson.discovery.v1.model.GatewayDelete; -import com.ibm.watson.discovery.v1.model.GatewayList; -import com.ibm.watson.discovery.v1.model.GetAutocompletionOptions; -import com.ibm.watson.discovery.v1.model.GetCollectionOptions; -import com.ibm.watson.discovery.v1.model.GetConfigurationOptions; -import com.ibm.watson.discovery.v1.model.GetCredentialsOptions; -import com.ibm.watson.discovery.v1.model.GetDocumentStatusOptions; -import com.ibm.watson.discovery.v1.model.GetEnvironmentOptions; -import com.ibm.watson.discovery.v1.model.GetGatewayOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsEventRateOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsQueryEventOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsQueryNoResultsOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsQueryOptions; -import com.ibm.watson.discovery.v1.model.GetMetricsQueryTokenEventOptions; -import com.ibm.watson.discovery.v1.model.GetStopwordListStatusOptions; -import com.ibm.watson.discovery.v1.model.GetTokenizationDictionaryStatusOptions; -import com.ibm.watson.discovery.v1.model.GetTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.GetTrainingExampleOptions; -import com.ibm.watson.discovery.v1.model.HtmlSettings; -import com.ibm.watson.discovery.v1.model.ListCollectionFieldsOptions; -import com.ibm.watson.discovery.v1.model.ListCollectionFieldsResponse; -import com.ibm.watson.discovery.v1.model.ListCollectionsOptions; -import com.ibm.watson.discovery.v1.model.ListCollectionsResponse; -import com.ibm.watson.discovery.v1.model.ListConfigurationsOptions; -import com.ibm.watson.discovery.v1.model.ListConfigurationsResponse; -import com.ibm.watson.discovery.v1.model.ListCredentialsOptions; -import com.ibm.watson.discovery.v1.model.ListEnvironmentsOptions; -import com.ibm.watson.discovery.v1.model.ListEnvironmentsResponse; -import com.ibm.watson.discovery.v1.model.ListExpansionsOptions; -import com.ibm.watson.discovery.v1.model.ListFieldsOptions; -import com.ibm.watson.discovery.v1.model.ListGatewaysOptions; -import com.ibm.watson.discovery.v1.model.ListTrainingDataOptions; -import com.ibm.watson.discovery.v1.model.ListTrainingExamplesOptions; -import com.ibm.watson.discovery.v1.model.LogQueryResponse; -import com.ibm.watson.discovery.v1.model.MetricResponse; -import com.ibm.watson.discovery.v1.model.MetricTokenResponse; -import com.ibm.watson.discovery.v1.model.NluEnrichmentConcepts; -import com.ibm.watson.discovery.v1.model.NluEnrichmentEmotion; -import com.ibm.watson.discovery.v1.model.NluEnrichmentEntities; -import com.ibm.watson.discovery.v1.model.NluEnrichmentFeatures; -import com.ibm.watson.discovery.v1.model.NluEnrichmentKeywords; -import com.ibm.watson.discovery.v1.model.NluEnrichmentRelations; -import com.ibm.watson.discovery.v1.model.NluEnrichmentSemanticRoles; -import com.ibm.watson.discovery.v1.model.NluEnrichmentSentiment; -import com.ibm.watson.discovery.v1.model.NormalizationOperation; -import com.ibm.watson.discovery.v1.model.PdfHeadingDetection; -import com.ibm.watson.discovery.v1.model.PdfSettings; -import com.ibm.watson.discovery.v1.model.QueryLogOptions; -import com.ibm.watson.discovery.v1.model.QueryNoticesOptions; -import com.ibm.watson.discovery.v1.model.QueryNoticesResponse; -import com.ibm.watson.discovery.v1.model.QueryOptions; -import com.ibm.watson.discovery.v1.model.QueryResponse; -import com.ibm.watson.discovery.v1.model.SegmentSettings; -import com.ibm.watson.discovery.v1.model.Source; -import com.ibm.watson.discovery.v1.model.SourceOptions; -import com.ibm.watson.discovery.v1.model.SourceOptionsBuckets; -import com.ibm.watson.discovery.v1.model.SourceOptionsFolder; -import com.ibm.watson.discovery.v1.model.SourceOptionsObject; -import com.ibm.watson.discovery.v1.model.SourceOptionsSiteColl; -import com.ibm.watson.discovery.v1.model.SourceOptionsWebCrawl; -import com.ibm.watson.discovery.v1.model.SourceSchedule; -import com.ibm.watson.discovery.v1.model.StatusDetails; -import com.ibm.watson.discovery.v1.model.TokenDictRule; -import com.ibm.watson.discovery.v1.model.TokenDictStatusResponse; -import com.ibm.watson.discovery.v1.model.TrainingDataSet; -import com.ibm.watson.discovery.v1.model.TrainingExample; -import com.ibm.watson.discovery.v1.model.TrainingExampleList; -import com.ibm.watson.discovery.v1.model.TrainingQuery; -import com.ibm.watson.discovery.v1.model.UpdateCollectionOptions; -import com.ibm.watson.discovery.v1.model.UpdateConfigurationOptions; -import com.ibm.watson.discovery.v1.model.UpdateCredentialsOptions; -import com.ibm.watson.discovery.v1.model.UpdateDocumentOptions; -import com.ibm.watson.discovery.v1.model.UpdateEnvironmentOptions; -import com.ibm.watson.discovery.v1.model.UpdateTrainingExampleOptions; -import com.ibm.watson.discovery.v1.model.WordHeadingDetection; -import com.ibm.watson.discovery.v1.model.WordSettings; -import com.ibm.watson.discovery.v1.model.WordStyle; -import com.ibm.watson.discovery.v1.model.XPathPatterns; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -/** Unit test class for the Discovery service. */ -public class DiscoveryTest { - - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - protected MockWebServer server; - protected Discovery discoveryService; - - // Construct the service with a null authenticator (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testConstructorWithNullAuthenticator() throws Throwable { - final String serviceName = "testService"; - // Set mock values for global params - String version = "testString"; - new Discovery(version, serviceName, null); - } - - // Test the getter for the version global parameter - @Test - public void testGetVersion() throws Throwable { - assertEquals(discoveryService.getVersion(), "testString"); - } - - // Test the createEnvironment operation with a valid options model parameter - @Test - public void testCreateEnvironmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"environment_id\": \"environmentId\", \"name\": \"name\", \"description\": \"description\", \"created\": \"2019-01-01T12:00:00.000Z\", \"updated\": \"2019-01-01T12:00:00.000Z\", \"status\": \"active\", \"read_only\": true, \"size\": \"LT\", \"requested_size\": \"requestedSize\", \"index_capacity\": {\"documents\": {\"available\": 9, \"maximum_allowed\": 14}, \"disk_usage\": {\"used_bytes\": 9, \"maximum_allowed_bytes\": 19}, \"collections\": {\"available\": 9, \"maximum_allowed\": 14}}, \"search_status\": {\"scope\": \"scope\", \"status\": \"NO_DATA\", \"status_description\": \"statusDescription\", \"last_trained\": \"2019-01-01\"}}"; - String createEnvironmentPath = "/v1/environments"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the CreateEnvironmentOptions model - CreateEnvironmentOptions createEnvironmentOptionsModel = - new CreateEnvironmentOptions.Builder() - .name("testString") - .description("testString") - .size("LT") - .build(); - - // Invoke createEnvironment() with a valid options model and verify the result - Response response = - discoveryService.createEnvironment(createEnvironmentOptionsModel).execute(); - assertNotNull(response); - Environment responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createEnvironmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the createEnvironment operation with and without retries enabled - @Test - public void testCreateEnvironmentWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testCreateEnvironmentWOptions(); - - discoveryService.disableRetries(); - testCreateEnvironmentWOptions(); - } - - // Test the createEnvironment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateEnvironmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.createEnvironment(null).execute(); - } - - // Test the listEnvironments operation with a valid options model parameter - @Test - public void testListEnvironmentsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"environments\": [{\"environment_id\": \"environmentId\", \"name\": \"name\", \"description\": \"description\", \"created\": \"2019-01-01T12:00:00.000Z\", \"updated\": \"2019-01-01T12:00:00.000Z\", \"status\": \"active\", \"read_only\": true, \"size\": \"LT\", \"requested_size\": \"requestedSize\", \"index_capacity\": {\"documents\": {\"available\": 9, \"maximum_allowed\": 14}, \"disk_usage\": {\"used_bytes\": 9, \"maximum_allowed_bytes\": 19}, \"collections\": {\"available\": 9, \"maximum_allowed\": 14}}, \"search_status\": {\"scope\": \"scope\", \"status\": \"NO_DATA\", \"status_description\": \"statusDescription\", \"last_trained\": \"2019-01-01\"}}]}"; - String listEnvironmentsPath = "/v1/environments"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListEnvironmentsOptions model - ListEnvironmentsOptions listEnvironmentsOptionsModel = - new ListEnvironmentsOptions.Builder().name("testString").build(); - - // Invoke listEnvironments() with a valid options model and verify the result - Response response = - discoveryService.listEnvironments(listEnvironmentsOptionsModel).execute(); - assertNotNull(response); - ListEnvironmentsResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listEnvironmentsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals(query.get("name"), "testString"); - } - - // Test the listEnvironments operation with and without retries enabled - @Test - public void testListEnvironmentsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testListEnvironmentsWOptions(); - - discoveryService.disableRetries(); - testListEnvironmentsWOptions(); - } - - // Test the getEnvironment operation with a valid options model parameter - @Test - public void testGetEnvironmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"environment_id\": \"environmentId\", \"name\": \"name\", \"description\": \"description\", \"created\": \"2019-01-01T12:00:00.000Z\", \"updated\": \"2019-01-01T12:00:00.000Z\", \"status\": \"active\", \"read_only\": true, \"size\": \"LT\", \"requested_size\": \"requestedSize\", \"index_capacity\": {\"documents\": {\"available\": 9, \"maximum_allowed\": 14}, \"disk_usage\": {\"used_bytes\": 9, \"maximum_allowed_bytes\": 19}, \"collections\": {\"available\": 9, \"maximum_allowed\": 14}}, \"search_status\": {\"scope\": \"scope\", \"status\": \"NO_DATA\", \"status_description\": \"statusDescription\", \"last_trained\": \"2019-01-01\"}}"; - String getEnvironmentPath = "/v1/environments/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetEnvironmentOptions model - GetEnvironmentOptions getEnvironmentOptionsModel = - new GetEnvironmentOptions.Builder().environmentId("testString").build(); - - // Invoke getEnvironment() with a valid options model and verify the result - Response response = - discoveryService.getEnvironment(getEnvironmentOptionsModel).execute(); - assertNotNull(response); - Environment responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getEnvironmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the getEnvironment operation with and without retries enabled - @Test - public void testGetEnvironmentWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetEnvironmentWOptions(); - - discoveryService.disableRetries(); - testGetEnvironmentWOptions(); - } - - // Test the getEnvironment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetEnvironmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.getEnvironment(null).execute(); - } - - // Test the updateEnvironment operation with a valid options model parameter - @Test - public void testUpdateEnvironmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"environment_id\": \"environmentId\", \"name\": \"name\", \"description\": \"description\", \"created\": \"2019-01-01T12:00:00.000Z\", \"updated\": \"2019-01-01T12:00:00.000Z\", \"status\": \"active\", \"read_only\": true, \"size\": \"LT\", \"requested_size\": \"requestedSize\", \"index_capacity\": {\"documents\": {\"available\": 9, \"maximum_allowed\": 14}, \"disk_usage\": {\"used_bytes\": 9, \"maximum_allowed_bytes\": 19}, \"collections\": {\"available\": 9, \"maximum_allowed\": 14}}, \"search_status\": {\"scope\": \"scope\", \"status\": \"NO_DATA\", \"status_description\": \"statusDescription\", \"last_trained\": \"2019-01-01\"}}"; - String updateEnvironmentPath = "/v1/environments/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateEnvironmentOptions model - UpdateEnvironmentOptions updateEnvironmentOptionsModel = - new UpdateEnvironmentOptions.Builder() - .environmentId("testString") - .name("testString") - .description("testString") - .size("S") - .build(); - - // Invoke updateEnvironment() with a valid options model and verify the result - Response response = - discoveryService.updateEnvironment(updateEnvironmentOptionsModel).execute(); - assertNotNull(response); - Environment responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateEnvironmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the updateEnvironment operation with and without retries enabled - @Test - public void testUpdateEnvironmentWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testUpdateEnvironmentWOptions(); - - discoveryService.disableRetries(); - testUpdateEnvironmentWOptions(); - } - - // Test the updateEnvironment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateEnvironmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.updateEnvironment(null).execute(); - } - - // Test the deleteEnvironment operation with a valid options model parameter - @Test - public void testDeleteEnvironmentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"environment_id\": \"environmentId\", \"status\": \"deleted\"}"; - String deleteEnvironmentPath = "/v1/environments/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteEnvironmentOptions model - DeleteEnvironmentOptions deleteEnvironmentOptionsModel = - new DeleteEnvironmentOptions.Builder().environmentId("testString").build(); - - // Invoke deleteEnvironment() with a valid options model and verify the result - Response response = - discoveryService.deleteEnvironment(deleteEnvironmentOptionsModel).execute(); - assertNotNull(response); - DeleteEnvironmentResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteEnvironmentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the deleteEnvironment operation with and without retries enabled - @Test - public void testDeleteEnvironmentWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testDeleteEnvironmentWOptions(); - - discoveryService.disableRetries(); - testDeleteEnvironmentWOptions(); - } - - // Test the deleteEnvironment operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteEnvironmentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.deleteEnvironment(null).execute(); - } - - // Test the listFields operation with a valid options model parameter - @Test - public void testListFieldsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"fields\": [{\"field\": \"field\", \"type\": \"nested\"}]}"; - String listFieldsPath = "/v1/environments/testString/fields"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListFieldsOptions model - ListFieldsOptions listFieldsOptionsModel = - new ListFieldsOptions.Builder() - .environmentId("testString") - .collectionIds(java.util.Arrays.asList("testString")) - .build(); - - // Invoke listFields() with a valid options model and verify the result - Response response = - discoveryService.listFields(listFieldsOptionsModel).execute(); - assertNotNull(response); - ListCollectionFieldsResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listFieldsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals( - query.get("collection_ids"), RequestUtils.join(java.util.Arrays.asList("testString"), ",")); - } - - // Test the listFields operation with and without retries enabled - @Test - public void testListFieldsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testListFieldsWOptions(); - - discoveryService.disableRetries(); - testListFieldsWOptions(); - } - - // Test the listFields operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListFieldsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.listFields(null).execute(); - } - - // Test the createConfiguration operation with a valid options model parameter - @Test - public void testCreateConfigurationWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"configuration_id\": \"configurationId\", \"name\": \"name\", \"created\": \"2019-01-01T12:00:00.000Z\", \"updated\": \"2019-01-01T12:00:00.000Z\", \"description\": \"description\", \"conversions\": {\"pdf\": {\"heading\": {\"fonts\": [{\"level\": 5, \"min_size\": 7, \"max_size\": 7, \"bold\": true, \"italic\": true, \"name\": \"name\"}]}}, \"word\": {\"heading\": {\"fonts\": [{\"level\": 5, \"min_size\": 7, \"max_size\": 7, \"bold\": true, \"italic\": true, \"name\": \"name\"}], \"styles\": [{\"level\": 5, \"names\": [\"names\"]}]}}, \"html\": {\"exclude_tags_completely\": [\"excludeTagsCompletely\"], \"exclude_tags_keep_content\": [\"excludeTagsKeepContent\"], \"keep_content\": {\"xpaths\": [\"xpaths\"]}, \"exclude_content\": {\"xpaths\": [\"xpaths\"]}, \"keep_tag_attributes\": [\"keepTagAttributes\"], \"exclude_tag_attributes\": [\"excludeTagAttributes\"]}, \"segment\": {\"enabled\": false, \"selector_tags\": [\"selectorTags\"], \"annotated_fields\": [\"annotatedFields\"]}, \"json_normalizations\": [{\"operation\": \"copy\", \"source_field\": \"sourceField\", \"destination_field\": \"destinationField\"}], \"image_text_recognition\": true}, \"enrichments\": [{\"description\": \"description\", \"destination_field\": \"destinationField\", \"source_field\": \"sourceField\", \"overwrite\": false, \"enrichment\": \"enrichment\", \"ignore_downstream_errors\": false, \"options\": {\"features\": {\"keywords\": {\"sentiment\": false, \"emotion\": false, \"limit\": 5}, \"entities\": {\"sentiment\": false, \"emotion\": false, \"limit\": 5, \"mentions\": true, \"mention_types\": true, \"sentence_locations\": false, \"model\": \"model\"}, \"sentiment\": {\"document\": true, \"targets\": [\"target\"]}, \"emotion\": {\"document\": true, \"targets\": [\"target\"]}, \"categories\": {\"anyKey\": \"anyValue\"}, \"semantic_roles\": {\"entities\": true, \"keywords\": true, \"limit\": 5}, \"relations\": {\"model\": \"model\"}, \"concepts\": {\"limit\": 5}}, \"language\": \"ar\", \"model\": \"model\"}}], \"normalizations\": [{\"operation\": \"copy\", \"source_field\": \"sourceField\", \"destination_field\": \"destinationField\"}], \"source\": {\"type\": \"box\", \"credential_id\": \"credentialId\", \"schedule\": {\"enabled\": true, \"time_zone\": \"America/New_York\", \"frequency\": \"daily\"}, \"options\": {\"folders\": [{\"owner_user_id\": \"ownerUserId\", \"folder_id\": \"folderId\", \"limit\": 5}], \"objects\": [{\"name\": \"name\", \"limit\": 5}], \"site_collections\": [{\"site_collection_path\": \"siteCollectionPath\", \"limit\": 5}], \"urls\": [{\"url\": \"url\", \"limit_to_starting_hosts\": true, \"crawl_speed\": \"normal\", \"allow_untrusted_certificate\": false, \"maximum_hops\": 2, \"request_timeout\": 30000, \"override_robots_txt\": false, \"blacklist\": [\"blacklist\"]}], \"buckets\": [{\"name\": \"name\", \"limit\": 5}], \"crawl_all_buckets\": false}}}"; - String createConfigurationPath = "/v1/environments/testString/configurations"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the FontSetting model - FontSetting fontSettingModel = - new FontSetting.Builder() - .level(Long.valueOf("26")) - .minSize(Long.valueOf("26")) - .maxSize(Long.valueOf("26")) - .bold(true) - .italic(true) - .name("testString") - .build(); - - // Construct an instance of the PdfHeadingDetection model - PdfHeadingDetection pdfHeadingDetectionModel = - new PdfHeadingDetection.Builder().fonts(java.util.Arrays.asList(fontSettingModel)).build(); - - // Construct an instance of the PdfSettings model - PdfSettings pdfSettingsModel = - new PdfSettings.Builder().heading(pdfHeadingDetectionModel).build(); - - // Construct an instance of the WordStyle model - WordStyle wordStyleModel = - new WordStyle.Builder() - .level(Long.valueOf("26")) - .names(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the WordHeadingDetection model - WordHeadingDetection wordHeadingDetectionModel = - new WordHeadingDetection.Builder() - .fonts(java.util.Arrays.asList(fontSettingModel)) - .styles(java.util.Arrays.asList(wordStyleModel)) - .build(); - - // Construct an instance of the WordSettings model - WordSettings wordSettingsModel = - new WordSettings.Builder().heading(wordHeadingDetectionModel).build(); - - // Construct an instance of the XPathPatterns model - XPathPatterns xPathPatternsModel = - new XPathPatterns.Builder().xpaths(java.util.Arrays.asList("testString")).build(); - - // Construct an instance of the HtmlSettings model - HtmlSettings htmlSettingsModel = - new HtmlSettings.Builder() - .excludeTagsCompletely(java.util.Arrays.asList("testString")) - .excludeTagsKeepContent(java.util.Arrays.asList("testString")) - .keepContent(xPathPatternsModel) - .excludeContent(xPathPatternsModel) - .keepTagAttributes(java.util.Arrays.asList("testString")) - .excludeTagAttributes(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the SegmentSettings model - SegmentSettings segmentSettingsModel = - new SegmentSettings.Builder() - .enabled(false) - .selectorTags(java.util.Arrays.asList("h1", "h2")) - .annotatedFields(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the NormalizationOperation model - NormalizationOperation normalizationOperationModel = - new NormalizationOperation.Builder() - .operation("copy") - .sourceField("testString") - .destinationField("testString") - .build(); - - // Construct an instance of the Conversions model - Conversions conversionsModel = - new Conversions.Builder() - .pdf(pdfSettingsModel) - .word(wordSettingsModel) - .html(htmlSettingsModel) - .segment(segmentSettingsModel) - .jsonNormalizations(java.util.Arrays.asList(normalizationOperationModel)) - .imageTextRecognition(true) - .build(); - - // Construct an instance of the NluEnrichmentKeywords model - NluEnrichmentKeywords nluEnrichmentKeywordsModel = - new NluEnrichmentKeywords.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .build(); - - // Construct an instance of the NluEnrichmentEntities model - NluEnrichmentEntities nluEnrichmentEntitiesModel = - new NluEnrichmentEntities.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .mentions(true) - .mentionTypes(true) - .sentenceLocations(true) - .model("testString") - .build(); - - // Construct an instance of the NluEnrichmentSentiment model - NluEnrichmentSentiment nluEnrichmentSentimentModel = - new NluEnrichmentSentiment.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the NluEnrichmentEmotion model - NluEnrichmentEmotion nluEnrichmentEmotionModel = - new NluEnrichmentEmotion.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the NluEnrichmentSemanticRoles model - NluEnrichmentSemanticRoles nluEnrichmentSemanticRolesModel = - new NluEnrichmentSemanticRoles.Builder() - .entities(true) - .keywords(true) - .limit(Long.valueOf("26")) - .build(); - - // Construct an instance of the NluEnrichmentRelations model - NluEnrichmentRelations nluEnrichmentRelationsModel = - new NluEnrichmentRelations.Builder().model("testString").build(); - - // Construct an instance of the NluEnrichmentConcepts model - NluEnrichmentConcepts nluEnrichmentConceptsModel = - new NluEnrichmentConcepts.Builder().limit(Long.valueOf("26")).build(); - - // Construct an instance of the NluEnrichmentFeatures model - NluEnrichmentFeatures nluEnrichmentFeaturesModel = - new NluEnrichmentFeatures.Builder() - .keywords(nluEnrichmentKeywordsModel) - .entities(nluEnrichmentEntitiesModel) - .sentiment(nluEnrichmentSentimentModel) - .emotion(nluEnrichmentEmotionModel) - .categories(java.util.Collections.singletonMap("anyKey", "anyValue")) - .semanticRoles(nluEnrichmentSemanticRolesModel) - .relations(nluEnrichmentRelationsModel) - .concepts(nluEnrichmentConceptsModel) - .build(); - - // Construct an instance of the EnrichmentOptions model - EnrichmentOptions enrichmentOptionsModel = - new EnrichmentOptions.Builder() - .features(nluEnrichmentFeaturesModel) - .language("ar") - .model("testString") - .build(); - - // Construct an instance of the Enrichment model - Enrichment enrichmentModel = - new Enrichment.Builder() - .description("testString") - .destinationField("testString") - .sourceField("testString") - .overwrite(false) - .enrichment("testString") - .ignoreDownstreamErrors(false) - .options(enrichmentOptionsModel) - .build(); - - // Construct an instance of the SourceSchedule model - SourceSchedule sourceScheduleModel = - new SourceSchedule.Builder() - .enabled(true) - .timeZone("America/New_York") - .frequency("daily") - .build(); - - // Construct an instance of the SourceOptionsFolder model - SourceOptionsFolder sourceOptionsFolderModel = - new SourceOptionsFolder.Builder() - .ownerUserId("testString") - .folderId("testString") - .limit(Long.valueOf("26")) - .build(); - - // Construct an instance of the SourceOptionsObject model - SourceOptionsObject sourceOptionsObjectModel = - new SourceOptionsObject.Builder().name("testString").limit(Long.valueOf("26")).build(); - - // Construct an instance of the SourceOptionsSiteColl model - SourceOptionsSiteColl sourceOptionsSiteCollModel = - new SourceOptionsSiteColl.Builder() - .siteCollectionPath("testString") - .limit(Long.valueOf("26")) - .build(); - - // Construct an instance of the SourceOptionsWebCrawl model - SourceOptionsWebCrawl sourceOptionsWebCrawlModel = - new SourceOptionsWebCrawl.Builder() - .url("testString") - .limitToStartingHosts(true) - .crawlSpeed("normal") - .allowUntrustedCertificate(false) - .maximumHops(Long.valueOf("2")) - .requestTimeout(Long.valueOf("30000")) - .overrideRobotsTxt(false) - .blacklist(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the SourceOptionsBuckets model - SourceOptionsBuckets sourceOptionsBucketsModel = - new SourceOptionsBuckets.Builder().name("testString").limit(Long.valueOf("26")).build(); - - // Construct an instance of the SourceOptions model - SourceOptions sourceOptionsModel = - new SourceOptions.Builder() - .folders(java.util.Arrays.asList(sourceOptionsFolderModel)) - .objects(java.util.Arrays.asList(sourceOptionsObjectModel)) - .siteCollections(java.util.Arrays.asList(sourceOptionsSiteCollModel)) - .urls(java.util.Arrays.asList(sourceOptionsWebCrawlModel)) - .buckets(java.util.Arrays.asList(sourceOptionsBucketsModel)) - .crawlAllBuckets(true) - .build(); - - // Construct an instance of the Source model - Source sourceModel = - new Source.Builder() - .type("box") - .credentialId("testString") - .schedule(sourceScheduleModel) - .options(sourceOptionsModel) - .build(); - - // Construct an instance of the CreateConfigurationOptions model - CreateConfigurationOptions createConfigurationOptionsModel = - new CreateConfigurationOptions.Builder() - .environmentId("testString") - .name("testString") - .description("testString") - .conversions(conversionsModel) - .enrichments(java.util.Arrays.asList(enrichmentModel)) - .normalizations(java.util.Arrays.asList(normalizationOperationModel)) - .source(sourceModel) - .build(); - - // Invoke createConfiguration() with a valid options model and verify the result - Response response = - discoveryService.createConfiguration(createConfigurationOptionsModel).execute(); - assertNotNull(response); - Configuration responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createConfigurationPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the createConfiguration operation with and without retries enabled - @Test - public void testCreateConfigurationWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testCreateConfigurationWOptions(); - - discoveryService.disableRetries(); - testCreateConfigurationWOptions(); - } - - // Test the createConfiguration operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateConfigurationNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.createConfiguration(null).execute(); - } - - // Test the listConfigurations operation with a valid options model parameter - @Test - public void testListConfigurationsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"configurations\": [{\"configuration_id\": \"configurationId\", \"name\": \"name\", \"created\": \"2019-01-01T12:00:00.000Z\", \"updated\": \"2019-01-01T12:00:00.000Z\", \"description\": \"description\", \"conversions\": {\"pdf\": {\"heading\": {\"fonts\": [{\"level\": 5, \"min_size\": 7, \"max_size\": 7, \"bold\": true, \"italic\": true, \"name\": \"name\"}]}}, \"word\": {\"heading\": {\"fonts\": [{\"level\": 5, \"min_size\": 7, \"max_size\": 7, \"bold\": true, \"italic\": true, \"name\": \"name\"}], \"styles\": [{\"level\": 5, \"names\": [\"names\"]}]}}, \"html\": {\"exclude_tags_completely\": [\"excludeTagsCompletely\"], \"exclude_tags_keep_content\": [\"excludeTagsKeepContent\"], \"keep_content\": {\"xpaths\": [\"xpaths\"]}, \"exclude_content\": {\"xpaths\": [\"xpaths\"]}, \"keep_tag_attributes\": [\"keepTagAttributes\"], \"exclude_tag_attributes\": [\"excludeTagAttributes\"]}, \"segment\": {\"enabled\": false, \"selector_tags\": [\"selectorTags\"], \"annotated_fields\": [\"annotatedFields\"]}, \"json_normalizations\": [{\"operation\": \"copy\", \"source_field\": \"sourceField\", \"destination_field\": \"destinationField\"}], \"image_text_recognition\": true}, \"enrichments\": [{\"description\": \"description\", \"destination_field\": \"destinationField\", \"source_field\": \"sourceField\", \"overwrite\": false, \"enrichment\": \"enrichment\", \"ignore_downstream_errors\": false, \"options\": {\"features\": {\"keywords\": {\"sentiment\": false, \"emotion\": false, \"limit\": 5}, \"entities\": {\"sentiment\": false, \"emotion\": false, \"limit\": 5, \"mentions\": true, \"mention_types\": true, \"sentence_locations\": false, \"model\": \"model\"}, \"sentiment\": {\"document\": true, \"targets\": [\"target\"]}, \"emotion\": {\"document\": true, \"targets\": [\"target\"]}, \"categories\": {\"anyKey\": \"anyValue\"}, \"semantic_roles\": {\"entities\": true, \"keywords\": true, \"limit\": 5}, \"relations\": {\"model\": \"model\"}, \"concepts\": {\"limit\": 5}}, \"language\": \"ar\", \"model\": \"model\"}}], \"normalizations\": [{\"operation\": \"copy\", \"source_field\": \"sourceField\", \"destination_field\": \"destinationField\"}], \"source\": {\"type\": \"box\", \"credential_id\": \"credentialId\", \"schedule\": {\"enabled\": true, \"time_zone\": \"America/New_York\", \"frequency\": \"daily\"}, \"options\": {\"folders\": [{\"owner_user_id\": \"ownerUserId\", \"folder_id\": \"folderId\", \"limit\": 5}], \"objects\": [{\"name\": \"name\", \"limit\": 5}], \"site_collections\": [{\"site_collection_path\": \"siteCollectionPath\", \"limit\": 5}], \"urls\": [{\"url\": \"url\", \"limit_to_starting_hosts\": true, \"crawl_speed\": \"normal\", \"allow_untrusted_certificate\": false, \"maximum_hops\": 2, \"request_timeout\": 30000, \"override_robots_txt\": false, \"blacklist\": [\"blacklist\"]}], \"buckets\": [{\"name\": \"name\", \"limit\": 5}], \"crawl_all_buckets\": false}}}]}"; - String listConfigurationsPath = "/v1/environments/testString/configurations"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListConfigurationsOptions model - ListConfigurationsOptions listConfigurationsOptionsModel = - new ListConfigurationsOptions.Builder() - .environmentId("testString") - .name("testString") - .build(); - - // Invoke listConfigurations() with a valid options model and verify the result - Response response = - discoveryService.listConfigurations(listConfigurationsOptionsModel).execute(); - assertNotNull(response); - ListConfigurationsResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listConfigurationsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals(query.get("name"), "testString"); - } - - // Test the listConfigurations operation with and without retries enabled - @Test - public void testListConfigurationsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testListConfigurationsWOptions(); - - discoveryService.disableRetries(); - testListConfigurationsWOptions(); - } - - // Test the listConfigurations operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListConfigurationsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.listConfigurations(null).execute(); - } - - // Test the getConfiguration operation with a valid options model parameter - @Test - public void testGetConfigurationWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"configuration_id\": \"configurationId\", \"name\": \"name\", \"created\": \"2019-01-01T12:00:00.000Z\", \"updated\": \"2019-01-01T12:00:00.000Z\", \"description\": \"description\", \"conversions\": {\"pdf\": {\"heading\": {\"fonts\": [{\"level\": 5, \"min_size\": 7, \"max_size\": 7, \"bold\": true, \"italic\": true, \"name\": \"name\"}]}}, \"word\": {\"heading\": {\"fonts\": [{\"level\": 5, \"min_size\": 7, \"max_size\": 7, \"bold\": true, \"italic\": true, \"name\": \"name\"}], \"styles\": [{\"level\": 5, \"names\": [\"names\"]}]}}, \"html\": {\"exclude_tags_completely\": [\"excludeTagsCompletely\"], \"exclude_tags_keep_content\": [\"excludeTagsKeepContent\"], \"keep_content\": {\"xpaths\": [\"xpaths\"]}, \"exclude_content\": {\"xpaths\": [\"xpaths\"]}, \"keep_tag_attributes\": [\"keepTagAttributes\"], \"exclude_tag_attributes\": [\"excludeTagAttributes\"]}, \"segment\": {\"enabled\": false, \"selector_tags\": [\"selectorTags\"], \"annotated_fields\": [\"annotatedFields\"]}, \"json_normalizations\": [{\"operation\": \"copy\", \"source_field\": \"sourceField\", \"destination_field\": \"destinationField\"}], \"image_text_recognition\": true}, \"enrichments\": [{\"description\": \"description\", \"destination_field\": \"destinationField\", \"source_field\": \"sourceField\", \"overwrite\": false, \"enrichment\": \"enrichment\", \"ignore_downstream_errors\": false, \"options\": {\"features\": {\"keywords\": {\"sentiment\": false, \"emotion\": false, \"limit\": 5}, \"entities\": {\"sentiment\": false, \"emotion\": false, \"limit\": 5, \"mentions\": true, \"mention_types\": true, \"sentence_locations\": false, \"model\": \"model\"}, \"sentiment\": {\"document\": true, \"targets\": [\"target\"]}, \"emotion\": {\"document\": true, \"targets\": [\"target\"]}, \"categories\": {\"anyKey\": \"anyValue\"}, \"semantic_roles\": {\"entities\": true, \"keywords\": true, \"limit\": 5}, \"relations\": {\"model\": \"model\"}, \"concepts\": {\"limit\": 5}}, \"language\": \"ar\", \"model\": \"model\"}}], \"normalizations\": [{\"operation\": \"copy\", \"source_field\": \"sourceField\", \"destination_field\": \"destinationField\"}], \"source\": {\"type\": \"box\", \"credential_id\": \"credentialId\", \"schedule\": {\"enabled\": true, \"time_zone\": \"America/New_York\", \"frequency\": \"daily\"}, \"options\": {\"folders\": [{\"owner_user_id\": \"ownerUserId\", \"folder_id\": \"folderId\", \"limit\": 5}], \"objects\": [{\"name\": \"name\", \"limit\": 5}], \"site_collections\": [{\"site_collection_path\": \"siteCollectionPath\", \"limit\": 5}], \"urls\": [{\"url\": \"url\", \"limit_to_starting_hosts\": true, \"crawl_speed\": \"normal\", \"allow_untrusted_certificate\": false, \"maximum_hops\": 2, \"request_timeout\": 30000, \"override_robots_txt\": false, \"blacklist\": [\"blacklist\"]}], \"buckets\": [{\"name\": \"name\", \"limit\": 5}], \"crawl_all_buckets\": false}}}"; - String getConfigurationPath = "/v1/environments/testString/configurations/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetConfigurationOptions model - GetConfigurationOptions getConfigurationOptionsModel = - new GetConfigurationOptions.Builder() - .environmentId("testString") - .configurationId("testString") - .build(); - - // Invoke getConfiguration() with a valid options model and verify the result - Response response = - discoveryService.getConfiguration(getConfigurationOptionsModel).execute(); - assertNotNull(response); - Configuration responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getConfigurationPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the getConfiguration operation with and without retries enabled - @Test - public void testGetConfigurationWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetConfigurationWOptions(); - - discoveryService.disableRetries(); - testGetConfigurationWOptions(); - } - - // Test the getConfiguration operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetConfigurationNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.getConfiguration(null).execute(); - } - - // Test the updateConfiguration operation with a valid options model parameter - @Test - public void testUpdateConfigurationWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"configuration_id\": \"configurationId\", \"name\": \"name\", \"created\": \"2019-01-01T12:00:00.000Z\", \"updated\": \"2019-01-01T12:00:00.000Z\", \"description\": \"description\", \"conversions\": {\"pdf\": {\"heading\": {\"fonts\": [{\"level\": 5, \"min_size\": 7, \"max_size\": 7, \"bold\": true, \"italic\": true, \"name\": \"name\"}]}}, \"word\": {\"heading\": {\"fonts\": [{\"level\": 5, \"min_size\": 7, \"max_size\": 7, \"bold\": true, \"italic\": true, \"name\": \"name\"}], \"styles\": [{\"level\": 5, \"names\": [\"names\"]}]}}, \"html\": {\"exclude_tags_completely\": [\"excludeTagsCompletely\"], \"exclude_tags_keep_content\": [\"excludeTagsKeepContent\"], \"keep_content\": {\"xpaths\": [\"xpaths\"]}, \"exclude_content\": {\"xpaths\": [\"xpaths\"]}, \"keep_tag_attributes\": [\"keepTagAttributes\"], \"exclude_tag_attributes\": [\"excludeTagAttributes\"]}, \"segment\": {\"enabled\": false, \"selector_tags\": [\"selectorTags\"], \"annotated_fields\": [\"annotatedFields\"]}, \"json_normalizations\": [{\"operation\": \"copy\", \"source_field\": \"sourceField\", \"destination_field\": \"destinationField\"}], \"image_text_recognition\": true}, \"enrichments\": [{\"description\": \"description\", \"destination_field\": \"destinationField\", \"source_field\": \"sourceField\", \"overwrite\": false, \"enrichment\": \"enrichment\", \"ignore_downstream_errors\": false, \"options\": {\"features\": {\"keywords\": {\"sentiment\": false, \"emotion\": false, \"limit\": 5}, \"entities\": {\"sentiment\": false, \"emotion\": false, \"limit\": 5, \"mentions\": true, \"mention_types\": true, \"sentence_locations\": false, \"model\": \"model\"}, \"sentiment\": {\"document\": true, \"targets\": [\"target\"]}, \"emotion\": {\"document\": true, \"targets\": [\"target\"]}, \"categories\": {\"anyKey\": \"anyValue\"}, \"semantic_roles\": {\"entities\": true, \"keywords\": true, \"limit\": 5}, \"relations\": {\"model\": \"model\"}, \"concepts\": {\"limit\": 5}}, \"language\": \"ar\", \"model\": \"model\"}}], \"normalizations\": [{\"operation\": \"copy\", \"source_field\": \"sourceField\", \"destination_field\": \"destinationField\"}], \"source\": {\"type\": \"box\", \"credential_id\": \"credentialId\", \"schedule\": {\"enabled\": true, \"time_zone\": \"America/New_York\", \"frequency\": \"daily\"}, \"options\": {\"folders\": [{\"owner_user_id\": \"ownerUserId\", \"folder_id\": \"folderId\", \"limit\": 5}], \"objects\": [{\"name\": \"name\", \"limit\": 5}], \"site_collections\": [{\"site_collection_path\": \"siteCollectionPath\", \"limit\": 5}], \"urls\": [{\"url\": \"url\", \"limit_to_starting_hosts\": true, \"crawl_speed\": \"normal\", \"allow_untrusted_certificate\": false, \"maximum_hops\": 2, \"request_timeout\": 30000, \"override_robots_txt\": false, \"blacklist\": [\"blacklist\"]}], \"buckets\": [{\"name\": \"name\", \"limit\": 5}], \"crawl_all_buckets\": false}}}"; - String updateConfigurationPath = "/v1/environments/testString/configurations/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the FontSetting model - FontSetting fontSettingModel = - new FontSetting.Builder() - .level(Long.valueOf("26")) - .minSize(Long.valueOf("26")) - .maxSize(Long.valueOf("26")) - .bold(true) - .italic(true) - .name("testString") - .build(); - - // Construct an instance of the PdfHeadingDetection model - PdfHeadingDetection pdfHeadingDetectionModel = - new PdfHeadingDetection.Builder().fonts(java.util.Arrays.asList(fontSettingModel)).build(); - - // Construct an instance of the PdfSettings model - PdfSettings pdfSettingsModel = - new PdfSettings.Builder().heading(pdfHeadingDetectionModel).build(); - - // Construct an instance of the WordStyle model - WordStyle wordStyleModel = - new WordStyle.Builder() - .level(Long.valueOf("26")) - .names(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the WordHeadingDetection model - WordHeadingDetection wordHeadingDetectionModel = - new WordHeadingDetection.Builder() - .fonts(java.util.Arrays.asList(fontSettingModel)) - .styles(java.util.Arrays.asList(wordStyleModel)) - .build(); - - // Construct an instance of the WordSettings model - WordSettings wordSettingsModel = - new WordSettings.Builder().heading(wordHeadingDetectionModel).build(); - - // Construct an instance of the XPathPatterns model - XPathPatterns xPathPatternsModel = - new XPathPatterns.Builder().xpaths(java.util.Arrays.asList("testString")).build(); - - // Construct an instance of the HtmlSettings model - HtmlSettings htmlSettingsModel = - new HtmlSettings.Builder() - .excludeTagsCompletely(java.util.Arrays.asList("testString")) - .excludeTagsKeepContent(java.util.Arrays.asList("testString")) - .keepContent(xPathPatternsModel) - .excludeContent(xPathPatternsModel) - .keepTagAttributes(java.util.Arrays.asList("testString")) - .excludeTagAttributes(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the SegmentSettings model - SegmentSettings segmentSettingsModel = - new SegmentSettings.Builder() - .enabled(false) - .selectorTags(java.util.Arrays.asList("h1", "h2")) - .annotatedFields(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the NormalizationOperation model - NormalizationOperation normalizationOperationModel = - new NormalizationOperation.Builder() - .operation("copy") - .sourceField("testString") - .destinationField("testString") - .build(); - - // Construct an instance of the Conversions model - Conversions conversionsModel = - new Conversions.Builder() - .pdf(pdfSettingsModel) - .word(wordSettingsModel) - .html(htmlSettingsModel) - .segment(segmentSettingsModel) - .jsonNormalizations(java.util.Arrays.asList(normalizationOperationModel)) - .imageTextRecognition(true) - .build(); - - // Construct an instance of the NluEnrichmentKeywords model - NluEnrichmentKeywords nluEnrichmentKeywordsModel = - new NluEnrichmentKeywords.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .build(); - - // Construct an instance of the NluEnrichmentEntities model - NluEnrichmentEntities nluEnrichmentEntitiesModel = - new NluEnrichmentEntities.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .mentions(true) - .mentionTypes(true) - .sentenceLocations(true) - .model("testString") - .build(); - - // Construct an instance of the NluEnrichmentSentiment model - NluEnrichmentSentiment nluEnrichmentSentimentModel = - new NluEnrichmentSentiment.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the NluEnrichmentEmotion model - NluEnrichmentEmotion nluEnrichmentEmotionModel = - new NluEnrichmentEmotion.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the NluEnrichmentSemanticRoles model - NluEnrichmentSemanticRoles nluEnrichmentSemanticRolesModel = - new NluEnrichmentSemanticRoles.Builder() - .entities(true) - .keywords(true) - .limit(Long.valueOf("26")) - .build(); - - // Construct an instance of the NluEnrichmentRelations model - NluEnrichmentRelations nluEnrichmentRelationsModel = - new NluEnrichmentRelations.Builder().model("testString").build(); - - // Construct an instance of the NluEnrichmentConcepts model - NluEnrichmentConcepts nluEnrichmentConceptsModel = - new NluEnrichmentConcepts.Builder().limit(Long.valueOf("26")).build(); - - // Construct an instance of the NluEnrichmentFeatures model - NluEnrichmentFeatures nluEnrichmentFeaturesModel = - new NluEnrichmentFeatures.Builder() - .keywords(nluEnrichmentKeywordsModel) - .entities(nluEnrichmentEntitiesModel) - .sentiment(nluEnrichmentSentimentModel) - .emotion(nluEnrichmentEmotionModel) - .categories(java.util.Collections.singletonMap("anyKey", "anyValue")) - .semanticRoles(nluEnrichmentSemanticRolesModel) - .relations(nluEnrichmentRelationsModel) - .concepts(nluEnrichmentConceptsModel) - .build(); - - // Construct an instance of the EnrichmentOptions model - EnrichmentOptions enrichmentOptionsModel = - new EnrichmentOptions.Builder() - .features(nluEnrichmentFeaturesModel) - .language("ar") - .model("testString") - .build(); - - // Construct an instance of the Enrichment model - Enrichment enrichmentModel = - new Enrichment.Builder() - .description("testString") - .destinationField("testString") - .sourceField("testString") - .overwrite(false) - .enrichment("testString") - .ignoreDownstreamErrors(false) - .options(enrichmentOptionsModel) - .build(); - - // Construct an instance of the SourceSchedule model - SourceSchedule sourceScheduleModel = - new SourceSchedule.Builder() - .enabled(true) - .timeZone("America/New_York") - .frequency("daily") - .build(); - - // Construct an instance of the SourceOptionsFolder model - SourceOptionsFolder sourceOptionsFolderModel = - new SourceOptionsFolder.Builder() - .ownerUserId("testString") - .folderId("testString") - .limit(Long.valueOf("26")) - .build(); - - // Construct an instance of the SourceOptionsObject model - SourceOptionsObject sourceOptionsObjectModel = - new SourceOptionsObject.Builder().name("testString").limit(Long.valueOf("26")).build(); - - // Construct an instance of the SourceOptionsSiteColl model - SourceOptionsSiteColl sourceOptionsSiteCollModel = - new SourceOptionsSiteColl.Builder() - .siteCollectionPath("testString") - .limit(Long.valueOf("26")) - .build(); - - // Construct an instance of the SourceOptionsWebCrawl model - SourceOptionsWebCrawl sourceOptionsWebCrawlModel = - new SourceOptionsWebCrawl.Builder() - .url("testString") - .limitToStartingHosts(true) - .crawlSpeed("normal") - .allowUntrustedCertificate(false) - .maximumHops(Long.valueOf("2")) - .requestTimeout(Long.valueOf("30000")) - .overrideRobotsTxt(false) - .blacklist(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the SourceOptionsBuckets model - SourceOptionsBuckets sourceOptionsBucketsModel = - new SourceOptionsBuckets.Builder().name("testString").limit(Long.valueOf("26")).build(); - - // Construct an instance of the SourceOptions model - SourceOptions sourceOptionsModel = - new SourceOptions.Builder() - .folders(java.util.Arrays.asList(sourceOptionsFolderModel)) - .objects(java.util.Arrays.asList(sourceOptionsObjectModel)) - .siteCollections(java.util.Arrays.asList(sourceOptionsSiteCollModel)) - .urls(java.util.Arrays.asList(sourceOptionsWebCrawlModel)) - .buckets(java.util.Arrays.asList(sourceOptionsBucketsModel)) - .crawlAllBuckets(true) - .build(); - - // Construct an instance of the Source model - Source sourceModel = - new Source.Builder() - .type("box") - .credentialId("testString") - .schedule(sourceScheduleModel) - .options(sourceOptionsModel) - .build(); - - // Construct an instance of the UpdateConfigurationOptions model - UpdateConfigurationOptions updateConfigurationOptionsModel = - new UpdateConfigurationOptions.Builder() - .environmentId("testString") - .configurationId("testString") - .name("testString") - .description("testString") - .conversions(conversionsModel) - .enrichments(java.util.Arrays.asList(enrichmentModel)) - .normalizations(java.util.Arrays.asList(normalizationOperationModel)) - .source(sourceModel) - .build(); - - // Invoke updateConfiguration() with a valid options model and verify the result - Response response = - discoveryService.updateConfiguration(updateConfigurationOptionsModel).execute(); - assertNotNull(response); - Configuration responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateConfigurationPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the updateConfiguration operation with and without retries enabled - @Test - public void testUpdateConfigurationWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testUpdateConfigurationWOptions(); - - discoveryService.disableRetries(); - testUpdateConfigurationWOptions(); - } - - // Test the updateConfiguration operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateConfigurationNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.updateConfiguration(null).execute(); - } - - // Test the deleteConfiguration operation with a valid options model parameter - @Test - public void testDeleteConfigurationWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"configuration_id\": \"configurationId\", \"status\": \"deleted\", \"notices\": [{\"notice_id\": \"noticeId\", \"created\": \"2019-01-01T12:00:00.000Z\", \"document_id\": \"documentId\", \"query_id\": \"queryId\", \"severity\": \"warning\", \"step\": \"step\", \"description\": \"description\"}]}"; - String deleteConfigurationPath = "/v1/environments/testString/configurations/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteConfigurationOptions model - DeleteConfigurationOptions deleteConfigurationOptionsModel = - new DeleteConfigurationOptions.Builder() - .environmentId("testString") - .configurationId("testString") - .build(); - - // Invoke deleteConfiguration() with a valid options model and verify the result - Response response = - discoveryService.deleteConfiguration(deleteConfigurationOptionsModel).execute(); - assertNotNull(response); - DeleteConfigurationResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteConfigurationPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the deleteConfiguration operation with and without retries enabled - @Test - public void testDeleteConfigurationWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testDeleteConfigurationWOptions(); - - discoveryService.disableRetries(); - testDeleteConfigurationWOptions(); - } - - // Test the deleteConfiguration operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteConfigurationNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.deleteConfiguration(null).execute(); - } - - // Test the createCollection operation with a valid options model parameter - @Test - public void testCreateCollectionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"collection_id\": \"collectionId\", \"name\": \"name\", \"description\": \"description\", \"created\": \"2019-01-01T12:00:00.000Z\", \"updated\": \"2019-01-01T12:00:00.000Z\", \"status\": \"active\", \"configuration_id\": \"configurationId\", \"language\": \"language\", \"document_counts\": {\"available\": 9, \"processing\": 10, \"failed\": 6, \"pending\": 7}, \"disk_usage\": {\"used_bytes\": 9}, \"training_status\": {\"total_examples\": 13, \"available\": false, \"processing\": true, \"minimum_queries_added\": false, \"minimum_examples_added\": true, \"sufficient_label_diversity\": true, \"notices\": 7, \"successfully_trained\": \"2019-01-01T12:00:00.000Z\", \"data_updated\": \"2019-01-01T12:00:00.000Z\"}, \"crawl_status\": {\"source_crawl\": {\"status\": \"running\", \"next_crawl\": \"2019-01-01T12:00:00.000Z\"}}, \"smart_document_understanding\": {\"enabled\": true, \"total_annotated_pages\": 19, \"total_pages\": 10, \"total_documents\": 14, \"custom_fields\": {\"defined\": 7, \"maximum_allowed\": 14}}}"; - String createCollectionPath = "/v1/environments/testString/collections"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the CreateCollectionOptions model - CreateCollectionOptions createCollectionOptionsModel = - new CreateCollectionOptions.Builder() - .environmentId("testString") - .name("testString") - .description("testString") - .configurationId("testString") - .language("en") - .build(); - - // Invoke createCollection() with a valid options model and verify the result - Response response = - discoveryService.createCollection(createCollectionOptionsModel).execute(); - assertNotNull(response); - Collection responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createCollectionPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the createCollection operation with and without retries enabled - @Test - public void testCreateCollectionWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testCreateCollectionWOptions(); - - discoveryService.disableRetries(); - testCreateCollectionWOptions(); - } - - // Test the createCollection operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateCollectionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.createCollection(null).execute(); - } - - // Test the listCollections operation with a valid options model parameter - @Test - public void testListCollectionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"collections\": [{\"collection_id\": \"collectionId\", \"name\": \"name\", \"description\": \"description\", \"created\": \"2019-01-01T12:00:00.000Z\", \"updated\": \"2019-01-01T12:00:00.000Z\", \"status\": \"active\", \"configuration_id\": \"configurationId\", \"language\": \"language\", \"document_counts\": {\"available\": 9, \"processing\": 10, \"failed\": 6, \"pending\": 7}, \"disk_usage\": {\"used_bytes\": 9}, \"training_status\": {\"total_examples\": 13, \"available\": false, \"processing\": true, \"minimum_queries_added\": false, \"minimum_examples_added\": true, \"sufficient_label_diversity\": true, \"notices\": 7, \"successfully_trained\": \"2019-01-01T12:00:00.000Z\", \"data_updated\": \"2019-01-01T12:00:00.000Z\"}, \"crawl_status\": {\"source_crawl\": {\"status\": \"running\", \"next_crawl\": \"2019-01-01T12:00:00.000Z\"}}, \"smart_document_understanding\": {\"enabled\": true, \"total_annotated_pages\": 19, \"total_pages\": 10, \"total_documents\": 14, \"custom_fields\": {\"defined\": 7, \"maximum_allowed\": 14}}}]}"; - String listCollectionsPath = "/v1/environments/testString/collections"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListCollectionsOptions model - ListCollectionsOptions listCollectionsOptionsModel = - new ListCollectionsOptions.Builder().environmentId("testString").name("testString").build(); - - // Invoke listCollections() with a valid options model and verify the result - Response response = - discoveryService.listCollections(listCollectionsOptionsModel).execute(); - assertNotNull(response); - ListCollectionsResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listCollectionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals(query.get("name"), "testString"); - } - - // Test the listCollections operation with and without retries enabled - @Test - public void testListCollectionsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testListCollectionsWOptions(); - - discoveryService.disableRetries(); - testListCollectionsWOptions(); - } - - // Test the listCollections operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListCollectionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.listCollections(null).execute(); - } - - // Test the getCollection operation with a valid options model parameter - @Test - public void testGetCollectionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"collection_id\": \"collectionId\", \"name\": \"name\", \"description\": \"description\", \"created\": \"2019-01-01T12:00:00.000Z\", \"updated\": \"2019-01-01T12:00:00.000Z\", \"status\": \"active\", \"configuration_id\": \"configurationId\", \"language\": \"language\", \"document_counts\": {\"available\": 9, \"processing\": 10, \"failed\": 6, \"pending\": 7}, \"disk_usage\": {\"used_bytes\": 9}, \"training_status\": {\"total_examples\": 13, \"available\": false, \"processing\": true, \"minimum_queries_added\": false, \"minimum_examples_added\": true, \"sufficient_label_diversity\": true, \"notices\": 7, \"successfully_trained\": \"2019-01-01T12:00:00.000Z\", \"data_updated\": \"2019-01-01T12:00:00.000Z\"}, \"crawl_status\": {\"source_crawl\": {\"status\": \"running\", \"next_crawl\": \"2019-01-01T12:00:00.000Z\"}}, \"smart_document_understanding\": {\"enabled\": true, \"total_annotated_pages\": 19, \"total_pages\": 10, \"total_documents\": 14, \"custom_fields\": {\"defined\": 7, \"maximum_allowed\": 14}}}"; - String getCollectionPath = "/v1/environments/testString/collections/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetCollectionOptions model - GetCollectionOptions getCollectionOptionsModel = - new GetCollectionOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - - // Invoke getCollection() with a valid options model and verify the result - Response response = - discoveryService.getCollection(getCollectionOptionsModel).execute(); - assertNotNull(response); - Collection responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getCollectionPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the getCollection operation with and without retries enabled - @Test - public void testGetCollectionWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetCollectionWOptions(); - - discoveryService.disableRetries(); - testGetCollectionWOptions(); - } - - // Test the getCollection operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetCollectionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.getCollection(null).execute(); - } - - // Test the updateCollection operation with a valid options model parameter - @Test - public void testUpdateCollectionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"collection_id\": \"collectionId\", \"name\": \"name\", \"description\": \"description\", \"created\": \"2019-01-01T12:00:00.000Z\", \"updated\": \"2019-01-01T12:00:00.000Z\", \"status\": \"active\", \"configuration_id\": \"configurationId\", \"language\": \"language\", \"document_counts\": {\"available\": 9, \"processing\": 10, \"failed\": 6, \"pending\": 7}, \"disk_usage\": {\"used_bytes\": 9}, \"training_status\": {\"total_examples\": 13, \"available\": false, \"processing\": true, \"minimum_queries_added\": false, \"minimum_examples_added\": true, \"sufficient_label_diversity\": true, \"notices\": 7, \"successfully_trained\": \"2019-01-01T12:00:00.000Z\", \"data_updated\": \"2019-01-01T12:00:00.000Z\"}, \"crawl_status\": {\"source_crawl\": {\"status\": \"running\", \"next_crawl\": \"2019-01-01T12:00:00.000Z\"}}, \"smart_document_understanding\": {\"enabled\": true, \"total_annotated_pages\": 19, \"total_pages\": 10, \"total_documents\": 14, \"custom_fields\": {\"defined\": 7, \"maximum_allowed\": 14}}}"; - String updateCollectionPath = "/v1/environments/testString/collections/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateCollectionOptions model - UpdateCollectionOptions updateCollectionOptionsModel = - new UpdateCollectionOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .name("testString") - .description("testString") - .configurationId("testString") - .build(); - - // Invoke updateCollection() with a valid options model and verify the result - Response response = - discoveryService.updateCollection(updateCollectionOptionsModel).execute(); - assertNotNull(response); - Collection responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateCollectionPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the updateCollection operation with and without retries enabled - @Test - public void testUpdateCollectionWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testUpdateCollectionWOptions(); - - discoveryService.disableRetries(); - testUpdateCollectionWOptions(); - } - - // Test the updateCollection operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateCollectionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.updateCollection(null).execute(); - } - - // Test the deleteCollection operation with a valid options model parameter - @Test - public void testDeleteCollectionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"collection_id\": \"collectionId\", \"status\": \"deleted\"}"; - String deleteCollectionPath = "/v1/environments/testString/collections/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteCollectionOptions model - DeleteCollectionOptions deleteCollectionOptionsModel = - new DeleteCollectionOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - - // Invoke deleteCollection() with a valid options model and verify the result - Response response = - discoveryService.deleteCollection(deleteCollectionOptionsModel).execute(); - assertNotNull(response); - DeleteCollectionResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteCollectionPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the deleteCollection operation with and without retries enabled - @Test - public void testDeleteCollectionWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testDeleteCollectionWOptions(); - - discoveryService.disableRetries(); - testDeleteCollectionWOptions(); - } - - // Test the deleteCollection operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteCollectionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.deleteCollection(null).execute(); - } - - // Test the listCollectionFields operation with a valid options model parameter - @Test - public void testListCollectionFieldsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"fields\": [{\"field\": \"field\", \"type\": \"nested\"}]}"; - String listCollectionFieldsPath = "/v1/environments/testString/collections/testString/fields"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListCollectionFieldsOptions model - ListCollectionFieldsOptions listCollectionFieldsOptionsModel = - new ListCollectionFieldsOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - - // Invoke listCollectionFields() with a valid options model and verify the result - Response response = - discoveryService.listCollectionFields(listCollectionFieldsOptionsModel).execute(); - assertNotNull(response); - ListCollectionFieldsResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listCollectionFieldsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the listCollectionFields operation with and without retries enabled - @Test - public void testListCollectionFieldsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testListCollectionFieldsWOptions(); - - discoveryService.disableRetries(); - testListCollectionFieldsWOptions(); - } - - // Test the listCollectionFields operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListCollectionFieldsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.listCollectionFields(null).execute(); - } - - // Test the listExpansions operation with a valid options model parameter - @Test - public void testListExpansionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"expansions\": [{\"input_terms\": [\"inputTerms\"], \"expanded_terms\": [\"expandedTerms\"]}]}"; - String listExpansionsPath = "/v1/environments/testString/collections/testString/expansions"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListExpansionsOptions model - ListExpansionsOptions listExpansionsOptionsModel = - new ListExpansionsOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - - // Invoke listExpansions() with a valid options model and verify the result - Response response = - discoveryService.listExpansions(listExpansionsOptionsModel).execute(); - assertNotNull(response); - Expansions responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listExpansionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the listExpansions operation with and without retries enabled - @Test - public void testListExpansionsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testListExpansionsWOptions(); - - discoveryService.disableRetries(); - testListExpansionsWOptions(); - } - - // Test the listExpansions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListExpansionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.listExpansions(null).execute(); - } - - // Test the createExpansions operation with a valid options model parameter - @Test - public void testCreateExpansionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"expansions\": [{\"input_terms\": [\"inputTerms\"], \"expanded_terms\": [\"expandedTerms\"]}]}"; - String createExpansionsPath = "/v1/environments/testString/collections/testString/expansions"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the Expansion model - Expansion expansionModel = - new Expansion.Builder() - .inputTerms(java.util.Arrays.asList("testString")) - .expandedTerms(java.util.Arrays.asList("testString")) - .build(); - - // Construct an instance of the CreateExpansionsOptions model - CreateExpansionsOptions createExpansionsOptionsModel = - new CreateExpansionsOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .expansions(java.util.Arrays.asList(expansionModel)) - .build(); - - // Invoke createExpansions() with a valid options model and verify the result - Response response = - discoveryService.createExpansions(createExpansionsOptionsModel).execute(); - assertNotNull(response); - Expansions responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createExpansionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the createExpansions operation with and without retries enabled - @Test - public void testCreateExpansionsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testCreateExpansionsWOptions(); - - discoveryService.disableRetries(); - testCreateExpansionsWOptions(); - } - - // Test the createExpansions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateExpansionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.createExpansions(null).execute(); - } - - // Test the deleteExpansions operation with a valid options model parameter - @Test - public void testDeleteExpansionsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteExpansionsPath = "/v1/environments/testString/collections/testString/expansions"; - server.enqueue(new MockResponse().setResponseCode(204).setBody(mockResponseBody)); - - // Construct an instance of the DeleteExpansionsOptions model - DeleteExpansionsOptions deleteExpansionsOptionsModel = - new DeleteExpansionsOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - - // Invoke deleteExpansions() with a valid options model and verify the result - Response response = - discoveryService.deleteExpansions(deleteExpansionsOptionsModel).execute(); - assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteExpansionsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the deleteExpansions operation with and without retries enabled - @Test - public void testDeleteExpansionsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testDeleteExpansionsWOptions(); - - discoveryService.disableRetries(); - testDeleteExpansionsWOptions(); - } - - // Test the deleteExpansions operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteExpansionsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.deleteExpansions(null).execute(); - } - - // Test the getTokenizationDictionaryStatus operation with a valid options model parameter - @Test - public void testGetTokenizationDictionaryStatusWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"status\": \"active\", \"type\": \"type\"}"; - String getTokenizationDictionaryStatusPath = - "/v1/environments/testString/collections/testString/word_lists/tokenization_dictionary"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetTokenizationDictionaryStatusOptions model - GetTokenizationDictionaryStatusOptions getTokenizationDictionaryStatusOptionsModel = - new GetTokenizationDictionaryStatusOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - - // Invoke getTokenizationDictionaryStatus() with a valid options model and verify the result - Response response = - discoveryService - .getTokenizationDictionaryStatus(getTokenizationDictionaryStatusOptionsModel) - .execute(); - assertNotNull(response); - TokenDictStatusResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getTokenizationDictionaryStatusPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the getTokenizationDictionaryStatus operation with and without retries enabled - @Test - public void testGetTokenizationDictionaryStatusWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetTokenizationDictionaryStatusWOptions(); - - discoveryService.disableRetries(); - testGetTokenizationDictionaryStatusWOptions(); - } - - // Test the getTokenizationDictionaryStatus operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetTokenizationDictionaryStatusNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.getTokenizationDictionaryStatus(null).execute(); - } - - // Test the createTokenizationDictionary operation with a valid options model parameter - @Test - public void testCreateTokenizationDictionaryWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"status\": \"active\", \"type\": \"type\"}"; - String createTokenizationDictionaryPath = - "/v1/environments/testString/collections/testString/word_lists/tokenization_dictionary"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(202) - .setBody(mockResponseBody)); - - // Construct an instance of the TokenDictRule model - TokenDictRule tokenDictRuleModel = - new TokenDictRule.Builder() - .text("testString") - .tokens(java.util.Arrays.asList("testString")) - .readings(java.util.Arrays.asList("testString")) - .partOfSpeech("testString") - .build(); - - // Construct an instance of the CreateTokenizationDictionaryOptions model - CreateTokenizationDictionaryOptions createTokenizationDictionaryOptionsModel = - new CreateTokenizationDictionaryOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .tokenizationRules(java.util.Arrays.asList(tokenDictRuleModel)) - .build(); - - // Invoke createTokenizationDictionary() with a valid options model and verify the result - Response response = - discoveryService - .createTokenizationDictionary(createTokenizationDictionaryOptionsModel) - .execute(); - assertNotNull(response); - TokenDictStatusResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createTokenizationDictionaryPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the createTokenizationDictionary operation with and without retries enabled - @Test - public void testCreateTokenizationDictionaryWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testCreateTokenizationDictionaryWOptions(); - - discoveryService.disableRetries(); - testCreateTokenizationDictionaryWOptions(); - } - - // Test the createTokenizationDictionary operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateTokenizationDictionaryNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.createTokenizationDictionary(null).execute(); - } - - // Test the deleteTokenizationDictionary operation with a valid options model parameter - @Test - public void testDeleteTokenizationDictionaryWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteTokenizationDictionaryPath = - "/v1/environments/testString/collections/testString/word_lists/tokenization_dictionary"; - server.enqueue(new MockResponse().setResponseCode(200).setBody(mockResponseBody)); - - // Construct an instance of the DeleteTokenizationDictionaryOptions model - DeleteTokenizationDictionaryOptions deleteTokenizationDictionaryOptionsModel = - new DeleteTokenizationDictionaryOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - - // Invoke deleteTokenizationDictionary() with a valid options model and verify the result - Response response = - discoveryService - .deleteTokenizationDictionary(deleteTokenizationDictionaryOptionsModel) - .execute(); - assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteTokenizationDictionaryPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the deleteTokenizationDictionary operation with and without retries enabled - @Test - public void testDeleteTokenizationDictionaryWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testDeleteTokenizationDictionaryWOptions(); - - discoveryService.disableRetries(); - testDeleteTokenizationDictionaryWOptions(); - } - - // Test the deleteTokenizationDictionary operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteTokenizationDictionaryNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.deleteTokenizationDictionary(null).execute(); - } - - // Test the getStopwordListStatus operation with a valid options model parameter - @Test - public void testGetStopwordListStatusWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"status\": \"active\", \"type\": \"type\"}"; - String getStopwordListStatusPath = - "/v1/environments/testString/collections/testString/word_lists/stopwords"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetStopwordListStatusOptions model - GetStopwordListStatusOptions getStopwordListStatusOptionsModel = - new GetStopwordListStatusOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - - // Invoke getStopwordListStatus() with a valid options model and verify the result - Response response = - discoveryService.getStopwordListStatus(getStopwordListStatusOptionsModel).execute(); - assertNotNull(response); - TokenDictStatusResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getStopwordListStatusPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the getStopwordListStatus operation with and without retries enabled - @Test - public void testGetStopwordListStatusWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetStopwordListStatusWOptions(); - - discoveryService.disableRetries(); - testGetStopwordListStatusWOptions(); - } - - // Test the getStopwordListStatus operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetStopwordListStatusNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.getStopwordListStatus(null).execute(); - } - - // Test the createStopwordList operation with a valid options model parameter - @Test - public void testCreateStopwordListWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"status\": \"active\", \"type\": \"type\"}"; - String createStopwordListPath = - "/v1/environments/testString/collections/testString/word_lists/stopwords"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the CreateStopwordListOptions model - CreateStopwordListOptions createStopwordListOptionsModel = - new CreateStopwordListOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .stopwordFile(TestUtilities.createMockStream("This is a mock file.")) - .stopwordFilename("testString") - .build(); - - // Invoke createStopwordList() with a valid options model and verify the result - Response response = - discoveryService.createStopwordList(createStopwordListOptionsModel).execute(); - assertNotNull(response); - TokenDictStatusResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createStopwordListPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the createStopwordList operation with and without retries enabled - @Test - public void testCreateStopwordListWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testCreateStopwordListWOptions(); - - discoveryService.disableRetries(); - testCreateStopwordListWOptions(); - } - - // Test the createStopwordList operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateStopwordListNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.createStopwordList(null).execute(); - } - - // Test the deleteStopwordList operation with a valid options model parameter - @Test - public void testDeleteStopwordListWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteStopwordListPath = - "/v1/environments/testString/collections/testString/word_lists/stopwords"; - server.enqueue(new MockResponse().setResponseCode(200).setBody(mockResponseBody)); - - // Construct an instance of the DeleteStopwordListOptions model - DeleteStopwordListOptions deleteStopwordListOptionsModel = - new DeleteStopwordListOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - - // Invoke deleteStopwordList() with a valid options model and verify the result - Response response = - discoveryService.deleteStopwordList(deleteStopwordListOptionsModel).execute(); - assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteStopwordListPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the deleteStopwordList operation with and without retries enabled - @Test - public void testDeleteStopwordListWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testDeleteStopwordListWOptions(); - - discoveryService.disableRetries(); - testDeleteStopwordListWOptions(); - } - - // Test the deleteStopwordList operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteStopwordListNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.deleteStopwordList(null).execute(); - } - - // Test the addDocument operation with a valid options model parameter - @Test - public void testAddDocumentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"document_id\": \"documentId\", \"status\": \"processing\", \"notices\": [{\"notice_id\": \"noticeId\", \"created\": \"2019-01-01T12:00:00.000Z\", \"document_id\": \"documentId\", \"query_id\": \"queryId\", \"severity\": \"warning\", \"step\": \"step\", \"description\": \"description\"}]}"; - String addDocumentPath = "/v1/environments/testString/collections/testString/documents"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(202) - .setBody(mockResponseBody)); - - // Construct an instance of the AddDocumentOptions model - AddDocumentOptions addDocumentOptionsModel = - new AddDocumentOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .file(TestUtilities.createMockStream("This is a mock file.")) - .filename("testString") - .fileContentType("application/json") - .metadata("testString") - .build(); - - // Invoke addDocument() with a valid options model and verify the result - Response response = - discoveryService.addDocument(addDocumentOptionsModel).execute(); - assertNotNull(response); - DocumentAccepted responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, addDocumentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the addDocument operation with and without retries enabled - @Test - public void testAddDocumentWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testAddDocumentWOptions(); - - discoveryService.disableRetries(); - testAddDocumentWOptions(); - } - - // Test the addDocument operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testAddDocumentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.addDocument(null).execute(); - } - - // Test the getDocumentStatus operation with a valid options model parameter - @Test - public void testGetDocumentStatusWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"document_id\": \"documentId\", \"configuration_id\": \"configurationId\", \"status\": \"available\", \"status_description\": \"statusDescription\", \"filename\": \"filename\", \"file_type\": \"pdf\", \"sha1\": \"sha1\", \"notices\": [{\"notice_id\": \"noticeId\", \"created\": \"2019-01-01T12:00:00.000Z\", \"document_id\": \"documentId\", \"query_id\": \"queryId\", \"severity\": \"warning\", \"step\": \"step\", \"description\": \"description\"}]}"; - String getDocumentStatusPath = - "/v1/environments/testString/collections/testString/documents/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetDocumentStatusOptions model - GetDocumentStatusOptions getDocumentStatusOptionsModel = - new GetDocumentStatusOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .documentId("testString") - .build(); - - // Invoke getDocumentStatus() with a valid options model and verify the result - Response response = - discoveryService.getDocumentStatus(getDocumentStatusOptionsModel).execute(); - assertNotNull(response); - DocumentStatus responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getDocumentStatusPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the getDocumentStatus operation with and without retries enabled - @Test - public void testGetDocumentStatusWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetDocumentStatusWOptions(); - - discoveryService.disableRetries(); - testGetDocumentStatusWOptions(); - } - - // Test the getDocumentStatus operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetDocumentStatusNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.getDocumentStatus(null).execute(); - } - - // Test the updateDocument operation with a valid options model parameter - @Test - public void testUpdateDocumentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"document_id\": \"documentId\", \"status\": \"processing\", \"notices\": [{\"notice_id\": \"noticeId\", \"created\": \"2019-01-01T12:00:00.000Z\", \"document_id\": \"documentId\", \"query_id\": \"queryId\", \"severity\": \"warning\", \"step\": \"step\", \"description\": \"description\"}]}"; - String updateDocumentPath = - "/v1/environments/testString/collections/testString/documents/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(202) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateDocumentOptions model - UpdateDocumentOptions updateDocumentOptionsModel = - new UpdateDocumentOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .documentId("testString") - .file(TestUtilities.createMockStream("This is a mock file.")) - .filename("testString") - .fileContentType("application/json") - .metadata("testString") - .build(); - - // Invoke updateDocument() with a valid options model and verify the result - Response response = - discoveryService.updateDocument(updateDocumentOptionsModel).execute(); - assertNotNull(response); - DocumentAccepted responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateDocumentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the updateDocument operation with and without retries enabled - @Test - public void testUpdateDocumentWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testUpdateDocumentWOptions(); - - discoveryService.disableRetries(); - testUpdateDocumentWOptions(); - } - - // Test the updateDocument operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateDocumentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.updateDocument(null).execute(); - } - - // Test the deleteDocument operation with a valid options model parameter - @Test - public void testDeleteDocumentWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"document_id\": \"documentId\", \"status\": \"deleted\"}"; - String deleteDocumentPath = - "/v1/environments/testString/collections/testString/documents/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteDocumentOptions model - DeleteDocumentOptions deleteDocumentOptionsModel = - new DeleteDocumentOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .documentId("testString") - .build(); - - // Invoke deleteDocument() with a valid options model and verify the result - Response response = - discoveryService.deleteDocument(deleteDocumentOptionsModel).execute(); - assertNotNull(response); - DeleteDocumentResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteDocumentPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the deleteDocument operation with and without retries enabled - @Test - public void testDeleteDocumentWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testDeleteDocumentWOptions(); - - discoveryService.disableRetries(); - testDeleteDocumentWOptions(); - } - - // Test the deleteDocument operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteDocumentNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.deleteDocument(null).execute(); - } - - // Test the query operation with a valid options model parameter - @Test - public void testQueryWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"matching_results\": 15, \"results\": [{\"id\": \"id\", \"metadata\": {\"anyKey\": \"anyValue\"}, \"collection_id\": \"collectionId\", \"result_metadata\": {\"score\": 5, \"confidence\": 10}}], \"aggregations\": [{\"type\": \"filter\", \"match\": \"match\", \"matching_results\": 15}], \"passages\": [{\"document_id\": \"documentId\", \"passage_score\": 12, \"passage_text\": \"passageText\", \"start_offset\": 11, \"end_offset\": 9, \"field\": \"field\"}], \"duplicates_removed\": 17, \"session_token\": \"sessionToken\", \"retrieval_details\": {\"document_retrieval_strategy\": \"untrained\"}, \"suggested_query\": \"suggestedQuery\"}"; - String queryPath = "/v1/environments/testString/collections/testString/query"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the QueryOptions model - QueryOptions queryOptionsModel = - new QueryOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .filter("testString") - .query("testString") - .naturalLanguageQuery("testString") - .passages(true) - .aggregation("testString") - .count(Long.valueOf("10")) - .xReturn("testString") - .offset(Long.valueOf("26")) - .sort("testString") - .highlight(false) - .passagesFields("testString") - .passagesCount(Long.valueOf("10")) - .passagesCharacters(Long.valueOf("400")) - .deduplicate(false) - .deduplicateField("testString") - .similar(false) - .similarDocumentIds("testString") - .similarFields("testString") - .bias("testString") - .spellingSuggestions(false) - .xWatsonLoggingOptOut(false) - .build(); - - // Invoke query() with a valid options model and verify the result - Response response = discoveryService.query(queryOptionsModel).execute(); - assertNotNull(response); - QueryResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, queryPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the query operation with and without retries enabled - @Test - public void testQueryWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testQueryWOptions(); - - discoveryService.disableRetries(); - testQueryWOptions(); - } - - // Test the query operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testQueryNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.query(null).execute(); - } - - // Test the queryNotices operation with a valid options model parameter - @Test - public void testQueryNoticesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"matching_results\": 15, \"results\": [{\"id\": \"id\", \"metadata\": {\"anyKey\": \"anyValue\"}, \"collection_id\": \"collectionId\", \"result_metadata\": {\"score\": 5, \"confidence\": 10}, \"code\": 4, \"filename\": \"filename\", \"file_type\": \"pdf\", \"sha1\": \"sha1\", \"notices\": [{\"notice_id\": \"noticeId\", \"created\": \"2019-01-01T12:00:00.000Z\", \"document_id\": \"documentId\", \"query_id\": \"queryId\", \"severity\": \"warning\", \"step\": \"step\", \"description\": \"description\"}]}], \"aggregations\": [{\"type\": \"filter\", \"match\": \"match\", \"matching_results\": 15}], \"passages\": [{\"document_id\": \"documentId\", \"passage_score\": 12, \"passage_text\": \"passageText\", \"start_offset\": 11, \"end_offset\": 9, \"field\": \"field\"}], \"duplicates_removed\": 17}"; - String queryNoticesPath = "/v1/environments/testString/collections/testString/notices"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the QueryNoticesOptions model - QueryNoticesOptions queryNoticesOptionsModel = - new QueryNoticesOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .filter("testString") - .query("testString") - .naturalLanguageQuery("testString") - .passages(true) - .aggregation("testString") - .count(Long.valueOf("10")) - .xReturn(java.util.Arrays.asList("testString")) - .offset(Long.valueOf("26")) - .sort(java.util.Arrays.asList("testString")) - .highlight(false) - .passagesFields(java.util.Arrays.asList("testString")) - .passagesCount(Long.valueOf("10")) - .passagesCharacters(Long.valueOf("400")) - .deduplicateField("testString") - .similar(false) - .similarDocumentIds(java.util.Arrays.asList("testString")) - .similarFields(java.util.Arrays.asList("testString")) - .build(); - - // Invoke queryNotices() with a valid options model and verify the result - Response response = - discoveryService.queryNotices(queryNoticesOptionsModel).execute(); - assertNotNull(response); - QueryNoticesResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, queryNoticesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals(query.get("filter"), "testString"); - assertEquals(query.get("query"), "testString"); - assertEquals(query.get("natural_language_query"), "testString"); - assertEquals(Boolean.valueOf(query.get("passages")), Boolean.valueOf(true)); - assertEquals(query.get("aggregation"), "testString"); - assertEquals(Long.valueOf(query.get("count")), Long.valueOf("10")); - assertEquals( - query.get("return"), RequestUtils.join(java.util.Arrays.asList("testString"), ",")); - assertEquals(Long.valueOf(query.get("offset")), Long.valueOf("26")); - assertEquals(query.get("sort"), RequestUtils.join(java.util.Arrays.asList("testString"), ",")); - assertEquals(Boolean.valueOf(query.get("highlight")), Boolean.valueOf(false)); - assertEquals( - query.get("passages.fields"), - RequestUtils.join(java.util.Arrays.asList("testString"), ",")); - assertEquals(Long.valueOf(query.get("passages.count")), Long.valueOf("10")); - assertEquals(Long.valueOf(query.get("passages.characters")), Long.valueOf("400")); - assertEquals(query.get("deduplicate.field"), "testString"); - assertEquals(Boolean.valueOf(query.get("similar")), Boolean.valueOf(false)); - assertEquals( - query.get("similar.document_ids"), - RequestUtils.join(java.util.Arrays.asList("testString"), ",")); - assertEquals( - query.get("similar.fields"), RequestUtils.join(java.util.Arrays.asList("testString"), ",")); - } - - // Test the queryNotices operation with and without retries enabled - @Test - public void testQueryNoticesWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testQueryNoticesWOptions(); - - discoveryService.disableRetries(); - testQueryNoticesWOptions(); - } - - // Test the queryNotices operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testQueryNoticesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.queryNotices(null).execute(); - } - - // Test the federatedQuery operation with a valid options model parameter - @Test - public void testFederatedQueryWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"matching_results\": 15, \"results\": [{\"id\": \"id\", \"metadata\": {\"anyKey\": \"anyValue\"}, \"collection_id\": \"collectionId\", \"result_metadata\": {\"score\": 5, \"confidence\": 10}}], \"aggregations\": [{\"type\": \"filter\", \"match\": \"match\", \"matching_results\": 15}], \"passages\": [{\"document_id\": \"documentId\", \"passage_score\": 12, \"passage_text\": \"passageText\", \"start_offset\": 11, \"end_offset\": 9, \"field\": \"field\"}], \"duplicates_removed\": 17, \"session_token\": \"sessionToken\", \"retrieval_details\": {\"document_retrieval_strategy\": \"untrained\"}, \"suggested_query\": \"suggestedQuery\"}"; - String federatedQueryPath = "/v1/environments/testString/query"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the FederatedQueryOptions model - FederatedQueryOptions federatedQueryOptionsModel = - new FederatedQueryOptions.Builder() - .environmentId("testString") - .collectionIds("testString") - .filter("testString") - .query("testString") - .naturalLanguageQuery("testString") - .passages(true) - .aggregation("testString") - .count(Long.valueOf("10")) - .xReturn("testString") - .offset(Long.valueOf("26")) - .sort("testString") - .highlight(false) - .passagesFields("testString") - .passagesCount(Long.valueOf("10")) - .passagesCharacters(Long.valueOf("400")) - .deduplicate(false) - .deduplicateField("testString") - .similar(false) - .similarDocumentIds("testString") - .similarFields("testString") - .bias("testString") - .xWatsonLoggingOptOut(false) - .build(); - - // Invoke federatedQuery() with a valid options model and verify the result - Response response = - discoveryService.federatedQuery(federatedQueryOptionsModel).execute(); - assertNotNull(response); - QueryResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, federatedQueryPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the federatedQuery operation with and without retries enabled - @Test - public void testFederatedQueryWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testFederatedQueryWOptions(); - - discoveryService.disableRetries(); - testFederatedQueryWOptions(); - } - - // Test the federatedQuery operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testFederatedQueryNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.federatedQuery(null).execute(); - } - - // Test the federatedQueryNotices operation with a valid options model parameter - @Test - public void testFederatedQueryNoticesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"matching_results\": 15, \"results\": [{\"id\": \"id\", \"metadata\": {\"anyKey\": \"anyValue\"}, \"collection_id\": \"collectionId\", \"result_metadata\": {\"score\": 5, \"confidence\": 10}, \"code\": 4, \"filename\": \"filename\", \"file_type\": \"pdf\", \"sha1\": \"sha1\", \"notices\": [{\"notice_id\": \"noticeId\", \"created\": \"2019-01-01T12:00:00.000Z\", \"document_id\": \"documentId\", \"query_id\": \"queryId\", \"severity\": \"warning\", \"step\": \"step\", \"description\": \"description\"}]}], \"aggregations\": [{\"type\": \"filter\", \"match\": \"match\", \"matching_results\": 15}], \"passages\": [{\"document_id\": \"documentId\", \"passage_score\": 12, \"passage_text\": \"passageText\", \"start_offset\": 11, \"end_offset\": 9, \"field\": \"field\"}], \"duplicates_removed\": 17}"; - String federatedQueryNoticesPath = "/v1/environments/testString/notices"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the FederatedQueryNoticesOptions model - FederatedQueryNoticesOptions federatedQueryNoticesOptionsModel = - new FederatedQueryNoticesOptions.Builder() - .environmentId("testString") - .collectionIds(java.util.Arrays.asList("testString")) - .filter("testString") - .query("testString") - .naturalLanguageQuery("testString") - .aggregation("testString") - .count(Long.valueOf("10")) - .xReturn(java.util.Arrays.asList("testString")) - .offset(Long.valueOf("26")) - .sort(java.util.Arrays.asList("testString")) - .highlight(false) - .deduplicateField("testString") - .similar(false) - .similarDocumentIds(java.util.Arrays.asList("testString")) - .similarFields(java.util.Arrays.asList("testString")) - .build(); - - // Invoke federatedQueryNotices() with a valid options model and verify the result - Response response = - discoveryService.federatedQueryNotices(federatedQueryNoticesOptionsModel).execute(); - assertNotNull(response); - QueryNoticesResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, federatedQueryNoticesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals( - query.get("collection_ids"), RequestUtils.join(java.util.Arrays.asList("testString"), ",")); - assertEquals(query.get("filter"), "testString"); - assertEquals(query.get("query"), "testString"); - assertEquals(query.get("natural_language_query"), "testString"); - assertEquals(query.get("aggregation"), "testString"); - assertEquals(Long.valueOf(query.get("count")), Long.valueOf("10")); - assertEquals( - query.get("return"), RequestUtils.join(java.util.Arrays.asList("testString"), ",")); - assertEquals(Long.valueOf(query.get("offset")), Long.valueOf("26")); - assertEquals(query.get("sort"), RequestUtils.join(java.util.Arrays.asList("testString"), ",")); - assertEquals(Boolean.valueOf(query.get("highlight")), Boolean.valueOf(false)); - assertEquals(query.get("deduplicate.field"), "testString"); - assertEquals(Boolean.valueOf(query.get("similar")), Boolean.valueOf(false)); - assertEquals( - query.get("similar.document_ids"), - RequestUtils.join(java.util.Arrays.asList("testString"), ",")); - assertEquals( - query.get("similar.fields"), RequestUtils.join(java.util.Arrays.asList("testString"), ",")); - } - - // Test the federatedQueryNotices operation with and without retries enabled - @Test - public void testFederatedQueryNoticesWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testFederatedQueryNoticesWOptions(); - - discoveryService.disableRetries(); - testFederatedQueryNoticesWOptions(); - } - - // Test the federatedQueryNotices operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testFederatedQueryNoticesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.federatedQueryNotices(null).execute(); - } - - // Test the getAutocompletion operation with a valid options model parameter - @Test - public void testGetAutocompletionWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"completions\": [\"completions\"]}"; - String getAutocompletionPath = - "/v1/environments/testString/collections/testString/autocompletion"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetAutocompletionOptions model - GetAutocompletionOptions getAutocompletionOptionsModel = - new GetAutocompletionOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .prefix("testString") - .field("testString") - .count(Long.valueOf("5")) - .build(); - - // Invoke getAutocompletion() with a valid options model and verify the result - Response response = - discoveryService.getAutocompletion(getAutocompletionOptionsModel).execute(); - assertNotNull(response); - Completions responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getAutocompletionPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals(query.get("prefix"), "testString"); - assertEquals(query.get("field"), "testString"); - assertEquals(Long.valueOf(query.get("count")), Long.valueOf("5")); - } - - // Test the getAutocompletion operation with and without retries enabled - @Test - public void testGetAutocompletionWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetAutocompletionWOptions(); - - discoveryService.disableRetries(); - testGetAutocompletionWOptions(); - } - - // Test the getAutocompletion operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetAutocompletionNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.getAutocompletion(null).execute(); - } - - // Test the listTrainingData operation with a valid options model parameter - @Test - public void testListTrainingDataWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"environment_id\": \"environmentId\", \"collection_id\": \"collectionId\", \"queries\": [{\"query_id\": \"queryId\", \"natural_language_query\": \"naturalLanguageQuery\", \"filter\": \"filter\", \"examples\": [{\"document_id\": \"documentId\", \"cross_reference\": \"crossReference\", \"relevance\": 9}]}]}"; - String listTrainingDataPath = - "/v1/environments/testString/collections/testString/training_data"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListTrainingDataOptions model - ListTrainingDataOptions listTrainingDataOptionsModel = - new ListTrainingDataOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - - // Invoke listTrainingData() with a valid options model and verify the result - Response response = - discoveryService.listTrainingData(listTrainingDataOptionsModel).execute(); - assertNotNull(response); - TrainingDataSet responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listTrainingDataPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the listTrainingData operation with and without retries enabled - @Test - public void testListTrainingDataWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testListTrainingDataWOptions(); - - discoveryService.disableRetries(); - testListTrainingDataWOptions(); - } - - // Test the listTrainingData operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListTrainingDataNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.listTrainingData(null).execute(); - } - - // Test the addTrainingData operation with a valid options model parameter - @Test - public void testAddTrainingDataWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"query_id\": \"queryId\", \"natural_language_query\": \"naturalLanguageQuery\", \"filter\": \"filter\", \"examples\": [{\"document_id\": \"documentId\", \"cross_reference\": \"crossReference\", \"relevance\": 9}]}"; - String addTrainingDataPath = "/v1/environments/testString/collections/testString/training_data"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the TrainingExample model - TrainingExample trainingExampleModel = - new TrainingExample.Builder() - .documentId("testString") - .crossReference("testString") - .relevance(Long.valueOf("26")) - .build(); - - // Construct an instance of the AddTrainingDataOptions model - AddTrainingDataOptions addTrainingDataOptionsModel = - new AddTrainingDataOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .naturalLanguageQuery("testString") - .filter("testString") - .examples(java.util.Arrays.asList(trainingExampleModel)) - .build(); - - // Invoke addTrainingData() with a valid options model and verify the result - Response response = - discoveryService.addTrainingData(addTrainingDataOptionsModel).execute(); - assertNotNull(response); - TrainingQuery responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, addTrainingDataPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the addTrainingData operation with and without retries enabled - @Test - public void testAddTrainingDataWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testAddTrainingDataWOptions(); - - discoveryService.disableRetries(); - testAddTrainingDataWOptions(); - } - - // Test the addTrainingData operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testAddTrainingDataNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.addTrainingData(null).execute(); - } - - // Test the deleteAllTrainingData operation with a valid options model parameter - @Test - public void testDeleteAllTrainingDataWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteAllTrainingDataPath = - "/v1/environments/testString/collections/testString/training_data"; - server.enqueue(new MockResponse().setResponseCode(204).setBody(mockResponseBody)); - - // Construct an instance of the DeleteAllTrainingDataOptions model - DeleteAllTrainingDataOptions deleteAllTrainingDataOptionsModel = - new DeleteAllTrainingDataOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - - // Invoke deleteAllTrainingData() with a valid options model and verify the result - Response response = - discoveryService.deleteAllTrainingData(deleteAllTrainingDataOptionsModel).execute(); - assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteAllTrainingDataPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the deleteAllTrainingData operation with and without retries enabled - @Test - public void testDeleteAllTrainingDataWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testDeleteAllTrainingDataWOptions(); - - discoveryService.disableRetries(); - testDeleteAllTrainingDataWOptions(); - } - - // Test the deleteAllTrainingData operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteAllTrainingDataNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.deleteAllTrainingData(null).execute(); - } - - // Test the getTrainingData operation with a valid options model parameter - @Test - public void testGetTrainingDataWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"query_id\": \"queryId\", \"natural_language_query\": \"naturalLanguageQuery\", \"filter\": \"filter\", \"examples\": [{\"document_id\": \"documentId\", \"cross_reference\": \"crossReference\", \"relevance\": 9}]}"; - String getTrainingDataPath = - "/v1/environments/testString/collections/testString/training_data/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetTrainingDataOptions model - GetTrainingDataOptions getTrainingDataOptionsModel = - new GetTrainingDataOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .build(); - - // Invoke getTrainingData() with a valid options model and verify the result - Response response = - discoveryService.getTrainingData(getTrainingDataOptionsModel).execute(); - assertNotNull(response); - TrainingQuery responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getTrainingDataPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the getTrainingData operation with and without retries enabled - @Test - public void testGetTrainingDataWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetTrainingDataWOptions(); - - discoveryService.disableRetries(); - testGetTrainingDataWOptions(); - } - - // Test the getTrainingData operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetTrainingDataNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.getTrainingData(null).execute(); - } - - // Test the deleteTrainingData operation with a valid options model parameter - @Test - public void testDeleteTrainingDataWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteTrainingDataPath = - "/v1/environments/testString/collections/testString/training_data/testString"; - server.enqueue(new MockResponse().setResponseCode(204).setBody(mockResponseBody)); - - // Construct an instance of the DeleteTrainingDataOptions model - DeleteTrainingDataOptions deleteTrainingDataOptionsModel = - new DeleteTrainingDataOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .build(); - - // Invoke deleteTrainingData() with a valid options model and verify the result - Response response = - discoveryService.deleteTrainingData(deleteTrainingDataOptionsModel).execute(); - assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteTrainingDataPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the deleteTrainingData operation with and without retries enabled - @Test - public void testDeleteTrainingDataWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testDeleteTrainingDataWOptions(); - - discoveryService.disableRetries(); - testDeleteTrainingDataWOptions(); - } - - // Test the deleteTrainingData operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteTrainingDataNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.deleteTrainingData(null).execute(); - } - - // Test the listTrainingExamples operation with a valid options model parameter - @Test - public void testListTrainingExamplesWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"examples\": [{\"document_id\": \"documentId\", \"cross_reference\": \"crossReference\", \"relevance\": 9}]}"; - String listTrainingExamplesPath = - "/v1/environments/testString/collections/testString/training_data/testString/examples"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListTrainingExamplesOptions model - ListTrainingExamplesOptions listTrainingExamplesOptionsModel = - new ListTrainingExamplesOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .build(); - - // Invoke listTrainingExamples() with a valid options model and verify the result - Response response = - discoveryService.listTrainingExamples(listTrainingExamplesOptionsModel).execute(); - assertNotNull(response); - TrainingExampleList responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listTrainingExamplesPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the listTrainingExamples operation with and without retries enabled - @Test - public void testListTrainingExamplesWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testListTrainingExamplesWOptions(); - - discoveryService.disableRetries(); - testListTrainingExamplesWOptions(); - } - - // Test the listTrainingExamples operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListTrainingExamplesNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.listTrainingExamples(null).execute(); - } - - // Test the createTrainingExample operation with a valid options model parameter - @Test - public void testCreateTrainingExampleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"document_id\": \"documentId\", \"cross_reference\": \"crossReference\", \"relevance\": 9}"; - String createTrainingExamplePath = - "/v1/environments/testString/collections/testString/training_data/testString/examples"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the CreateTrainingExampleOptions model - CreateTrainingExampleOptions createTrainingExampleOptionsModel = - new CreateTrainingExampleOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .documentId("testString") - .crossReference("testString") - .relevance(Long.valueOf("26")) - .build(); - - // Invoke createTrainingExample() with a valid options model and verify the result - Response response = - discoveryService.createTrainingExample(createTrainingExampleOptionsModel).execute(); - assertNotNull(response); - TrainingExample responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createTrainingExamplePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the createTrainingExample operation with and without retries enabled - @Test - public void testCreateTrainingExampleWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testCreateTrainingExampleWOptions(); - - discoveryService.disableRetries(); - testCreateTrainingExampleWOptions(); - } - - // Test the createTrainingExample operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateTrainingExampleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.createTrainingExample(null).execute(); - } - - // Test the deleteTrainingExample operation with a valid options model parameter - @Test - public void testDeleteTrainingExampleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteTrainingExamplePath = - "/v1/environments/testString/collections/testString/training_data/testString/examples/testString"; - server.enqueue(new MockResponse().setResponseCode(204).setBody(mockResponseBody)); - - // Construct an instance of the DeleteTrainingExampleOptions model - DeleteTrainingExampleOptions deleteTrainingExampleOptionsModel = - new DeleteTrainingExampleOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .exampleId("testString") - .build(); - - // Invoke deleteTrainingExample() with a valid options model and verify the result - Response response = - discoveryService.deleteTrainingExample(deleteTrainingExampleOptionsModel).execute(); - assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteTrainingExamplePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the deleteTrainingExample operation with and without retries enabled - @Test - public void testDeleteTrainingExampleWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testDeleteTrainingExampleWOptions(); - - discoveryService.disableRetries(); - testDeleteTrainingExampleWOptions(); - } - - // Test the deleteTrainingExample operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteTrainingExampleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.deleteTrainingExample(null).execute(); - } - - // Test the updateTrainingExample operation with a valid options model parameter - @Test - public void testUpdateTrainingExampleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"document_id\": \"documentId\", \"cross_reference\": \"crossReference\", \"relevance\": 9}"; - String updateTrainingExamplePath = - "/v1/environments/testString/collections/testString/training_data/testString/examples/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the UpdateTrainingExampleOptions model - UpdateTrainingExampleOptions updateTrainingExampleOptionsModel = - new UpdateTrainingExampleOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .exampleId("testString") - .crossReference("testString") - .relevance(Long.valueOf("26")) - .build(); - - // Invoke updateTrainingExample() with a valid options model and verify the result - Response response = - discoveryService.updateTrainingExample(updateTrainingExampleOptionsModel).execute(); - assertNotNull(response); - TrainingExample responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateTrainingExamplePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the updateTrainingExample operation with and without retries enabled - @Test - public void testUpdateTrainingExampleWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testUpdateTrainingExampleWOptions(); - - discoveryService.disableRetries(); - testUpdateTrainingExampleWOptions(); - } - - // Test the updateTrainingExample operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateTrainingExampleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.updateTrainingExample(null).execute(); - } - - // Test the getTrainingExample operation with a valid options model parameter - @Test - public void testGetTrainingExampleWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"document_id\": \"documentId\", \"cross_reference\": \"crossReference\", \"relevance\": 9}"; - String getTrainingExamplePath = - "/v1/environments/testString/collections/testString/training_data/testString/examples/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetTrainingExampleOptions model - GetTrainingExampleOptions getTrainingExampleOptionsModel = - new GetTrainingExampleOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .exampleId("testString") - .build(); - - // Invoke getTrainingExample() with a valid options model and verify the result - Response response = - discoveryService.getTrainingExample(getTrainingExampleOptionsModel).execute(); - assertNotNull(response); - TrainingExample responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getTrainingExamplePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the getTrainingExample operation with and without retries enabled - @Test - public void testGetTrainingExampleWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetTrainingExampleWOptions(); - - discoveryService.disableRetries(); - testGetTrainingExampleWOptions(); - } - - // Test the getTrainingExample operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetTrainingExampleNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.getTrainingExample(null).execute(); - } - - // Test the deleteUserData operation with a valid options model parameter - @Test - public void testDeleteUserDataWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = ""; - String deleteUserDataPath = "/v1/user_data"; - server.enqueue(new MockResponse().setResponseCode(200).setBody(mockResponseBody)); - - // Construct an instance of the DeleteUserDataOptions model - DeleteUserDataOptions deleteUserDataOptionsModel = - new DeleteUserDataOptions.Builder().customerId("testString").build(); - - // Invoke deleteUserData() with a valid options model and verify the result - Response response = discoveryService.deleteUserData(deleteUserDataOptionsModel).execute(); - assertNotNull(response); - Void responseObj = response.getResult(); - assertNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteUserDataPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals(query.get("customer_id"), "testString"); - } - - // Test the deleteUserData operation with and without retries enabled - @Test - public void testDeleteUserDataWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testDeleteUserDataWOptions(); - - discoveryService.disableRetries(); - testDeleteUserDataWOptions(); - } - - // Test the deleteUserData operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteUserDataNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.deleteUserData(null).execute(); - } - - // Test the createEvent operation with a valid options model parameter - @Test - public void testCreateEventWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"type\": \"click\", \"data\": {\"environment_id\": \"environmentId\", \"session_token\": \"sessionToken\", \"client_timestamp\": \"2019-01-01T12:00:00.000Z\", \"display_rank\": 11, \"collection_id\": \"collectionId\", \"document_id\": \"documentId\", \"query_id\": \"queryId\"}}"; - String createEventPath = "/v1/events"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(201) - .setBody(mockResponseBody)); - - // Construct an instance of the EventData model - EventData eventDataModel = - new EventData.Builder() - .environmentId("testString") - .sessionToken("testString") - .clientTimestamp(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .displayRank(Long.valueOf("26")) - .collectionId("testString") - .documentId("testString") - .build(); - - // Construct an instance of the CreateEventOptions model - CreateEventOptions createEventOptionsModel = - new CreateEventOptions.Builder().type("click").data(eventDataModel).build(); - - // Invoke createEvent() with a valid options model and verify the result - Response response = - discoveryService.createEvent(createEventOptionsModel).execute(); - assertNotNull(response); - CreateEventResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createEventPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the createEvent operation with and without retries enabled - @Test - public void testCreateEventWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testCreateEventWOptions(); - - discoveryService.disableRetries(); - testCreateEventWOptions(); - } - - // Test the createEvent operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateEventNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.createEvent(null).execute(); - } - - // Test the queryLog operation with a valid options model parameter - @Test - public void testQueryLogWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"matching_results\": 15, \"results\": [{\"environment_id\": \"environmentId\", \"customer_id\": \"customerId\", \"document_type\": \"query\", \"natural_language_query\": \"naturalLanguageQuery\", \"document_results\": {\"results\": [{\"position\": 8, \"document_id\": \"documentId\", \"score\": 5, \"confidence\": 10, \"collection_id\": \"collectionId\"}], \"count\": 5}, \"created_timestamp\": \"2019-01-01T12:00:00.000Z\", \"client_timestamp\": \"2019-01-01T12:00:00.000Z\", \"query_id\": \"queryId\", \"session_token\": \"sessionToken\", \"collection_id\": \"collectionId\", \"display_rank\": 11, \"document_id\": \"documentId\", \"event_type\": \"click\", \"result_type\": \"document\"}]}"; - String queryLogPath = "/v1/logs"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the QueryLogOptions model - QueryLogOptions queryLogOptionsModel = - new QueryLogOptions.Builder() - .filter("testString") - .query("testString") - .count(Long.valueOf("10")) - .offset(Long.valueOf("26")) - .sort(java.util.Arrays.asList("testString")) - .build(); - - // Invoke queryLog() with a valid options model and verify the result - Response response = discoveryService.queryLog(queryLogOptionsModel).execute(); - assertNotNull(response); - LogQueryResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, queryLogPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals(query.get("filter"), "testString"); - assertEquals(query.get("query"), "testString"); - assertEquals(Long.valueOf(query.get("count")), Long.valueOf("10")); - assertEquals(Long.valueOf(query.get("offset")), Long.valueOf("26")); - assertEquals(query.get("sort"), RequestUtils.join(java.util.Arrays.asList("testString"), ",")); - } - - // Test the queryLog operation with and without retries enabled - @Test - public void testQueryLogWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testQueryLogWOptions(); - - discoveryService.disableRetries(); - testQueryLogWOptions(); - } - - // Test the getMetricsQuery operation with a valid options model parameter - @Test - public void testGetMetricsQueryWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"aggregations\": [{\"interval\": \"interval\", \"event_type\": \"eventType\", \"results\": [{\"key_as_string\": \"2019-01-01T12:00:00.000Z\", \"key\": 3, \"matching_results\": 15, \"event_rate\": 9}]}]}"; - String getMetricsQueryPath = "/v1/metrics/number_of_queries"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetMetricsQueryOptions model - GetMetricsQueryOptions getMetricsQueryOptionsModel = - new GetMetricsQueryOptions.Builder() - .startTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .endTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .resultType("document") - .build(); - - // Invoke getMetricsQuery() with a valid options model and verify the result - Response response = - discoveryService.getMetricsQuery(getMetricsQueryOptionsModel).execute(); - assertNotNull(response); - MetricResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getMetricsQueryPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals(query.get("result_type"), "document"); - } - - // Test the getMetricsQuery operation with and without retries enabled - @Test - public void testGetMetricsQueryWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetMetricsQueryWOptions(); - - discoveryService.disableRetries(); - testGetMetricsQueryWOptions(); - } - - // Test the getMetricsQueryEvent operation with a valid options model parameter - @Test - public void testGetMetricsQueryEventWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"aggregations\": [{\"interval\": \"interval\", \"event_type\": \"eventType\", \"results\": [{\"key_as_string\": \"2019-01-01T12:00:00.000Z\", \"key\": 3, \"matching_results\": 15, \"event_rate\": 9}]}]}"; - String getMetricsQueryEventPath = "/v1/metrics/number_of_queries_with_event"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetMetricsQueryEventOptions model - GetMetricsQueryEventOptions getMetricsQueryEventOptionsModel = - new GetMetricsQueryEventOptions.Builder() - .startTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .endTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .resultType("document") - .build(); - - // Invoke getMetricsQueryEvent() with a valid options model and verify the result - Response response = - discoveryService.getMetricsQueryEvent(getMetricsQueryEventOptionsModel).execute(); - assertNotNull(response); - MetricResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getMetricsQueryEventPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals(query.get("result_type"), "document"); - } - - // Test the getMetricsQueryEvent operation with and without retries enabled - @Test - public void testGetMetricsQueryEventWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetMetricsQueryEventWOptions(); - - discoveryService.disableRetries(); - testGetMetricsQueryEventWOptions(); - } - - // Test the getMetricsQueryNoResults operation with a valid options model parameter - @Test - public void testGetMetricsQueryNoResultsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"aggregations\": [{\"interval\": \"interval\", \"event_type\": \"eventType\", \"results\": [{\"key_as_string\": \"2019-01-01T12:00:00.000Z\", \"key\": 3, \"matching_results\": 15, \"event_rate\": 9}]}]}"; - String getMetricsQueryNoResultsPath = "/v1/metrics/number_of_queries_with_no_search_results"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetMetricsQueryNoResultsOptions model - GetMetricsQueryNoResultsOptions getMetricsQueryNoResultsOptionsModel = - new GetMetricsQueryNoResultsOptions.Builder() - .startTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .endTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .resultType("document") - .build(); - - // Invoke getMetricsQueryNoResults() with a valid options model and verify the result - Response response = - discoveryService.getMetricsQueryNoResults(getMetricsQueryNoResultsOptionsModel).execute(); - assertNotNull(response); - MetricResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getMetricsQueryNoResultsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals(query.get("result_type"), "document"); - } - - // Test the getMetricsQueryNoResults operation with and without retries enabled - @Test - public void testGetMetricsQueryNoResultsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetMetricsQueryNoResultsWOptions(); - - discoveryService.disableRetries(); - testGetMetricsQueryNoResultsWOptions(); - } - - // Test the getMetricsEventRate operation with a valid options model parameter - @Test - public void testGetMetricsEventRateWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"aggregations\": [{\"interval\": \"interval\", \"event_type\": \"eventType\", \"results\": [{\"key_as_string\": \"2019-01-01T12:00:00.000Z\", \"key\": 3, \"matching_results\": 15, \"event_rate\": 9}]}]}"; - String getMetricsEventRatePath = "/v1/metrics/event_rate"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetMetricsEventRateOptions model - GetMetricsEventRateOptions getMetricsEventRateOptionsModel = - new GetMetricsEventRateOptions.Builder() - .startTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .endTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .resultType("document") - .build(); - - // Invoke getMetricsEventRate() with a valid options model and verify the result - Response response = - discoveryService.getMetricsEventRate(getMetricsEventRateOptionsModel).execute(); - assertNotNull(response); - MetricResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getMetricsEventRatePath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals(query.get("result_type"), "document"); - } - - // Test the getMetricsEventRate operation with and without retries enabled - @Test - public void testGetMetricsEventRateWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetMetricsEventRateWOptions(); - - discoveryService.disableRetries(); - testGetMetricsEventRateWOptions(); - } - - // Test the getMetricsQueryTokenEvent operation with a valid options model parameter - @Test - public void testGetMetricsQueryTokenEventWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"aggregations\": [{\"event_type\": \"eventType\", \"results\": [{\"key\": \"key\", \"matching_results\": 15, \"event_rate\": 9}]}]}"; - String getMetricsQueryTokenEventPath = "/v1/metrics/top_query_tokens_with_event_rate"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetMetricsQueryTokenEventOptions model - GetMetricsQueryTokenEventOptions getMetricsQueryTokenEventOptionsModel = - new GetMetricsQueryTokenEventOptions.Builder().count(Long.valueOf("10")).build(); - - // Invoke getMetricsQueryTokenEvent() with a valid options model and verify the result - Response response = - discoveryService.getMetricsQueryTokenEvent(getMetricsQueryTokenEventOptionsModel).execute(); - assertNotNull(response); - MetricTokenResponse responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getMetricsQueryTokenEventPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - assertEquals(Long.valueOf(query.get("count")), Long.valueOf("10")); - } - - // Test the getMetricsQueryTokenEvent operation with and without retries enabled - @Test - public void testGetMetricsQueryTokenEventWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetMetricsQueryTokenEventWOptions(); - - discoveryService.disableRetries(); - testGetMetricsQueryTokenEventWOptions(); - } - - // Test the listCredentials operation with a valid options model parameter - @Test - public void testListCredentialsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"credentials\": [{\"credential_id\": \"credentialId\", \"source_type\": \"box\", \"credential_details\": {\"credential_type\": \"oauth2\", \"client_id\": \"clientId\", \"enterprise_id\": \"enterpriseId\", \"url\": \"url\", \"username\": \"username\", \"organization_url\": \"organizationUrl\", \"site_collection.path\": \"siteCollectionPath\", \"client_secret\": \"clientSecret\", \"public_key_id\": \"publicKeyId\", \"private_key\": \"privateKey\", \"passphrase\": \"passphrase\", \"password\": \"password\", \"gateway_id\": \"gatewayId\", \"source_version\": \"online\", \"web_application_url\": \"webApplicationUrl\", \"domain\": \"domain\", \"endpoint\": \"endpoint\", \"access_key_id\": \"accessKeyId\", \"secret_access_key\": \"secretAccessKey\"}, \"status\": {\"authenticated\": false, \"error_message\": \"errorMessage\"}}]}"; - String listCredentialsPath = "/v1/environments/testString/credentials"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListCredentialsOptions model - ListCredentialsOptions listCredentialsOptionsModel = - new ListCredentialsOptions.Builder().environmentId("testString").build(); - - // Invoke listCredentials() with a valid options model and verify the result - Response response = - discoveryService.listCredentials(listCredentialsOptionsModel).execute(); - assertNotNull(response); - CredentialsList responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listCredentialsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the listCredentials operation with and without retries enabled - @Test - public void testListCredentialsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testListCredentialsWOptions(); - - discoveryService.disableRetries(); - testListCredentialsWOptions(); - } - - // Test the listCredentials operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListCredentialsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.listCredentials(null).execute(); - } - - // Test the createCredentials operation with a valid options model parameter - @Test - public void testCreateCredentialsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"credential_id\": \"credentialId\", \"source_type\": \"box\", \"credential_details\": {\"credential_type\": \"oauth2\", \"client_id\": \"clientId\", \"enterprise_id\": \"enterpriseId\", \"url\": \"url\", \"username\": \"username\", \"organization_url\": \"organizationUrl\", \"site_collection.path\": \"siteCollectionPath\", \"client_secret\": \"clientSecret\", \"public_key_id\": \"publicKeyId\", \"private_key\": \"privateKey\", \"passphrase\": \"passphrase\", \"password\": \"password\", \"gateway_id\": \"gatewayId\", \"source_version\": \"online\", \"web_application_url\": \"webApplicationUrl\", \"domain\": \"domain\", \"endpoint\": \"endpoint\", \"access_key_id\": \"accessKeyId\", \"secret_access_key\": \"secretAccessKey\"}, \"status\": {\"authenticated\": false, \"error_message\": \"errorMessage\"}}"; - String createCredentialsPath = "/v1/environments/testString/credentials"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the CredentialDetails model - CredentialDetails credentialDetailsModel = - new CredentialDetails.Builder() - .credentialType("oauth2") - .clientId("testString") - .enterpriseId("testString") - .url("testString") - .username("testString") - .organizationUrl("testString") - .siteCollectionPath("testString") - .clientSecret("testString") - .publicKeyId("testString") - .privateKey("testString") - .passphrase("testString") - .password("testString") - .gatewayId("testString") - .sourceVersion("online") - .webApplicationUrl("testString") - .domain("testString") - .endpoint("testString") - .accessKeyId("testString") - .secretAccessKey("testString") - .build(); - - // Construct an instance of the StatusDetails model - StatusDetails statusDetailsModel = - new StatusDetails.Builder().authenticated(true).errorMessage("testString").build(); - - // Construct an instance of the CreateCredentialsOptions model - CreateCredentialsOptions createCredentialsOptionsModel = - new CreateCredentialsOptions.Builder() - .environmentId("testString") - .sourceType("box") - .credentialDetails(credentialDetailsModel) - .status(statusDetailsModel) - .build(); - - // Invoke createCredentials() with a valid options model and verify the result - Response response = - discoveryService.createCredentials(createCredentialsOptionsModel).execute(); - assertNotNull(response); - Credentials responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createCredentialsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the createCredentials operation with and without retries enabled - @Test - public void testCreateCredentialsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testCreateCredentialsWOptions(); - - discoveryService.disableRetries(); - testCreateCredentialsWOptions(); - } - - // Test the createCredentials operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateCredentialsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.createCredentials(null).execute(); - } - - // Test the getCredentials operation with a valid options model parameter - @Test - public void testGetCredentialsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"credential_id\": \"credentialId\", \"source_type\": \"box\", \"credential_details\": {\"credential_type\": \"oauth2\", \"client_id\": \"clientId\", \"enterprise_id\": \"enterpriseId\", \"url\": \"url\", \"username\": \"username\", \"organization_url\": \"organizationUrl\", \"site_collection.path\": \"siteCollectionPath\", \"client_secret\": \"clientSecret\", \"public_key_id\": \"publicKeyId\", \"private_key\": \"privateKey\", \"passphrase\": \"passphrase\", \"password\": \"password\", \"gateway_id\": \"gatewayId\", \"source_version\": \"online\", \"web_application_url\": \"webApplicationUrl\", \"domain\": \"domain\", \"endpoint\": \"endpoint\", \"access_key_id\": \"accessKeyId\", \"secret_access_key\": \"secretAccessKey\"}, \"status\": {\"authenticated\": false, \"error_message\": \"errorMessage\"}}"; - String getCredentialsPath = "/v1/environments/testString/credentials/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetCredentialsOptions model - GetCredentialsOptions getCredentialsOptionsModel = - new GetCredentialsOptions.Builder() - .environmentId("testString") - .credentialId("testString") - .build(); - - // Invoke getCredentials() with a valid options model and verify the result - Response response = - discoveryService.getCredentials(getCredentialsOptionsModel).execute(); - assertNotNull(response); - Credentials responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getCredentialsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the getCredentials operation with and without retries enabled - @Test - public void testGetCredentialsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetCredentialsWOptions(); - - discoveryService.disableRetries(); - testGetCredentialsWOptions(); - } - - // Test the getCredentials operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetCredentialsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.getCredentials(null).execute(); - } - - // Test the updateCredentials operation with a valid options model parameter - @Test - public void testUpdateCredentialsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"credential_id\": \"credentialId\", \"source_type\": \"box\", \"credential_details\": {\"credential_type\": \"oauth2\", \"client_id\": \"clientId\", \"enterprise_id\": \"enterpriseId\", \"url\": \"url\", \"username\": \"username\", \"organization_url\": \"organizationUrl\", \"site_collection.path\": \"siteCollectionPath\", \"client_secret\": \"clientSecret\", \"public_key_id\": \"publicKeyId\", \"private_key\": \"privateKey\", \"passphrase\": \"passphrase\", \"password\": \"password\", \"gateway_id\": \"gatewayId\", \"source_version\": \"online\", \"web_application_url\": \"webApplicationUrl\", \"domain\": \"domain\", \"endpoint\": \"endpoint\", \"access_key_id\": \"accessKeyId\", \"secret_access_key\": \"secretAccessKey\"}, \"status\": {\"authenticated\": false, \"error_message\": \"errorMessage\"}}"; - String updateCredentialsPath = "/v1/environments/testString/credentials/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the CredentialDetails model - CredentialDetails credentialDetailsModel = - new CredentialDetails.Builder() - .credentialType("oauth2") - .clientId("testString") - .enterpriseId("testString") - .url("testString") - .username("testString") - .organizationUrl("testString") - .siteCollectionPath("testString") - .clientSecret("testString") - .publicKeyId("testString") - .privateKey("testString") - .passphrase("testString") - .password("testString") - .gatewayId("testString") - .sourceVersion("online") - .webApplicationUrl("testString") - .domain("testString") - .endpoint("testString") - .accessKeyId("testString") - .secretAccessKey("testString") - .build(); - - // Construct an instance of the StatusDetails model - StatusDetails statusDetailsModel = - new StatusDetails.Builder().authenticated(true).errorMessage("testString").build(); - - // Construct an instance of the UpdateCredentialsOptions model - UpdateCredentialsOptions updateCredentialsOptionsModel = - new UpdateCredentialsOptions.Builder() - .environmentId("testString") - .credentialId("testString") - .sourceType("box") - .credentialDetails(credentialDetailsModel) - .status(statusDetailsModel) - .build(); - - // Invoke updateCredentials() with a valid options model and verify the result - Response response = - discoveryService.updateCredentials(updateCredentialsOptionsModel).execute(); - assertNotNull(response); - Credentials responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "PUT"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, updateCredentialsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the updateCredentials operation with and without retries enabled - @Test - public void testUpdateCredentialsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testUpdateCredentialsWOptions(); - - discoveryService.disableRetries(); - testUpdateCredentialsWOptions(); - } - - // Test the updateCredentials operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateCredentialsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.updateCredentials(null).execute(); - } - - // Test the deleteCredentials operation with a valid options model parameter - @Test - public void testDeleteCredentialsWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"credential_id\": \"credentialId\", \"status\": \"deleted\"}"; - String deleteCredentialsPath = "/v1/environments/testString/credentials/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteCredentialsOptions model - DeleteCredentialsOptions deleteCredentialsOptionsModel = - new DeleteCredentialsOptions.Builder() - .environmentId("testString") - .credentialId("testString") - .build(); - - // Invoke deleteCredentials() with a valid options model and verify the result - Response response = - discoveryService.deleteCredentials(deleteCredentialsOptionsModel).execute(); - assertNotNull(response); - DeleteCredentials responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteCredentialsPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the deleteCredentials operation with and without retries enabled - @Test - public void testDeleteCredentialsWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testDeleteCredentialsWOptions(); - - discoveryService.disableRetries(); - testDeleteCredentialsWOptions(); - } - - // Test the deleteCredentials operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteCredentialsNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.deleteCredentials(null).execute(); - } - - // Test the listGateways operation with a valid options model parameter - @Test - public void testListGatewaysWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"gateways\": [{\"gateway_id\": \"gatewayId\", \"name\": \"name\", \"status\": \"connected\", \"token\": \"token\", \"token_id\": \"tokenId\"}]}"; - String listGatewaysPath = "/v1/environments/testString/gateways"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the ListGatewaysOptions model - ListGatewaysOptions listGatewaysOptionsModel = - new ListGatewaysOptions.Builder().environmentId("testString").build(); - - // Invoke listGateways() with a valid options model and verify the result - Response response = - discoveryService.listGateways(listGatewaysOptionsModel).execute(); - assertNotNull(response); - GatewayList responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, listGatewaysPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the listGateways operation with and without retries enabled - @Test - public void testListGatewaysWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testListGatewaysWOptions(); - - discoveryService.disableRetries(); - testListGatewaysWOptions(); - } - - // Test the listGateways operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListGatewaysNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.listGateways(null).execute(); - } - - // Test the createGateway operation with a valid options model parameter - @Test - public void testCreateGatewayWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"gateway_id\": \"gatewayId\", \"name\": \"name\", \"status\": \"connected\", \"token\": \"token\", \"token_id\": \"tokenId\"}"; - String createGatewayPath = "/v1/environments/testString/gateways"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the CreateGatewayOptions model - CreateGatewayOptions createGatewayOptionsModel = - new CreateGatewayOptions.Builder().environmentId("testString").name("testString").build(); - - // Invoke createGateway() with a valid options model and verify the result - Response response = - discoveryService.createGateway(createGatewayOptionsModel).execute(); - assertNotNull(response); - Gateway responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "POST"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, createGatewayPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the createGateway operation with and without retries enabled - @Test - public void testCreateGatewayWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testCreateGatewayWOptions(); - - discoveryService.disableRetries(); - testCreateGatewayWOptions(); - } - - // Test the createGateway operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateGatewayNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.createGateway(null).execute(); - } - - // Test the getGateway operation with a valid options model parameter - @Test - public void testGetGatewayWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = - "{\"gateway_id\": \"gatewayId\", \"name\": \"name\", \"status\": \"connected\", \"token\": \"token\", \"token_id\": \"tokenId\"}"; - String getGatewayPath = "/v1/environments/testString/gateways/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the GetGatewayOptions model - GetGatewayOptions getGatewayOptionsModel = - new GetGatewayOptions.Builder().environmentId("testString").gatewayId("testString").build(); - - // Invoke getGateway() with a valid options model and verify the result - Response response = discoveryService.getGateway(getGatewayOptionsModel).execute(); - assertNotNull(response); - Gateway responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "GET"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, getGatewayPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the getGateway operation with and without retries enabled - @Test - public void testGetGatewayWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testGetGatewayWOptions(); - - discoveryService.disableRetries(); - testGetGatewayWOptions(); - } - - // Test the getGateway operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetGatewayNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.getGateway(null).execute(); - } - - // Test the deleteGateway operation with a valid options model parameter - @Test - public void testDeleteGatewayWOptions() throws Throwable { - // Register a mock response - String mockResponseBody = "{\"gateway_id\": \"gatewayId\", \"status\": \"status\"}"; - String deleteGatewayPath = "/v1/environments/testString/gateways/testString"; - server.enqueue( - new MockResponse() - .setHeader("Content-type", "application/json") - .setResponseCode(200) - .setBody(mockResponseBody)); - - // Construct an instance of the DeleteGatewayOptions model - DeleteGatewayOptions deleteGatewayOptionsModel = - new DeleteGatewayOptions.Builder() - .environmentId("testString") - .gatewayId("testString") - .build(); - - // Invoke deleteGateway() with a valid options model and verify the result - Response response = - discoveryService.deleteGateway(deleteGatewayOptionsModel).execute(); - assertNotNull(response); - GatewayDelete responseObj = response.getResult(); - assertNotNull(responseObj); - - // Verify the contents of the request sent to the mock server - RecordedRequest request = server.takeRequest(); - assertNotNull(request); - assertEquals(request.getMethod(), "DELETE"); - // Verify request path - String parsedPath = TestUtilities.parseReqPath(request); - assertEquals(parsedPath, deleteGatewayPath); - // Verify query params - Map query = TestUtilities.parseQueryString(request); - assertNotNull(query); - assertEquals(query.get("version"), "testString"); - } - - // Test the deleteGateway operation with and without retries enabled - @Test - public void testDeleteGatewayWRetries() throws Throwable { - discoveryService.enableRetries(4, 30); - testDeleteGatewayWOptions(); - - discoveryService.disableRetries(); - testDeleteGatewayWOptions(); - } - - // Test the deleteGateway operation with a null options model (negative test) - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteGatewayNoOptions() throws Throwable { - server.enqueue(new MockResponse()); - discoveryService.deleteGateway(null).execute(); - } - - // Perform setup needed before each test method - @BeforeMethod - public void beforeEachTest() { - // Start the mock server. - try { - server = new MockWebServer(); - server.start(); - } catch (IOException err) { - fail("Failed to instantiate mock web server"); - } - - // Construct an instance of the service - constructClientService(); - } - - // Perform tear down after each test method - @AfterMethod - public void afterEachTest() throws IOException { - server.shutdown(); - discoveryService = null; - } - - // Constructs an instance of the service to be used by the tests - public void constructClientService() { - final String serviceName = "testService"; - // set mock values for global params - String version = "testString"; - - final Authenticator authenticator = new NoAuthAuthenticator(); - discoveryService = new Discovery(version, serviceName, authenticator); - String url = server.url("/").toString(); - discoveryService.setServiceUrl(url); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/AddDocumentOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/AddDocumentOptionsTest.java deleted file mode 100644 index 88437423d46..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/AddDocumentOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.apache.commons.io.IOUtils; -import org.testng.annotations.Test; - -/** Unit test class for the AddDocumentOptions model. */ -public class AddDocumentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAddDocumentOptions() throws Throwable { - AddDocumentOptions addDocumentOptionsModel = - new AddDocumentOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .file(TestUtilities.createMockStream("This is a mock file.")) - .filename("testString") - .fileContentType("application/json") - .metadata("testString") - .build(); - assertEquals(addDocumentOptionsModel.environmentId(), "testString"); - assertEquals(addDocumentOptionsModel.collectionId(), "testString"); - assertEquals( - IOUtils.toString(addDocumentOptionsModel.file()), - IOUtils.toString(TestUtilities.createMockStream("This is a mock file."))); - assertEquals(addDocumentOptionsModel.filename(), "testString"); - assertEquals(addDocumentOptionsModel.fileContentType(), "application/json"); - assertEquals(addDocumentOptionsModel.metadata(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testAddDocumentOptionsError() throws Throwable { - new AddDocumentOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/AddTrainingDataOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/AddTrainingDataOptionsTest.java deleted file mode 100644 index 5ffd89ac503..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/AddTrainingDataOptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the AddTrainingDataOptions model. */ -public class AddTrainingDataOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAddTrainingDataOptions() throws Throwable { - TrainingExample trainingExampleModel = - new TrainingExample.Builder() - .documentId("testString") - .crossReference("testString") - .relevance(Long.valueOf("26")) - .build(); - assertEquals(trainingExampleModel.documentId(), "testString"); - assertEquals(trainingExampleModel.crossReference(), "testString"); - assertEquals(trainingExampleModel.relevance(), Long.valueOf("26")); - - AddTrainingDataOptions addTrainingDataOptionsModel = - new AddTrainingDataOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .naturalLanguageQuery("testString") - .filter("testString") - .examples(java.util.Arrays.asList(trainingExampleModel)) - .build(); - assertEquals(addTrainingDataOptionsModel.environmentId(), "testString"); - assertEquals(addTrainingDataOptionsModel.collectionId(), "testString"); - assertEquals(addTrainingDataOptionsModel.naturalLanguageQuery(), "testString"); - assertEquals(addTrainingDataOptionsModel.filter(), "testString"); - assertEquals( - addTrainingDataOptionsModel.examples(), java.util.Arrays.asList(trainingExampleModel)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testAddTrainingDataOptionsError() throws Throwable { - new AddTrainingDataOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/AggregationResultTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/AggregationResultTest.java deleted file mode 100644 index efdc950afa3..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/AggregationResultTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the AggregationResult model. */ -public class AggregationResultTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testAggregationResult() throws Throwable { - AggregationResult aggregationResultModel = new AggregationResult(); - assertNull(aggregationResultModel.getKey()); - assertNull(aggregationResultModel.getMatchingResults()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CollectionCrawlStatusTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CollectionCrawlStatusTest.java deleted file mode 100644 index ae741e6669c..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CollectionCrawlStatusTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CollectionCrawlStatus model. */ -public class CollectionCrawlStatusTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCollectionCrawlStatus() throws Throwable { - CollectionCrawlStatus collectionCrawlStatusModel = new CollectionCrawlStatus(); - assertNull(collectionCrawlStatusModel.getSourceCrawl()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CollectionDiskUsageTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CollectionDiskUsageTest.java deleted file mode 100644 index a19af35a193..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CollectionDiskUsageTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CollectionDiskUsage model. */ -public class CollectionDiskUsageTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCollectionDiskUsage() throws Throwable { - CollectionDiskUsage collectionDiskUsageModel = new CollectionDiskUsage(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CollectionTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CollectionTest.java deleted file mode 100644 index 7d36e3dc9dc..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CollectionTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the Collection model. */ -public class CollectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCollection() throws Throwable { - Collection collectionModel = new Collection(); - assertNull(collectionModel.getName()); - assertNull(collectionModel.getDescription()); - assertNull(collectionModel.getConfigurationId()); - assertNull(collectionModel.getLanguage()); - assertNull(collectionModel.getDocumentCounts()); - assertNull(collectionModel.getDiskUsage()); - assertNull(collectionModel.getTrainingStatus()); - assertNull(collectionModel.getCrawlStatus()); - assertNull(collectionModel.getSmartDocumentUnderstanding()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CollectionUsageTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CollectionUsageTest.java deleted file mode 100644 index 1e774a26a37..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CollectionUsageTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CollectionUsage model. */ -public class CollectionUsageTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCollectionUsage() throws Throwable { - CollectionUsage collectionUsageModel = new CollectionUsage(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CompletionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CompletionsTest.java deleted file mode 100644 index 99b2749bbd8..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CompletionsTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the Completions model. */ -public class CompletionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCompletions() throws Throwable { - Completions completionsModel = new Completions(); - assertNull(completionsModel.getCompletions()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ConfigurationTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ConfigurationTest.java deleted file mode 100644 index 2d424d54a39..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ConfigurationTest.java +++ /dev/null @@ -1,367 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the Configuration model. */ -public class ConfigurationTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testConfiguration() throws Throwable { - FontSetting fontSettingModel = - new FontSetting.Builder() - .level(Long.valueOf("26")) - .minSize(Long.valueOf("26")) - .maxSize(Long.valueOf("26")) - .bold(true) - .italic(true) - .name("testString") - .build(); - assertEquals(fontSettingModel.level(), Long.valueOf("26")); - assertEquals(fontSettingModel.minSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.maxSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.bold(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.italic(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.name(), "testString"); - - PdfHeadingDetection pdfHeadingDetectionModel = - new PdfHeadingDetection.Builder().fonts(java.util.Arrays.asList(fontSettingModel)).build(); - assertEquals(pdfHeadingDetectionModel.fonts(), java.util.Arrays.asList(fontSettingModel)); - - PdfSettings pdfSettingsModel = - new PdfSettings.Builder().heading(pdfHeadingDetectionModel).build(); - assertEquals(pdfSettingsModel.heading(), pdfHeadingDetectionModel); - - WordStyle wordStyleModel = - new WordStyle.Builder() - .level(Long.valueOf("26")) - .names(java.util.Arrays.asList("testString")) - .build(); - assertEquals(wordStyleModel.level(), Long.valueOf("26")); - assertEquals(wordStyleModel.names(), java.util.Arrays.asList("testString")); - - WordHeadingDetection wordHeadingDetectionModel = - new WordHeadingDetection.Builder() - .fonts(java.util.Arrays.asList(fontSettingModel)) - .styles(java.util.Arrays.asList(wordStyleModel)) - .build(); - assertEquals(wordHeadingDetectionModel.fonts(), java.util.Arrays.asList(fontSettingModel)); - assertEquals(wordHeadingDetectionModel.styles(), java.util.Arrays.asList(wordStyleModel)); - - WordSettings wordSettingsModel = - new WordSettings.Builder().heading(wordHeadingDetectionModel).build(); - assertEquals(wordSettingsModel.heading(), wordHeadingDetectionModel); - - XPathPatterns xPathPatternsModel = - new XPathPatterns.Builder().xpaths(java.util.Arrays.asList("testString")).build(); - assertEquals(xPathPatternsModel.xpaths(), java.util.Arrays.asList("testString")); - - HtmlSettings htmlSettingsModel = - new HtmlSettings.Builder() - .excludeTagsCompletely(java.util.Arrays.asList("testString")) - .excludeTagsKeepContent(java.util.Arrays.asList("span")) - .keepContent(xPathPatternsModel) - .excludeContent(xPathPatternsModel) - .keepTagAttributes(java.util.Arrays.asList("testString")) - .excludeTagAttributes(java.util.Arrays.asList("testString")) - .build(); - assertEquals(htmlSettingsModel.excludeTagsCompletely(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.excludeTagsKeepContent(), java.util.Arrays.asList("span")); - assertEquals(htmlSettingsModel.keepContent(), xPathPatternsModel); - assertEquals(htmlSettingsModel.excludeContent(), xPathPatternsModel); - assertEquals(htmlSettingsModel.keepTagAttributes(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.excludeTagAttributes(), java.util.Arrays.asList("testString")); - - SegmentSettings segmentSettingsModel = - new SegmentSettings.Builder() - .enabled(true) - .selectorTags(java.util.Arrays.asList("h1", "h2")) - .annotatedFields(java.util.Arrays.asList("custom-field-1", "custom-field-2")) - .build(); - assertEquals(segmentSettingsModel.enabled(), Boolean.valueOf(true)); - assertEquals(segmentSettingsModel.selectorTags(), java.util.Arrays.asList("h1", "h2")); - assertEquals( - segmentSettingsModel.annotatedFields(), - java.util.Arrays.asList("custom-field-1", "custom-field-2")); - - NormalizationOperation normalizationOperationModel = - new NormalizationOperation.Builder() - .operation("move") - .sourceField("extracted_metadata.title") - .destinationField("metadata.title") - .build(); - assertEquals(normalizationOperationModel.operation(), "move"); - assertEquals(normalizationOperationModel.sourceField(), "extracted_metadata.title"); - assertEquals(normalizationOperationModel.destinationField(), "metadata.title"); - - Conversions conversionsModel = - new Conversions.Builder() - .pdf(pdfSettingsModel) - .word(wordSettingsModel) - .html(htmlSettingsModel) - .segment(segmentSettingsModel) - .jsonNormalizations(java.util.Arrays.asList(normalizationOperationModel)) - .imageTextRecognition(true) - .build(); - assertEquals(conversionsModel.pdf(), pdfSettingsModel); - assertEquals(conversionsModel.word(), wordSettingsModel); - assertEquals(conversionsModel.html(), htmlSettingsModel); - assertEquals(conversionsModel.segment(), segmentSettingsModel); - assertEquals( - conversionsModel.jsonNormalizations(), - java.util.Arrays.asList(normalizationOperationModel)); - assertEquals(conversionsModel.imageTextRecognition(), Boolean.valueOf(true)); - - NluEnrichmentKeywords nluEnrichmentKeywordsModel = - new NluEnrichmentKeywords.Builder() - .sentiment(true) - .emotion(false) - .limit(Long.valueOf("50")) - .build(); - assertEquals(nluEnrichmentKeywordsModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModel.emotion(), Boolean.valueOf(false)); - assertEquals(nluEnrichmentKeywordsModel.limit(), Long.valueOf("50")); - - NluEnrichmentEntities nluEnrichmentEntitiesModel = - new NluEnrichmentEntities.Builder() - .sentiment(true) - .emotion(false) - .limit(Long.valueOf("50")) - .mentions(true) - .mentionTypes(true) - .sentenceLocations(true) - .model("WKS-model-id") - .build(); - assertEquals(nluEnrichmentEntitiesModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.emotion(), Boolean.valueOf(false)); - assertEquals(nluEnrichmentEntitiesModel.limit(), Long.valueOf("50")); - assertEquals(nluEnrichmentEntitiesModel.mentions(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.mentionTypes(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.sentenceLocations(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.model(), "WKS-model-id"); - - NluEnrichmentSentiment nluEnrichmentSentimentModel = - new NluEnrichmentSentiment.Builder() - .document(true) - .targets(java.util.Arrays.asList("IBM", "Watson")) - .build(); - assertEquals(nluEnrichmentSentimentModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSentimentModel.targets(), java.util.Arrays.asList("IBM", "Watson")); - - NluEnrichmentEmotion nluEnrichmentEmotionModel = - new NluEnrichmentEmotion.Builder() - .document(true) - .targets(java.util.Arrays.asList("IBM", "Watson")) - .build(); - assertEquals(nluEnrichmentEmotionModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEmotionModel.targets(), java.util.Arrays.asList("IBM", "Watson")); - - NluEnrichmentSemanticRoles nluEnrichmentSemanticRolesModel = - new NluEnrichmentSemanticRoles.Builder() - .entities(true) - .keywords(true) - .limit(Long.valueOf("50")) - .build(); - assertEquals(nluEnrichmentSemanticRolesModel.entities(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.keywords(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.limit(), Long.valueOf("50")); - - NluEnrichmentRelations nluEnrichmentRelationsModel = - new NluEnrichmentRelations.Builder().model("WKS-model-id").build(); - assertEquals(nluEnrichmentRelationsModel.model(), "WKS-model-id"); - - NluEnrichmentConcepts nluEnrichmentConceptsModel = - new NluEnrichmentConcepts.Builder().limit(Long.valueOf("8")).build(); - assertEquals(nluEnrichmentConceptsModel.limit(), Long.valueOf("8")); - - NluEnrichmentFeatures nluEnrichmentFeaturesModel = - new NluEnrichmentFeatures.Builder() - .keywords(nluEnrichmentKeywordsModel) - .entities(nluEnrichmentEntitiesModel) - .sentiment(nluEnrichmentSentimentModel) - .emotion(nluEnrichmentEmotionModel) - .categories(java.util.Collections.singletonMap("anyKey", "anyValue")) - .semanticRoles(nluEnrichmentSemanticRolesModel) - .relations(nluEnrichmentRelationsModel) - .concepts(nluEnrichmentConceptsModel) - .build(); - assertEquals(nluEnrichmentFeaturesModel.keywords(), nluEnrichmentKeywordsModel); - assertEquals(nluEnrichmentFeaturesModel.entities(), nluEnrichmentEntitiesModel); - assertEquals(nluEnrichmentFeaturesModel.sentiment(), nluEnrichmentSentimentModel); - assertEquals(nluEnrichmentFeaturesModel.emotion(), nluEnrichmentEmotionModel); - assertEquals( - nluEnrichmentFeaturesModel.categories(), - java.util.Collections.singletonMap("anyKey", "anyValue")); - assertEquals(nluEnrichmentFeaturesModel.semanticRoles(), nluEnrichmentSemanticRolesModel); - assertEquals(nluEnrichmentFeaturesModel.relations(), nluEnrichmentRelationsModel); - assertEquals(nluEnrichmentFeaturesModel.concepts(), nluEnrichmentConceptsModel); - - EnrichmentOptions enrichmentOptionsModel = - new EnrichmentOptions.Builder() - .features(nluEnrichmentFeaturesModel) - .language("ar") - .model("testString") - .build(); - assertEquals(enrichmentOptionsModel.features(), nluEnrichmentFeaturesModel); - assertEquals(enrichmentOptionsModel.language(), "ar"); - assertEquals(enrichmentOptionsModel.model(), "testString"); - - Enrichment enrichmentModel = - new Enrichment.Builder() - .description("testString") - .destinationField("enriched_title") - .sourceField("title") - .overwrite(false) - .enrichment("natural_language_understanding") - .ignoreDownstreamErrors(false) - .options(enrichmentOptionsModel) - .build(); - assertEquals(enrichmentModel.description(), "testString"); - assertEquals(enrichmentModel.destinationField(), "enriched_title"); - assertEquals(enrichmentModel.sourceField(), "title"); - assertEquals(enrichmentModel.overwrite(), Boolean.valueOf(false)); - assertEquals(enrichmentModel.enrichment(), "natural_language_understanding"); - assertEquals(enrichmentModel.ignoreDownstreamErrors(), Boolean.valueOf(false)); - assertEquals(enrichmentModel.options(), enrichmentOptionsModel); - - SourceSchedule sourceScheduleModel = - new SourceSchedule.Builder() - .enabled(true) - .timeZone("America/New_York") - .frequency("weekly") - .build(); - assertEquals(sourceScheduleModel.enabled(), Boolean.valueOf(true)); - assertEquals(sourceScheduleModel.timeZone(), "America/New_York"); - assertEquals(sourceScheduleModel.frequency(), "weekly"); - - SourceOptionsFolder sourceOptionsFolderModel = - new SourceOptionsFolder.Builder() - .ownerUserId("testString") - .folderId("testString") - .limit(Long.valueOf("26")) - .build(); - assertEquals(sourceOptionsFolderModel.ownerUserId(), "testString"); - assertEquals(sourceOptionsFolderModel.folderId(), "testString"); - assertEquals(sourceOptionsFolderModel.limit(), Long.valueOf("26")); - - SourceOptionsObject sourceOptionsObjectModel = - new SourceOptionsObject.Builder().name("testString").limit(Long.valueOf("26")).build(); - assertEquals(sourceOptionsObjectModel.name(), "testString"); - assertEquals(sourceOptionsObjectModel.limit(), Long.valueOf("26")); - - SourceOptionsSiteColl sourceOptionsSiteCollModel = - new SourceOptionsSiteColl.Builder() - .siteCollectionPath("/sites/TestSiteA") - .limit(Long.valueOf("10")) - .build(); - assertEquals(sourceOptionsSiteCollModel.siteCollectionPath(), "/sites/TestSiteA"); - assertEquals(sourceOptionsSiteCollModel.limit(), Long.valueOf("10")); - - SourceOptionsWebCrawl sourceOptionsWebCrawlModel = - new SourceOptionsWebCrawl.Builder() - .url("testString") - .limitToStartingHosts(true) - .crawlSpeed("normal") - .allowUntrustedCertificate(false) - .maximumHops(Long.valueOf("2")) - .requestTimeout(Long.valueOf("30000")) - .overrideRobotsTxt(false) - .blacklist(java.util.Arrays.asList("testString")) - .build(); - assertEquals(sourceOptionsWebCrawlModel.url(), "testString"); - assertEquals(sourceOptionsWebCrawlModel.limitToStartingHosts(), Boolean.valueOf(true)); - assertEquals(sourceOptionsWebCrawlModel.crawlSpeed(), "normal"); - assertEquals(sourceOptionsWebCrawlModel.allowUntrustedCertificate(), Boolean.valueOf(false)); - assertEquals(sourceOptionsWebCrawlModel.maximumHops(), Long.valueOf("2")); - assertEquals(sourceOptionsWebCrawlModel.requestTimeout(), Long.valueOf("30000")); - assertEquals(sourceOptionsWebCrawlModel.overrideRobotsTxt(), Boolean.valueOf(false)); - assertEquals(sourceOptionsWebCrawlModel.blacklist(), java.util.Arrays.asList("testString")); - - SourceOptionsBuckets sourceOptionsBucketsModel = - new SourceOptionsBuckets.Builder().name("testString").limit(Long.valueOf("26")).build(); - assertEquals(sourceOptionsBucketsModel.name(), "testString"); - assertEquals(sourceOptionsBucketsModel.limit(), Long.valueOf("26")); - - SourceOptions sourceOptionsModel = - new SourceOptions.Builder() - .folders(java.util.Arrays.asList(sourceOptionsFolderModel)) - .objects(java.util.Arrays.asList(sourceOptionsObjectModel)) - .siteCollections(java.util.Arrays.asList(sourceOptionsSiteCollModel)) - .urls(java.util.Arrays.asList(sourceOptionsWebCrawlModel)) - .buckets(java.util.Arrays.asList(sourceOptionsBucketsModel)) - .crawlAllBuckets(true) - .build(); - assertEquals(sourceOptionsModel.folders(), java.util.Arrays.asList(sourceOptionsFolderModel)); - assertEquals(sourceOptionsModel.objects(), java.util.Arrays.asList(sourceOptionsObjectModel)); - assertEquals( - sourceOptionsModel.siteCollections(), java.util.Arrays.asList(sourceOptionsSiteCollModel)); - assertEquals(sourceOptionsModel.urls(), java.util.Arrays.asList(sourceOptionsWebCrawlModel)); - assertEquals(sourceOptionsModel.buckets(), java.util.Arrays.asList(sourceOptionsBucketsModel)); - assertEquals(sourceOptionsModel.crawlAllBuckets(), Boolean.valueOf(true)); - - Source sourceModel = - new Source.Builder() - .type("salesforce") - .credentialId("00ad0000-0000-11e8-ba89-0ed5f00f718b") - .schedule(sourceScheduleModel) - .options(sourceOptionsModel) - .build(); - assertEquals(sourceModel.type(), "salesforce"); - assertEquals(sourceModel.credentialId(), "00ad0000-0000-11e8-ba89-0ed5f00f718b"); - assertEquals(sourceModel.schedule(), sourceScheduleModel); - assertEquals(sourceModel.options(), sourceOptionsModel); - - Configuration configurationModel = - new Configuration.Builder() - .name("testString") - .description("testString") - .conversions(conversionsModel) - .enrichments(java.util.Arrays.asList(enrichmentModel)) - .normalizations(java.util.Arrays.asList(normalizationOperationModel)) - .source(sourceModel) - .build(); - assertEquals(configurationModel.name(), "testString"); - assertEquals(configurationModel.description(), "testString"); - assertEquals(configurationModel.conversions(), conversionsModel); - assertEquals(configurationModel.enrichments(), java.util.Arrays.asList(enrichmentModel)); - assertEquals( - configurationModel.normalizations(), java.util.Arrays.asList(normalizationOperationModel)); - assertEquals(configurationModel.source(), sourceModel); - - String json = TestUtilities.serialize(configurationModel); - - Configuration configurationModelNew = TestUtilities.deserialize(json, Configuration.class); - assertTrue(configurationModelNew instanceof Configuration); - assertEquals(configurationModelNew.name(), "testString"); - assertEquals(configurationModelNew.description(), "testString"); - assertEquals(configurationModelNew.conversions().toString(), conversionsModel.toString()); - assertEquals(configurationModelNew.source().toString(), sourceModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testConfigurationError() throws Throwable { - new Configuration.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ConversionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ConversionsTest.java deleted file mode 100644 index ff38dbd35ab..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ConversionsTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the Conversions model. */ -public class ConversionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testConversions() throws Throwable { - FontSetting fontSettingModel = - new FontSetting.Builder() - .level(Long.valueOf("26")) - .minSize(Long.valueOf("26")) - .maxSize(Long.valueOf("26")) - .bold(true) - .italic(true) - .name("testString") - .build(); - assertEquals(fontSettingModel.level(), Long.valueOf("26")); - assertEquals(fontSettingModel.minSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.maxSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.bold(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.italic(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.name(), "testString"); - - PdfHeadingDetection pdfHeadingDetectionModel = - new PdfHeadingDetection.Builder().fonts(java.util.Arrays.asList(fontSettingModel)).build(); - assertEquals(pdfHeadingDetectionModel.fonts(), java.util.Arrays.asList(fontSettingModel)); - - PdfSettings pdfSettingsModel = - new PdfSettings.Builder().heading(pdfHeadingDetectionModel).build(); - assertEquals(pdfSettingsModel.heading(), pdfHeadingDetectionModel); - - WordStyle wordStyleModel = - new WordStyle.Builder() - .level(Long.valueOf("26")) - .names(java.util.Arrays.asList("testString")) - .build(); - assertEquals(wordStyleModel.level(), Long.valueOf("26")); - assertEquals(wordStyleModel.names(), java.util.Arrays.asList("testString")); - - WordHeadingDetection wordHeadingDetectionModel = - new WordHeadingDetection.Builder() - .fonts(java.util.Arrays.asList(fontSettingModel)) - .styles(java.util.Arrays.asList(wordStyleModel)) - .build(); - assertEquals(wordHeadingDetectionModel.fonts(), java.util.Arrays.asList(fontSettingModel)); - assertEquals(wordHeadingDetectionModel.styles(), java.util.Arrays.asList(wordStyleModel)); - - WordSettings wordSettingsModel = - new WordSettings.Builder().heading(wordHeadingDetectionModel).build(); - assertEquals(wordSettingsModel.heading(), wordHeadingDetectionModel); - - XPathPatterns xPathPatternsModel = - new XPathPatterns.Builder().xpaths(java.util.Arrays.asList("testString")).build(); - assertEquals(xPathPatternsModel.xpaths(), java.util.Arrays.asList("testString")); - - HtmlSettings htmlSettingsModel = - new HtmlSettings.Builder() - .excludeTagsCompletely(java.util.Arrays.asList("testString")) - .excludeTagsKeepContent(java.util.Arrays.asList("testString")) - .keepContent(xPathPatternsModel) - .excludeContent(xPathPatternsModel) - .keepTagAttributes(java.util.Arrays.asList("testString")) - .excludeTagAttributes(java.util.Arrays.asList("testString")) - .build(); - assertEquals(htmlSettingsModel.excludeTagsCompletely(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.excludeTagsKeepContent(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.keepContent(), xPathPatternsModel); - assertEquals(htmlSettingsModel.excludeContent(), xPathPatternsModel); - assertEquals(htmlSettingsModel.keepTagAttributes(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.excludeTagAttributes(), java.util.Arrays.asList("testString")); - - SegmentSettings segmentSettingsModel = - new SegmentSettings.Builder() - .enabled(false) - .selectorTags(java.util.Arrays.asList("h1", "h2")) - .annotatedFields(java.util.Arrays.asList("testString")) - .build(); - assertEquals(segmentSettingsModel.enabled(), Boolean.valueOf(false)); - assertEquals(segmentSettingsModel.selectorTags(), java.util.Arrays.asList("h1", "h2")); - assertEquals(segmentSettingsModel.annotatedFields(), java.util.Arrays.asList("testString")); - - NormalizationOperation normalizationOperationModel = - new NormalizationOperation.Builder() - .operation("copy") - .sourceField("testString") - .destinationField("testString") - .build(); - assertEquals(normalizationOperationModel.operation(), "copy"); - assertEquals(normalizationOperationModel.sourceField(), "testString"); - assertEquals(normalizationOperationModel.destinationField(), "testString"); - - Conversions conversionsModel = - new Conversions.Builder() - .pdf(pdfSettingsModel) - .word(wordSettingsModel) - .html(htmlSettingsModel) - .segment(segmentSettingsModel) - .jsonNormalizations(java.util.Arrays.asList(normalizationOperationModel)) - .imageTextRecognition(true) - .build(); - assertEquals(conversionsModel.pdf(), pdfSettingsModel); - assertEquals(conversionsModel.word(), wordSettingsModel); - assertEquals(conversionsModel.html(), htmlSettingsModel); - assertEquals(conversionsModel.segment(), segmentSettingsModel); - assertEquals( - conversionsModel.jsonNormalizations(), - java.util.Arrays.asList(normalizationOperationModel)); - assertEquals(conversionsModel.imageTextRecognition(), Boolean.valueOf(true)); - - String json = TestUtilities.serialize(conversionsModel); - - Conversions conversionsModelNew = TestUtilities.deserialize(json, Conversions.class); - assertTrue(conversionsModelNew instanceof Conversions); - assertEquals(conversionsModelNew.pdf().toString(), pdfSettingsModel.toString()); - assertEquals(conversionsModelNew.word().toString(), wordSettingsModel.toString()); - assertEquals(conversionsModelNew.html().toString(), htmlSettingsModel.toString()); - assertEquals(conversionsModelNew.segment().toString(), segmentSettingsModel.toString()); - assertEquals(conversionsModelNew.imageTextRecognition(), Boolean.valueOf(true)); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateCollectionOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateCollectionOptionsTest.java deleted file mode 100644 index d5a6dc30a8b..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateCollectionOptionsTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CreateCollectionOptions model. */ -public class CreateCollectionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateCollectionOptions() throws Throwable { - CreateCollectionOptions createCollectionOptionsModel = - new CreateCollectionOptions.Builder() - .environmentId("testString") - .name("testString") - .description("testString") - .configurationId("testString") - .language("en") - .build(); - assertEquals(createCollectionOptionsModel.environmentId(), "testString"); - assertEquals(createCollectionOptionsModel.name(), "testString"); - assertEquals(createCollectionOptionsModel.description(), "testString"); - assertEquals(createCollectionOptionsModel.configurationId(), "testString"); - assertEquals(createCollectionOptionsModel.language(), "en"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateCollectionOptionsError() throws Throwable { - new CreateCollectionOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateConfigurationOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateConfigurationOptionsTest.java deleted file mode 100644 index 190e6fafd3f..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateConfigurationOptionsTest.java +++ /dev/null @@ -1,360 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CreateConfigurationOptions model. */ -public class CreateConfigurationOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateConfigurationOptions() throws Throwable { - FontSetting fontSettingModel = - new FontSetting.Builder() - .level(Long.valueOf("26")) - .minSize(Long.valueOf("26")) - .maxSize(Long.valueOf("26")) - .bold(true) - .italic(true) - .name("testString") - .build(); - assertEquals(fontSettingModel.level(), Long.valueOf("26")); - assertEquals(fontSettingModel.minSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.maxSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.bold(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.italic(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.name(), "testString"); - - PdfHeadingDetection pdfHeadingDetectionModel = - new PdfHeadingDetection.Builder().fonts(java.util.Arrays.asList(fontSettingModel)).build(); - assertEquals(pdfHeadingDetectionModel.fonts(), java.util.Arrays.asList(fontSettingModel)); - - PdfSettings pdfSettingsModel = - new PdfSettings.Builder().heading(pdfHeadingDetectionModel).build(); - assertEquals(pdfSettingsModel.heading(), pdfHeadingDetectionModel); - - WordStyle wordStyleModel = - new WordStyle.Builder() - .level(Long.valueOf("26")) - .names(java.util.Arrays.asList("testString")) - .build(); - assertEquals(wordStyleModel.level(), Long.valueOf("26")); - assertEquals(wordStyleModel.names(), java.util.Arrays.asList("testString")); - - WordHeadingDetection wordHeadingDetectionModel = - new WordHeadingDetection.Builder() - .fonts(java.util.Arrays.asList(fontSettingModel)) - .styles(java.util.Arrays.asList(wordStyleModel)) - .build(); - assertEquals(wordHeadingDetectionModel.fonts(), java.util.Arrays.asList(fontSettingModel)); - assertEquals(wordHeadingDetectionModel.styles(), java.util.Arrays.asList(wordStyleModel)); - - WordSettings wordSettingsModel = - new WordSettings.Builder().heading(wordHeadingDetectionModel).build(); - assertEquals(wordSettingsModel.heading(), wordHeadingDetectionModel); - - XPathPatterns xPathPatternsModel = - new XPathPatterns.Builder().xpaths(java.util.Arrays.asList("testString")).build(); - assertEquals(xPathPatternsModel.xpaths(), java.util.Arrays.asList("testString")); - - HtmlSettings htmlSettingsModel = - new HtmlSettings.Builder() - .excludeTagsCompletely(java.util.Arrays.asList("testString")) - .excludeTagsKeepContent(java.util.Arrays.asList("testString")) - .keepContent(xPathPatternsModel) - .excludeContent(xPathPatternsModel) - .keepTagAttributes(java.util.Arrays.asList("testString")) - .excludeTagAttributes(java.util.Arrays.asList("testString")) - .build(); - assertEquals(htmlSettingsModel.excludeTagsCompletely(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.excludeTagsKeepContent(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.keepContent(), xPathPatternsModel); - assertEquals(htmlSettingsModel.excludeContent(), xPathPatternsModel); - assertEquals(htmlSettingsModel.keepTagAttributes(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.excludeTagAttributes(), java.util.Arrays.asList("testString")); - - SegmentSettings segmentSettingsModel = - new SegmentSettings.Builder() - .enabled(false) - .selectorTags(java.util.Arrays.asList("h1", "h2")) - .annotatedFields(java.util.Arrays.asList("testString")) - .build(); - assertEquals(segmentSettingsModel.enabled(), Boolean.valueOf(false)); - assertEquals(segmentSettingsModel.selectorTags(), java.util.Arrays.asList("h1", "h2")); - assertEquals(segmentSettingsModel.annotatedFields(), java.util.Arrays.asList("testString")); - - NormalizationOperation normalizationOperationModel = - new NormalizationOperation.Builder() - .operation("copy") - .sourceField("testString") - .destinationField("testString") - .build(); - assertEquals(normalizationOperationModel.operation(), "copy"); - assertEquals(normalizationOperationModel.sourceField(), "testString"); - assertEquals(normalizationOperationModel.destinationField(), "testString"); - - Conversions conversionsModel = - new Conversions.Builder() - .pdf(pdfSettingsModel) - .word(wordSettingsModel) - .html(htmlSettingsModel) - .segment(segmentSettingsModel) - .jsonNormalizations(java.util.Arrays.asList(normalizationOperationModel)) - .imageTextRecognition(true) - .build(); - assertEquals(conversionsModel.pdf(), pdfSettingsModel); - assertEquals(conversionsModel.word(), wordSettingsModel); - assertEquals(conversionsModel.html(), htmlSettingsModel); - assertEquals(conversionsModel.segment(), segmentSettingsModel); - assertEquals( - conversionsModel.jsonNormalizations(), - java.util.Arrays.asList(normalizationOperationModel)); - assertEquals(conversionsModel.imageTextRecognition(), Boolean.valueOf(true)); - - NluEnrichmentKeywords nluEnrichmentKeywordsModel = - new NluEnrichmentKeywords.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .build(); - assertEquals(nluEnrichmentKeywordsModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModel.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModel.limit(), Long.valueOf("26")); - - NluEnrichmentEntities nluEnrichmentEntitiesModel = - new NluEnrichmentEntities.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .mentions(true) - .mentionTypes(true) - .sentenceLocations(true) - .model("testString") - .build(); - assertEquals(nluEnrichmentEntitiesModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.limit(), Long.valueOf("26")); - assertEquals(nluEnrichmentEntitiesModel.mentions(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.mentionTypes(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.sentenceLocations(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.model(), "testString"); - - NluEnrichmentSentiment nluEnrichmentSentimentModel = - new NluEnrichmentSentiment.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - assertEquals(nluEnrichmentSentimentModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSentimentModel.targets(), java.util.Arrays.asList("testString")); - - NluEnrichmentEmotion nluEnrichmentEmotionModel = - new NluEnrichmentEmotion.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - assertEquals(nluEnrichmentEmotionModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEmotionModel.targets(), java.util.Arrays.asList("testString")); - - NluEnrichmentSemanticRoles nluEnrichmentSemanticRolesModel = - new NluEnrichmentSemanticRoles.Builder() - .entities(true) - .keywords(true) - .limit(Long.valueOf("26")) - .build(); - assertEquals(nluEnrichmentSemanticRolesModel.entities(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.keywords(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.limit(), Long.valueOf("26")); - - NluEnrichmentRelations nluEnrichmentRelationsModel = - new NluEnrichmentRelations.Builder().model("testString").build(); - assertEquals(nluEnrichmentRelationsModel.model(), "testString"); - - NluEnrichmentConcepts nluEnrichmentConceptsModel = - new NluEnrichmentConcepts.Builder().limit(Long.valueOf("26")).build(); - assertEquals(nluEnrichmentConceptsModel.limit(), Long.valueOf("26")); - - NluEnrichmentFeatures nluEnrichmentFeaturesModel = - new NluEnrichmentFeatures.Builder() - .keywords(nluEnrichmentKeywordsModel) - .entities(nluEnrichmentEntitiesModel) - .sentiment(nluEnrichmentSentimentModel) - .emotion(nluEnrichmentEmotionModel) - .categories(java.util.Collections.singletonMap("anyKey", "anyValue")) - .semanticRoles(nluEnrichmentSemanticRolesModel) - .relations(nluEnrichmentRelationsModel) - .concepts(nluEnrichmentConceptsModel) - .build(); - assertEquals(nluEnrichmentFeaturesModel.keywords(), nluEnrichmentKeywordsModel); - assertEquals(nluEnrichmentFeaturesModel.entities(), nluEnrichmentEntitiesModel); - assertEquals(nluEnrichmentFeaturesModel.sentiment(), nluEnrichmentSentimentModel); - assertEquals(nluEnrichmentFeaturesModel.emotion(), nluEnrichmentEmotionModel); - assertEquals( - nluEnrichmentFeaturesModel.categories(), - java.util.Collections.singletonMap("anyKey", "anyValue")); - assertEquals(nluEnrichmentFeaturesModel.semanticRoles(), nluEnrichmentSemanticRolesModel); - assertEquals(nluEnrichmentFeaturesModel.relations(), nluEnrichmentRelationsModel); - assertEquals(nluEnrichmentFeaturesModel.concepts(), nluEnrichmentConceptsModel); - - EnrichmentOptions enrichmentOptionsModel = - new EnrichmentOptions.Builder() - .features(nluEnrichmentFeaturesModel) - .language("ar") - .model("testString") - .build(); - assertEquals(enrichmentOptionsModel.features(), nluEnrichmentFeaturesModel); - assertEquals(enrichmentOptionsModel.language(), "ar"); - assertEquals(enrichmentOptionsModel.model(), "testString"); - - Enrichment enrichmentModel = - new Enrichment.Builder() - .description("testString") - .destinationField("testString") - .sourceField("testString") - .overwrite(false) - .enrichment("testString") - .ignoreDownstreamErrors(false) - .options(enrichmentOptionsModel) - .build(); - assertEquals(enrichmentModel.description(), "testString"); - assertEquals(enrichmentModel.destinationField(), "testString"); - assertEquals(enrichmentModel.sourceField(), "testString"); - assertEquals(enrichmentModel.overwrite(), Boolean.valueOf(false)); - assertEquals(enrichmentModel.enrichment(), "testString"); - assertEquals(enrichmentModel.ignoreDownstreamErrors(), Boolean.valueOf(false)); - assertEquals(enrichmentModel.options(), enrichmentOptionsModel); - - SourceSchedule sourceScheduleModel = - new SourceSchedule.Builder() - .enabled(true) - .timeZone("America/New_York") - .frequency("daily") - .build(); - assertEquals(sourceScheduleModel.enabled(), Boolean.valueOf(true)); - assertEquals(sourceScheduleModel.timeZone(), "America/New_York"); - assertEquals(sourceScheduleModel.frequency(), "daily"); - - SourceOptionsFolder sourceOptionsFolderModel = - new SourceOptionsFolder.Builder() - .ownerUserId("testString") - .folderId("testString") - .limit(Long.valueOf("26")) - .build(); - assertEquals(sourceOptionsFolderModel.ownerUserId(), "testString"); - assertEquals(sourceOptionsFolderModel.folderId(), "testString"); - assertEquals(sourceOptionsFolderModel.limit(), Long.valueOf("26")); - - SourceOptionsObject sourceOptionsObjectModel = - new SourceOptionsObject.Builder().name("testString").limit(Long.valueOf("26")).build(); - assertEquals(sourceOptionsObjectModel.name(), "testString"); - assertEquals(sourceOptionsObjectModel.limit(), Long.valueOf("26")); - - SourceOptionsSiteColl sourceOptionsSiteCollModel = - new SourceOptionsSiteColl.Builder() - .siteCollectionPath("testString") - .limit(Long.valueOf("26")) - .build(); - assertEquals(sourceOptionsSiteCollModel.siteCollectionPath(), "testString"); - assertEquals(sourceOptionsSiteCollModel.limit(), Long.valueOf("26")); - - SourceOptionsWebCrawl sourceOptionsWebCrawlModel = - new SourceOptionsWebCrawl.Builder() - .url("testString") - .limitToStartingHosts(true) - .crawlSpeed("normal") - .allowUntrustedCertificate(false) - .maximumHops(Long.valueOf("2")) - .requestTimeout(Long.valueOf("30000")) - .overrideRobotsTxt(false) - .blacklist(java.util.Arrays.asList("testString")) - .build(); - assertEquals(sourceOptionsWebCrawlModel.url(), "testString"); - assertEquals(sourceOptionsWebCrawlModel.limitToStartingHosts(), Boolean.valueOf(true)); - assertEquals(sourceOptionsWebCrawlModel.crawlSpeed(), "normal"); - assertEquals(sourceOptionsWebCrawlModel.allowUntrustedCertificate(), Boolean.valueOf(false)); - assertEquals(sourceOptionsWebCrawlModel.maximumHops(), Long.valueOf("2")); - assertEquals(sourceOptionsWebCrawlModel.requestTimeout(), Long.valueOf("30000")); - assertEquals(sourceOptionsWebCrawlModel.overrideRobotsTxt(), Boolean.valueOf(false)); - assertEquals(sourceOptionsWebCrawlModel.blacklist(), java.util.Arrays.asList("testString")); - - SourceOptionsBuckets sourceOptionsBucketsModel = - new SourceOptionsBuckets.Builder().name("testString").limit(Long.valueOf("26")).build(); - assertEquals(sourceOptionsBucketsModel.name(), "testString"); - assertEquals(sourceOptionsBucketsModel.limit(), Long.valueOf("26")); - - SourceOptions sourceOptionsModel = - new SourceOptions.Builder() - .folders(java.util.Arrays.asList(sourceOptionsFolderModel)) - .objects(java.util.Arrays.asList(sourceOptionsObjectModel)) - .siteCollections(java.util.Arrays.asList(sourceOptionsSiteCollModel)) - .urls(java.util.Arrays.asList(sourceOptionsWebCrawlModel)) - .buckets(java.util.Arrays.asList(sourceOptionsBucketsModel)) - .crawlAllBuckets(true) - .build(); - assertEquals(sourceOptionsModel.folders(), java.util.Arrays.asList(sourceOptionsFolderModel)); - assertEquals(sourceOptionsModel.objects(), java.util.Arrays.asList(sourceOptionsObjectModel)); - assertEquals( - sourceOptionsModel.siteCollections(), java.util.Arrays.asList(sourceOptionsSiteCollModel)); - assertEquals(sourceOptionsModel.urls(), java.util.Arrays.asList(sourceOptionsWebCrawlModel)); - assertEquals(sourceOptionsModel.buckets(), java.util.Arrays.asList(sourceOptionsBucketsModel)); - assertEquals(sourceOptionsModel.crawlAllBuckets(), Boolean.valueOf(true)); - - Source sourceModel = - new Source.Builder() - .type("box") - .credentialId("testString") - .schedule(sourceScheduleModel) - .options(sourceOptionsModel) - .build(); - assertEquals(sourceModel.type(), "box"); - assertEquals(sourceModel.credentialId(), "testString"); - assertEquals(sourceModel.schedule(), sourceScheduleModel); - assertEquals(sourceModel.options(), sourceOptionsModel); - - CreateConfigurationOptions createConfigurationOptionsModel = - new CreateConfigurationOptions.Builder() - .environmentId("testString") - .name("testString") - .description("testString") - .conversions(conversionsModel) - .enrichments(java.util.Arrays.asList(enrichmentModel)) - .normalizations(java.util.Arrays.asList(normalizationOperationModel)) - .source(sourceModel) - .build(); - assertEquals(createConfigurationOptionsModel.environmentId(), "testString"); - assertEquals(createConfigurationOptionsModel.name(), "testString"); - assertEquals(createConfigurationOptionsModel.description(), "testString"); - assertEquals(createConfigurationOptionsModel.conversions(), conversionsModel); - assertEquals( - createConfigurationOptionsModel.enrichments(), java.util.Arrays.asList(enrichmentModel)); - assertEquals( - createConfigurationOptionsModel.normalizations(), - java.util.Arrays.asList(normalizationOperationModel)); - assertEquals(createConfigurationOptionsModel.source(), sourceModel); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateConfigurationOptionsError() throws Throwable { - new CreateConfigurationOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptionsTest.java deleted file mode 100644 index d2a3d9ebe0f..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateCredentialsOptionsTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CreateCredentialsOptions model. */ -public class CreateCredentialsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateCredentialsOptions() throws Throwable { - CredentialDetails credentialDetailsModel = - new CredentialDetails.Builder() - .credentialType("oauth2") - .clientId("testString") - .enterpriseId("testString") - .url("testString") - .username("testString") - .organizationUrl("testString") - .siteCollectionPath("testString") - .clientSecret("testString") - .publicKeyId("testString") - .privateKey("testString") - .passphrase("testString") - .password("testString") - .gatewayId("testString") - .sourceVersion("online") - .webApplicationUrl("testString") - .domain("testString") - .endpoint("testString") - .accessKeyId("testString") - .secretAccessKey("testString") - .build(); - assertEquals(credentialDetailsModel.credentialType(), "oauth2"); - assertEquals(credentialDetailsModel.clientId(), "testString"); - assertEquals(credentialDetailsModel.enterpriseId(), "testString"); - assertEquals(credentialDetailsModel.url(), "testString"); - assertEquals(credentialDetailsModel.username(), "testString"); - assertEquals(credentialDetailsModel.organizationUrl(), "testString"); - assertEquals(credentialDetailsModel.siteCollectionPath(), "testString"); - assertEquals(credentialDetailsModel.clientSecret(), "testString"); - assertEquals(credentialDetailsModel.publicKeyId(), "testString"); - assertEquals(credentialDetailsModel.privateKey(), "testString"); - assertEquals(credentialDetailsModel.passphrase(), "testString"); - assertEquals(credentialDetailsModel.password(), "testString"); - assertEquals(credentialDetailsModel.gatewayId(), "testString"); - assertEquals(credentialDetailsModel.sourceVersion(), "online"); - assertEquals(credentialDetailsModel.webApplicationUrl(), "testString"); - assertEquals(credentialDetailsModel.domain(), "testString"); - assertEquals(credentialDetailsModel.endpoint(), "testString"); - assertEquals(credentialDetailsModel.accessKeyId(), "testString"); - assertEquals(credentialDetailsModel.secretAccessKey(), "testString"); - - StatusDetails statusDetailsModel = - new StatusDetails.Builder().authenticated(true).errorMessage("testString").build(); - assertEquals(statusDetailsModel.authenticated(), Boolean.valueOf(true)); - assertEquals(statusDetailsModel.errorMessage(), "testString"); - - CreateCredentialsOptions createCredentialsOptionsModel = - new CreateCredentialsOptions.Builder() - .environmentId("testString") - .sourceType("box") - .credentialDetails(credentialDetailsModel) - .status(statusDetailsModel) - .build(); - assertEquals(createCredentialsOptionsModel.environmentId(), "testString"); - assertEquals(createCredentialsOptionsModel.sourceType(), "box"); - assertEquals(createCredentialsOptionsModel.credentialDetails(), credentialDetailsModel); - assertEquals(createCredentialsOptionsModel.status(), statusDetailsModel); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateCredentialsOptionsError() throws Throwable { - new CreateCredentialsOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateEnvironmentOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateEnvironmentOptionsTest.java deleted file mode 100644 index 4283c9a6d4a..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateEnvironmentOptionsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CreateEnvironmentOptions model. */ -public class CreateEnvironmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateEnvironmentOptions() throws Throwable { - CreateEnvironmentOptions createEnvironmentOptionsModel = - new CreateEnvironmentOptions.Builder() - .name("testString") - .description("testString") - .size("LT") - .build(); - assertEquals(createEnvironmentOptionsModel.name(), "testString"); - assertEquals(createEnvironmentOptionsModel.description(), "testString"); - assertEquals(createEnvironmentOptionsModel.size(), "LT"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateEnvironmentOptionsError() throws Throwable { - new CreateEnvironmentOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateEventOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateEventOptionsTest.java deleted file mode 100644 index eecba4bb8ab..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateEventOptionsTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CreateEventOptions model. */ -public class CreateEventOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateEventOptions() throws Throwable { - EventData eventDataModel = - new EventData.Builder() - .environmentId("testString") - .sessionToken("testString") - .clientTimestamp(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .displayRank(Long.valueOf("26")) - .collectionId("testString") - .documentId("testString") - .build(); - assertEquals(eventDataModel.environmentId(), "testString"); - assertEquals(eventDataModel.sessionToken(), "testString"); - assertEquals( - eventDataModel.clientTimestamp(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(eventDataModel.displayRank(), Long.valueOf("26")); - assertEquals(eventDataModel.collectionId(), "testString"); - assertEquals(eventDataModel.documentId(), "testString"); - - CreateEventOptions createEventOptionsModel = - new CreateEventOptions.Builder().type("click").data(eventDataModel).build(); - assertEquals(createEventOptionsModel.type(), "click"); - assertEquals(createEventOptionsModel.data(), eventDataModel); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateEventOptionsError() throws Throwable { - new CreateEventOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateEventResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateEventResponseTest.java deleted file mode 100644 index c71eb32399e..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateEventResponseTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CreateEventResponse model. */ -public class CreateEventResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateEventResponse() throws Throwable { - CreateEventResponse createEventResponseModel = new CreateEventResponse(); - assertNull(createEventResponseModel.getType()); - assertNull(createEventResponseModel.getData()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateExpansionsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateExpansionsOptionsTest.java deleted file mode 100644 index 41ed04b1301..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateExpansionsOptionsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CreateExpansionsOptions model. */ -public class CreateExpansionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateExpansionsOptions() throws Throwable { - Expansion expansionModel = - new Expansion.Builder() - .inputTerms(java.util.Arrays.asList("testString")) - .expandedTerms(java.util.Arrays.asList("testString")) - .build(); - assertEquals(expansionModel.inputTerms(), java.util.Arrays.asList("testString")); - assertEquals(expansionModel.expandedTerms(), java.util.Arrays.asList("testString")); - - CreateExpansionsOptions createExpansionsOptionsModel = - new CreateExpansionsOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .expansions(java.util.Arrays.asList(expansionModel)) - .build(); - assertEquals(createExpansionsOptionsModel.environmentId(), "testString"); - assertEquals(createExpansionsOptionsModel.collectionId(), "testString"); - assertEquals( - createExpansionsOptionsModel.expansions(), java.util.Arrays.asList(expansionModel)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateExpansionsOptionsError() throws Throwable { - new CreateExpansionsOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateGatewayOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateGatewayOptionsTest.java deleted file mode 100644 index 9f237623fa3..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateGatewayOptionsTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CreateGatewayOptions model. */ -public class CreateGatewayOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateGatewayOptions() throws Throwable { - CreateGatewayOptions createGatewayOptionsModel = - new CreateGatewayOptions.Builder().environmentId("testString").name("testString").build(); - assertEquals(createGatewayOptionsModel.environmentId(), "testString"); - assertEquals(createGatewayOptionsModel.name(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateGatewayOptionsError() throws Throwable { - new CreateGatewayOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateStopwordListOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateStopwordListOptionsTest.java deleted file mode 100644 index cbf77840724..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateStopwordListOptionsTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.apache.commons.io.IOUtils; -import org.testng.annotations.Test; - -/** Unit test class for the CreateStopwordListOptions model. */ -public class CreateStopwordListOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateStopwordListOptions() throws Throwable { - CreateStopwordListOptions createStopwordListOptionsModel = - new CreateStopwordListOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .stopwordFile(TestUtilities.createMockStream("This is a mock file.")) - .stopwordFilename("testString") - .build(); - assertEquals(createStopwordListOptionsModel.environmentId(), "testString"); - assertEquals(createStopwordListOptionsModel.collectionId(), "testString"); - assertEquals( - IOUtils.toString(createStopwordListOptionsModel.stopwordFile()), - IOUtils.toString(TestUtilities.createMockStream("This is a mock file."))); - assertEquals(createStopwordListOptionsModel.stopwordFilename(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateStopwordListOptionsError() throws Throwable { - new CreateStopwordListOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateTokenizationDictionaryOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateTokenizationDictionaryOptionsTest.java deleted file mode 100644 index 18544e05fca..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateTokenizationDictionaryOptionsTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CreateTokenizationDictionaryOptions model. */ -public class CreateTokenizationDictionaryOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateTokenizationDictionaryOptions() throws Throwable { - TokenDictRule tokenDictRuleModel = - new TokenDictRule.Builder() - .text("testString") - .tokens(java.util.Arrays.asList("testString")) - .readings(java.util.Arrays.asList("testString")) - .partOfSpeech("testString") - .build(); - assertEquals(tokenDictRuleModel.text(), "testString"); - assertEquals(tokenDictRuleModel.tokens(), java.util.Arrays.asList("testString")); - assertEquals(tokenDictRuleModel.readings(), java.util.Arrays.asList("testString")); - assertEquals(tokenDictRuleModel.partOfSpeech(), "testString"); - - CreateTokenizationDictionaryOptions createTokenizationDictionaryOptionsModel = - new CreateTokenizationDictionaryOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .tokenizationRules(java.util.Arrays.asList(tokenDictRuleModel)) - .build(); - assertEquals(createTokenizationDictionaryOptionsModel.environmentId(), "testString"); - assertEquals(createTokenizationDictionaryOptionsModel.collectionId(), "testString"); - assertEquals( - createTokenizationDictionaryOptionsModel.tokenizationRules(), - java.util.Arrays.asList(tokenDictRuleModel)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateTokenizationDictionaryOptionsError() throws Throwable { - new CreateTokenizationDictionaryOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateTrainingExampleOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateTrainingExampleOptionsTest.java deleted file mode 100644 index e9083adcafd..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CreateTrainingExampleOptionsTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CreateTrainingExampleOptions model. */ -public class CreateTrainingExampleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCreateTrainingExampleOptions() throws Throwable { - CreateTrainingExampleOptions createTrainingExampleOptionsModel = - new CreateTrainingExampleOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .documentId("testString") - .crossReference("testString") - .relevance(Long.valueOf("26")) - .build(); - assertEquals(createTrainingExampleOptionsModel.environmentId(), "testString"); - assertEquals(createTrainingExampleOptionsModel.collectionId(), "testString"); - assertEquals(createTrainingExampleOptionsModel.queryId(), "testString"); - assertEquals(createTrainingExampleOptionsModel.documentId(), "testString"); - assertEquals(createTrainingExampleOptionsModel.crossReference(), "testString"); - assertEquals(createTrainingExampleOptionsModel.relevance(), Long.valueOf("26")); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testCreateTrainingExampleOptionsError() throws Throwable { - new CreateTrainingExampleOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CredentialDetailsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CredentialDetailsTest.java deleted file mode 100644 index 22fc188c139..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CredentialDetailsTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CredentialDetails model. */ -public class CredentialDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCredentialDetails() throws Throwable { - CredentialDetails credentialDetailsModel = - new CredentialDetails.Builder() - .credentialType("oauth2") - .clientId("testString") - .enterpriseId("testString") - .url("testString") - .username("testString") - .organizationUrl("testString") - .siteCollectionPath("testString") - .clientSecret("testString") - .publicKeyId("testString") - .privateKey("testString") - .passphrase("testString") - .password("testString") - .gatewayId("testString") - .sourceVersion("online") - .webApplicationUrl("testString") - .domain("testString") - .endpoint("testString") - .accessKeyId("testString") - .secretAccessKey("testString") - .build(); - assertEquals(credentialDetailsModel.credentialType(), "oauth2"); - assertEquals(credentialDetailsModel.clientId(), "testString"); - assertEquals(credentialDetailsModel.enterpriseId(), "testString"); - assertEquals(credentialDetailsModel.url(), "testString"); - assertEquals(credentialDetailsModel.username(), "testString"); - assertEquals(credentialDetailsModel.organizationUrl(), "testString"); - assertEquals(credentialDetailsModel.siteCollectionPath(), "testString"); - assertEquals(credentialDetailsModel.clientSecret(), "testString"); - assertEquals(credentialDetailsModel.publicKeyId(), "testString"); - assertEquals(credentialDetailsModel.privateKey(), "testString"); - assertEquals(credentialDetailsModel.passphrase(), "testString"); - assertEquals(credentialDetailsModel.password(), "testString"); - assertEquals(credentialDetailsModel.gatewayId(), "testString"); - assertEquals(credentialDetailsModel.sourceVersion(), "online"); - assertEquals(credentialDetailsModel.webApplicationUrl(), "testString"); - assertEquals(credentialDetailsModel.domain(), "testString"); - assertEquals(credentialDetailsModel.endpoint(), "testString"); - assertEquals(credentialDetailsModel.accessKeyId(), "testString"); - assertEquals(credentialDetailsModel.secretAccessKey(), "testString"); - - String json = TestUtilities.serialize(credentialDetailsModel); - - CredentialDetails credentialDetailsModelNew = - TestUtilities.deserialize(json, CredentialDetails.class); - assertTrue(credentialDetailsModelNew instanceof CredentialDetails); - assertEquals(credentialDetailsModelNew.credentialType(), "oauth2"); - assertEquals(credentialDetailsModelNew.clientId(), "testString"); - assertEquals(credentialDetailsModelNew.enterpriseId(), "testString"); - assertEquals(credentialDetailsModelNew.url(), "testString"); - assertEquals(credentialDetailsModelNew.username(), "testString"); - assertEquals(credentialDetailsModelNew.organizationUrl(), "testString"); - assertEquals(credentialDetailsModelNew.siteCollectionPath(), "testString"); - assertEquals(credentialDetailsModelNew.clientSecret(), "testString"); - assertEquals(credentialDetailsModelNew.publicKeyId(), "testString"); - assertEquals(credentialDetailsModelNew.privateKey(), "testString"); - assertEquals(credentialDetailsModelNew.passphrase(), "testString"); - assertEquals(credentialDetailsModelNew.password(), "testString"); - assertEquals(credentialDetailsModelNew.gatewayId(), "testString"); - assertEquals(credentialDetailsModelNew.sourceVersion(), "online"); - assertEquals(credentialDetailsModelNew.webApplicationUrl(), "testString"); - assertEquals(credentialDetailsModelNew.domain(), "testString"); - assertEquals(credentialDetailsModelNew.endpoint(), "testString"); - assertEquals(credentialDetailsModelNew.accessKeyId(), "testString"); - assertEquals(credentialDetailsModelNew.secretAccessKey(), "testString"); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CredentialsListTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CredentialsListTest.java deleted file mode 100644 index 454c7734f2f..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CredentialsListTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the CredentialsList model. */ -public class CredentialsListTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCredentialsList() throws Throwable { - CredentialsList credentialsListModel = new CredentialsList(); - assertNull(credentialsListModel.getCredentials()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CredentialsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CredentialsTest.java deleted file mode 100644 index bfe9f7fb603..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/CredentialsTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the Credentials model. */ -public class CredentialsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testCredentials() throws Throwable { - CredentialDetails credentialDetailsModel = - new CredentialDetails.Builder() - .credentialType("username_password") - .clientId("testString") - .enterpriseId("testString") - .url("login.salesforce.com") - .username("user@email.address") - .organizationUrl("testString") - .siteCollectionPath("testString") - .clientSecret("testString") - .publicKeyId("testString") - .privateKey("testString") - .passphrase("testString") - .password("testString") - .gatewayId("testString") - .sourceVersion("online") - .webApplicationUrl("testString") - .domain("testString") - .endpoint("testString") - .accessKeyId("testString") - .secretAccessKey("testString") - .build(); - assertEquals(credentialDetailsModel.credentialType(), "username_password"); - assertEquals(credentialDetailsModel.clientId(), "testString"); - assertEquals(credentialDetailsModel.enterpriseId(), "testString"); - assertEquals(credentialDetailsModel.url(), "login.salesforce.com"); - assertEquals(credentialDetailsModel.username(), "user@email.address"); - assertEquals(credentialDetailsModel.organizationUrl(), "testString"); - assertEquals(credentialDetailsModel.siteCollectionPath(), "testString"); - assertEquals(credentialDetailsModel.clientSecret(), "testString"); - assertEquals(credentialDetailsModel.publicKeyId(), "testString"); - assertEquals(credentialDetailsModel.privateKey(), "testString"); - assertEquals(credentialDetailsModel.passphrase(), "testString"); - assertEquals(credentialDetailsModel.password(), "testString"); - assertEquals(credentialDetailsModel.gatewayId(), "testString"); - assertEquals(credentialDetailsModel.sourceVersion(), "online"); - assertEquals(credentialDetailsModel.webApplicationUrl(), "testString"); - assertEquals(credentialDetailsModel.domain(), "testString"); - assertEquals(credentialDetailsModel.endpoint(), "testString"); - assertEquals(credentialDetailsModel.accessKeyId(), "testString"); - assertEquals(credentialDetailsModel.secretAccessKey(), "testString"); - - StatusDetails statusDetailsModel = - new StatusDetails.Builder().authenticated(true).errorMessage("testString").build(); - assertEquals(statusDetailsModel.authenticated(), Boolean.valueOf(true)); - assertEquals(statusDetailsModel.errorMessage(), "testString"); - - Credentials credentialsModel = - new Credentials.Builder() - .sourceType("box") - .credentialDetails(credentialDetailsModel) - .status(statusDetailsModel) - .build(); - assertEquals(credentialsModel.sourceType(), "box"); - assertEquals(credentialsModel.credentialDetails(), credentialDetailsModel); - assertEquals(credentialsModel.status(), statusDetailsModel); - - String json = TestUtilities.serialize(credentialsModel); - - Credentials credentialsModelNew = TestUtilities.deserialize(json, Credentials.class); - assertTrue(credentialsModelNew instanceof Credentials); - assertEquals(credentialsModelNew.sourceType(), "box"); - assertEquals( - credentialsModelNew.credentialDetails().toString(), credentialDetailsModel.toString()); - assertEquals(credentialsModelNew.status().toString(), statusDetailsModel.toString()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteAllTrainingDataOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteAllTrainingDataOptionsTest.java deleted file mode 100644 index 39e24cfd3db..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteAllTrainingDataOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteAllTrainingDataOptions model. */ -public class DeleteAllTrainingDataOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteAllTrainingDataOptions() throws Throwable { - DeleteAllTrainingDataOptions deleteAllTrainingDataOptionsModel = - new DeleteAllTrainingDataOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - assertEquals(deleteAllTrainingDataOptionsModel.environmentId(), "testString"); - assertEquals(deleteAllTrainingDataOptionsModel.collectionId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteAllTrainingDataOptionsError() throws Throwable { - new DeleteAllTrainingDataOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteCollectionOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteCollectionOptionsTest.java deleted file mode 100644 index 0cd82847ae8..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteCollectionOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteCollectionOptions model. */ -public class DeleteCollectionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteCollectionOptions() throws Throwable { - DeleteCollectionOptions deleteCollectionOptionsModel = - new DeleteCollectionOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - assertEquals(deleteCollectionOptionsModel.environmentId(), "testString"); - assertEquals(deleteCollectionOptionsModel.collectionId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteCollectionOptionsError() throws Throwable { - new DeleteCollectionOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteCollectionResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteCollectionResponseTest.java deleted file mode 100644 index eeb2269bfb1..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteCollectionResponseTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteCollectionResponse model. */ -public class DeleteCollectionResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteCollectionResponse() throws Throwable { - DeleteCollectionResponse deleteCollectionResponseModel = new DeleteCollectionResponse(); - assertNull(deleteCollectionResponseModel.getCollectionId()); - assertNull(deleteCollectionResponseModel.getStatus()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationOptionsTest.java deleted file mode 100644 index 0b1b1d146b6..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteConfigurationOptions model. */ -public class DeleteConfigurationOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteConfigurationOptions() throws Throwable { - DeleteConfigurationOptions deleteConfigurationOptionsModel = - new DeleteConfigurationOptions.Builder() - .environmentId("testString") - .configurationId("testString") - .build(); - assertEquals(deleteConfigurationOptionsModel.environmentId(), "testString"); - assertEquals(deleteConfigurationOptionsModel.configurationId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteConfigurationOptionsError() throws Throwable { - new DeleteConfigurationOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationResponseTest.java deleted file mode 100644 index b714bca5b45..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteConfigurationResponseTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteConfigurationResponse model. */ -public class DeleteConfigurationResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteConfigurationResponse() throws Throwable { - DeleteConfigurationResponse deleteConfigurationResponseModel = - new DeleteConfigurationResponse(); - assertNull(deleteConfigurationResponseModel.getConfigurationId()); - assertNull(deleteConfigurationResponseModel.getStatus()); - assertNull(deleteConfigurationResponseModel.getNotices()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteCredentialsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteCredentialsOptionsTest.java deleted file mode 100644 index 3b3a6d1c89f..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteCredentialsOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteCredentialsOptions model. */ -public class DeleteCredentialsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteCredentialsOptions() throws Throwable { - DeleteCredentialsOptions deleteCredentialsOptionsModel = - new DeleteCredentialsOptions.Builder() - .environmentId("testString") - .credentialId("testString") - .build(); - assertEquals(deleteCredentialsOptionsModel.environmentId(), "testString"); - assertEquals(deleteCredentialsOptionsModel.credentialId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteCredentialsOptionsError() throws Throwable { - new DeleteCredentialsOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteCredentialsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteCredentialsTest.java deleted file mode 100644 index 3a8742589be..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteCredentialsTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteCredentials model. */ -public class DeleteCredentialsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteCredentials() throws Throwable { - DeleteCredentials deleteCredentialsModel = new DeleteCredentials(); - assertNull(deleteCredentialsModel.getCredentialId()); - assertNull(deleteCredentialsModel.getStatus()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteDocumentOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteDocumentOptionsTest.java deleted file mode 100644 index 2e4b5e02208..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteDocumentOptionsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteDocumentOptions model. */ -public class DeleteDocumentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteDocumentOptions() throws Throwable { - DeleteDocumentOptions deleteDocumentOptionsModel = - new DeleteDocumentOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .documentId("testString") - .build(); - assertEquals(deleteDocumentOptionsModel.environmentId(), "testString"); - assertEquals(deleteDocumentOptionsModel.collectionId(), "testString"); - assertEquals(deleteDocumentOptionsModel.documentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteDocumentOptionsError() throws Throwable { - new DeleteDocumentOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteDocumentResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteDocumentResponseTest.java deleted file mode 100644 index 0845324279c..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteDocumentResponseTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteDocumentResponse model. */ -public class DeleteDocumentResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteDocumentResponse() throws Throwable { - DeleteDocumentResponse deleteDocumentResponseModel = new DeleteDocumentResponse(); - assertNull(deleteDocumentResponseModel.getDocumentId()); - assertNull(deleteDocumentResponseModel.getStatus()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentOptionsTest.java deleted file mode 100644 index eb8c5784d9f..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentOptionsTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteEnvironmentOptions model. */ -public class DeleteEnvironmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteEnvironmentOptions() throws Throwable { - DeleteEnvironmentOptions deleteEnvironmentOptionsModel = - new DeleteEnvironmentOptions.Builder().environmentId("testString").build(); - assertEquals(deleteEnvironmentOptionsModel.environmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteEnvironmentOptionsError() throws Throwable { - new DeleteEnvironmentOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentResponseTest.java deleted file mode 100644 index 05f7324d4b4..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteEnvironmentResponseTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteEnvironmentResponse model. */ -public class DeleteEnvironmentResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteEnvironmentResponse() throws Throwable { - DeleteEnvironmentResponse deleteEnvironmentResponseModel = new DeleteEnvironmentResponse(); - assertNull(deleteEnvironmentResponseModel.getEnvironmentId()); - assertNull(deleteEnvironmentResponseModel.getStatus()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteExpansionsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteExpansionsOptionsTest.java deleted file mode 100644 index db2475920ed..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteExpansionsOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteExpansionsOptions model. */ -public class DeleteExpansionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteExpansionsOptions() throws Throwable { - DeleteExpansionsOptions deleteExpansionsOptionsModel = - new DeleteExpansionsOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - assertEquals(deleteExpansionsOptionsModel.environmentId(), "testString"); - assertEquals(deleteExpansionsOptionsModel.collectionId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteExpansionsOptionsError() throws Throwable { - new DeleteExpansionsOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteGatewayOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteGatewayOptionsTest.java deleted file mode 100644 index dc9bba850d4..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteGatewayOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteGatewayOptions model. */ -public class DeleteGatewayOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteGatewayOptions() throws Throwable { - DeleteGatewayOptions deleteGatewayOptionsModel = - new DeleteGatewayOptions.Builder() - .environmentId("testString") - .gatewayId("testString") - .build(); - assertEquals(deleteGatewayOptionsModel.environmentId(), "testString"); - assertEquals(deleteGatewayOptionsModel.gatewayId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteGatewayOptionsError() throws Throwable { - new DeleteGatewayOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteStopwordListOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteStopwordListOptionsTest.java deleted file mode 100644 index aa5cfce9608..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteStopwordListOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteStopwordListOptions model. */ -public class DeleteStopwordListOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteStopwordListOptions() throws Throwable { - DeleteStopwordListOptions deleteStopwordListOptionsModel = - new DeleteStopwordListOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - assertEquals(deleteStopwordListOptionsModel.environmentId(), "testString"); - assertEquals(deleteStopwordListOptionsModel.collectionId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteStopwordListOptionsError() throws Throwable { - new DeleteStopwordListOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteTokenizationDictionaryOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteTokenizationDictionaryOptionsTest.java deleted file mode 100644 index fdead2c11fc..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteTokenizationDictionaryOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteTokenizationDictionaryOptions model. */ -public class DeleteTokenizationDictionaryOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteTokenizationDictionaryOptions() throws Throwable { - DeleteTokenizationDictionaryOptions deleteTokenizationDictionaryOptionsModel = - new DeleteTokenizationDictionaryOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - assertEquals(deleteTokenizationDictionaryOptionsModel.environmentId(), "testString"); - assertEquals(deleteTokenizationDictionaryOptionsModel.collectionId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteTokenizationDictionaryOptionsError() throws Throwable { - new DeleteTokenizationDictionaryOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteTrainingDataOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteTrainingDataOptionsTest.java deleted file mode 100644 index 41345051a17..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteTrainingDataOptionsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteTrainingDataOptions model. */ -public class DeleteTrainingDataOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteTrainingDataOptions() throws Throwable { - DeleteTrainingDataOptions deleteTrainingDataOptionsModel = - new DeleteTrainingDataOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .build(); - assertEquals(deleteTrainingDataOptionsModel.environmentId(), "testString"); - assertEquals(deleteTrainingDataOptionsModel.collectionId(), "testString"); - assertEquals(deleteTrainingDataOptionsModel.queryId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteTrainingDataOptionsError() throws Throwable { - new DeleteTrainingDataOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteTrainingExampleOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteTrainingExampleOptionsTest.java deleted file mode 100644 index a9221301a57..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteTrainingExampleOptionsTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteTrainingExampleOptions model. */ -public class DeleteTrainingExampleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteTrainingExampleOptions() throws Throwable { - DeleteTrainingExampleOptions deleteTrainingExampleOptionsModel = - new DeleteTrainingExampleOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .exampleId("testString") - .build(); - assertEquals(deleteTrainingExampleOptionsModel.environmentId(), "testString"); - assertEquals(deleteTrainingExampleOptionsModel.collectionId(), "testString"); - assertEquals(deleteTrainingExampleOptionsModel.queryId(), "testString"); - assertEquals(deleteTrainingExampleOptionsModel.exampleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteTrainingExampleOptionsError() throws Throwable { - new DeleteTrainingExampleOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteUserDataOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteUserDataOptionsTest.java deleted file mode 100644 index 491fa5f484e..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DeleteUserDataOptionsTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DeleteUserDataOptions model. */ -public class DeleteUserDataOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDeleteUserDataOptions() throws Throwable { - DeleteUserDataOptions deleteUserDataOptionsModel = - new DeleteUserDataOptions.Builder().customerId("testString").build(); - assertEquals(deleteUserDataOptionsModel.customerId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testDeleteUserDataOptionsError() throws Throwable { - new DeleteUserDataOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DiskUsageTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DiskUsageTest.java deleted file mode 100644 index 8e4a65aa2c3..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DiskUsageTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DiskUsage model. */ -public class DiskUsageTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDiskUsage() throws Throwable { - DiskUsage diskUsageModel = new DiskUsage(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DocumentAcceptedTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DocumentAcceptedTest.java deleted file mode 100644 index bb9399e28f5..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DocumentAcceptedTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DocumentAccepted model. */ -public class DocumentAcceptedTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDocumentAccepted() throws Throwable { - DocumentAccepted documentAcceptedModel = new DocumentAccepted(); - assertNull(documentAcceptedModel.getDocumentId()); - assertNull(documentAcceptedModel.getStatus()); - assertNull(documentAcceptedModel.getNotices()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DocumentCountsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DocumentCountsTest.java deleted file mode 100644 index 605524516ad..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DocumentCountsTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DocumentCounts model. */ -public class DocumentCountsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDocumentCounts() throws Throwable { - DocumentCounts documentCountsModel = new DocumentCounts(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DocumentStatusTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DocumentStatusTest.java deleted file mode 100644 index 21009a2fe15..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/DocumentStatusTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the DocumentStatus model. */ -public class DocumentStatusTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testDocumentStatus() throws Throwable { - DocumentStatus documentStatusModel = new DocumentStatus(); - assertNull(documentStatusModel.getFilename()); - assertNull(documentStatusModel.getFileType()); - assertNull(documentStatusModel.getSha1()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EnrichmentOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EnrichmentOptionsTest.java deleted file mode 100644 index e1047e1e05d..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EnrichmentOptionsTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the EnrichmentOptions model. */ -public class EnrichmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testEnrichmentOptions() throws Throwable { - NluEnrichmentKeywords nluEnrichmentKeywordsModel = - new NluEnrichmentKeywords.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .build(); - assertEquals(nluEnrichmentKeywordsModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModel.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModel.limit(), Long.valueOf("26")); - - NluEnrichmentEntities nluEnrichmentEntitiesModel = - new NluEnrichmentEntities.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .mentions(true) - .mentionTypes(true) - .sentenceLocations(true) - .model("testString") - .build(); - assertEquals(nluEnrichmentEntitiesModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.limit(), Long.valueOf("26")); - assertEquals(nluEnrichmentEntitiesModel.mentions(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.mentionTypes(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.sentenceLocations(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.model(), "testString"); - - NluEnrichmentSentiment nluEnrichmentSentimentModel = - new NluEnrichmentSentiment.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - assertEquals(nluEnrichmentSentimentModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSentimentModel.targets(), java.util.Arrays.asList("testString")); - - NluEnrichmentEmotion nluEnrichmentEmotionModel = - new NluEnrichmentEmotion.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - assertEquals(nluEnrichmentEmotionModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEmotionModel.targets(), java.util.Arrays.asList("testString")); - - NluEnrichmentSemanticRoles nluEnrichmentSemanticRolesModel = - new NluEnrichmentSemanticRoles.Builder() - .entities(true) - .keywords(true) - .limit(Long.valueOf("26")) - .build(); - assertEquals(nluEnrichmentSemanticRolesModel.entities(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.keywords(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.limit(), Long.valueOf("26")); - - NluEnrichmentRelations nluEnrichmentRelationsModel = - new NluEnrichmentRelations.Builder().model("testString").build(); - assertEquals(nluEnrichmentRelationsModel.model(), "testString"); - - NluEnrichmentConcepts nluEnrichmentConceptsModel = - new NluEnrichmentConcepts.Builder().limit(Long.valueOf("26")).build(); - assertEquals(nluEnrichmentConceptsModel.limit(), Long.valueOf("26")); - - NluEnrichmentFeatures nluEnrichmentFeaturesModel = - new NluEnrichmentFeatures.Builder() - .keywords(nluEnrichmentKeywordsModel) - .entities(nluEnrichmentEntitiesModel) - .sentiment(nluEnrichmentSentimentModel) - .emotion(nluEnrichmentEmotionModel) - .categories(java.util.Collections.singletonMap("anyKey", "anyValue")) - .semanticRoles(nluEnrichmentSemanticRolesModel) - .relations(nluEnrichmentRelationsModel) - .concepts(nluEnrichmentConceptsModel) - .build(); - assertEquals(nluEnrichmentFeaturesModel.keywords(), nluEnrichmentKeywordsModel); - assertEquals(nluEnrichmentFeaturesModel.entities(), nluEnrichmentEntitiesModel); - assertEquals(nluEnrichmentFeaturesModel.sentiment(), nluEnrichmentSentimentModel); - assertEquals(nluEnrichmentFeaturesModel.emotion(), nluEnrichmentEmotionModel); - assertEquals( - nluEnrichmentFeaturesModel.categories(), - java.util.Collections.singletonMap("anyKey", "anyValue")); - assertEquals(nluEnrichmentFeaturesModel.semanticRoles(), nluEnrichmentSemanticRolesModel); - assertEquals(nluEnrichmentFeaturesModel.relations(), nluEnrichmentRelationsModel); - assertEquals(nluEnrichmentFeaturesModel.concepts(), nluEnrichmentConceptsModel); - - EnrichmentOptions enrichmentOptionsModel = - new EnrichmentOptions.Builder() - .features(nluEnrichmentFeaturesModel) - .language("ar") - .model("testString") - .build(); - assertEquals(enrichmentOptionsModel.features(), nluEnrichmentFeaturesModel); - assertEquals(enrichmentOptionsModel.language(), "ar"); - assertEquals(enrichmentOptionsModel.model(), "testString"); - - String json = TestUtilities.serialize(enrichmentOptionsModel); - - EnrichmentOptions enrichmentOptionsModelNew = - TestUtilities.deserialize(json, EnrichmentOptions.class); - assertTrue(enrichmentOptionsModelNew instanceof EnrichmentOptions); - assertEquals( - enrichmentOptionsModelNew.features().toString(), nluEnrichmentFeaturesModel.toString()); - assertEquals(enrichmentOptionsModelNew.language(), "ar"); - assertEquals(enrichmentOptionsModelNew.model(), "testString"); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EnrichmentTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EnrichmentTest.java deleted file mode 100644 index 7ade966ef93..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EnrichmentTest.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the Enrichment model. */ -public class EnrichmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testEnrichment() throws Throwable { - NluEnrichmentKeywords nluEnrichmentKeywordsModel = - new NluEnrichmentKeywords.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .build(); - assertEquals(nluEnrichmentKeywordsModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModel.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModel.limit(), Long.valueOf("26")); - - NluEnrichmentEntities nluEnrichmentEntitiesModel = - new NluEnrichmentEntities.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .mentions(true) - .mentionTypes(true) - .sentenceLocations(true) - .model("testString") - .build(); - assertEquals(nluEnrichmentEntitiesModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.limit(), Long.valueOf("26")); - assertEquals(nluEnrichmentEntitiesModel.mentions(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.mentionTypes(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.sentenceLocations(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.model(), "testString"); - - NluEnrichmentSentiment nluEnrichmentSentimentModel = - new NluEnrichmentSentiment.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - assertEquals(nluEnrichmentSentimentModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSentimentModel.targets(), java.util.Arrays.asList("testString")); - - NluEnrichmentEmotion nluEnrichmentEmotionModel = - new NluEnrichmentEmotion.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - assertEquals(nluEnrichmentEmotionModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEmotionModel.targets(), java.util.Arrays.asList("testString")); - - NluEnrichmentSemanticRoles nluEnrichmentSemanticRolesModel = - new NluEnrichmentSemanticRoles.Builder() - .entities(true) - .keywords(true) - .limit(Long.valueOf("26")) - .build(); - assertEquals(nluEnrichmentSemanticRolesModel.entities(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.keywords(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.limit(), Long.valueOf("26")); - - NluEnrichmentRelations nluEnrichmentRelationsModel = - new NluEnrichmentRelations.Builder().model("testString").build(); - assertEquals(nluEnrichmentRelationsModel.model(), "testString"); - - NluEnrichmentConcepts nluEnrichmentConceptsModel = - new NluEnrichmentConcepts.Builder().limit(Long.valueOf("26")).build(); - assertEquals(nluEnrichmentConceptsModel.limit(), Long.valueOf("26")); - - NluEnrichmentFeatures nluEnrichmentFeaturesModel = - new NluEnrichmentFeatures.Builder() - .keywords(nluEnrichmentKeywordsModel) - .entities(nluEnrichmentEntitiesModel) - .sentiment(nluEnrichmentSentimentModel) - .emotion(nluEnrichmentEmotionModel) - .categories(java.util.Collections.singletonMap("anyKey", "anyValue")) - .semanticRoles(nluEnrichmentSemanticRolesModel) - .relations(nluEnrichmentRelationsModel) - .concepts(nluEnrichmentConceptsModel) - .build(); - assertEquals(nluEnrichmentFeaturesModel.keywords(), nluEnrichmentKeywordsModel); - assertEquals(nluEnrichmentFeaturesModel.entities(), nluEnrichmentEntitiesModel); - assertEquals(nluEnrichmentFeaturesModel.sentiment(), nluEnrichmentSentimentModel); - assertEquals(nluEnrichmentFeaturesModel.emotion(), nluEnrichmentEmotionModel); - assertEquals( - nluEnrichmentFeaturesModel.categories(), - java.util.Collections.singletonMap("anyKey", "anyValue")); - assertEquals(nluEnrichmentFeaturesModel.semanticRoles(), nluEnrichmentSemanticRolesModel); - assertEquals(nluEnrichmentFeaturesModel.relations(), nluEnrichmentRelationsModel); - assertEquals(nluEnrichmentFeaturesModel.concepts(), nluEnrichmentConceptsModel); - - EnrichmentOptions enrichmentOptionsModel = - new EnrichmentOptions.Builder() - .features(nluEnrichmentFeaturesModel) - .language("ar") - .model("testString") - .build(); - assertEquals(enrichmentOptionsModel.features(), nluEnrichmentFeaturesModel); - assertEquals(enrichmentOptionsModel.language(), "ar"); - assertEquals(enrichmentOptionsModel.model(), "testString"); - - Enrichment enrichmentModel = - new Enrichment.Builder() - .description("testString") - .destinationField("testString") - .sourceField("testString") - .overwrite(false) - .enrichment("testString") - .ignoreDownstreamErrors(false) - .options(enrichmentOptionsModel) - .build(); - assertEquals(enrichmentModel.description(), "testString"); - assertEquals(enrichmentModel.destinationField(), "testString"); - assertEquals(enrichmentModel.sourceField(), "testString"); - assertEquals(enrichmentModel.overwrite(), Boolean.valueOf(false)); - assertEquals(enrichmentModel.enrichment(), "testString"); - assertEquals(enrichmentModel.ignoreDownstreamErrors(), Boolean.valueOf(false)); - assertEquals(enrichmentModel.options(), enrichmentOptionsModel); - - String json = TestUtilities.serialize(enrichmentModel); - - Enrichment enrichmentModelNew = TestUtilities.deserialize(json, Enrichment.class); - assertTrue(enrichmentModelNew instanceof Enrichment); - assertEquals(enrichmentModelNew.description(), "testString"); - assertEquals(enrichmentModelNew.destinationField(), "testString"); - assertEquals(enrichmentModelNew.sourceField(), "testString"); - assertEquals(enrichmentModelNew.overwrite(), Boolean.valueOf(false)); - assertEquals(enrichmentModelNew.enrichment(), "testString"); - assertEquals(enrichmentModelNew.ignoreDownstreamErrors(), Boolean.valueOf(false)); - assertEquals(enrichmentModelNew.options().toString(), enrichmentOptionsModel.toString()); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testEnrichmentError() throws Throwable { - new Enrichment.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EnvironmentDocumentsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EnvironmentDocumentsTest.java deleted file mode 100644 index e7222fc407d..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EnvironmentDocumentsTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the EnvironmentDocuments model. */ -public class EnvironmentDocumentsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testEnvironmentDocuments() throws Throwable { - EnvironmentDocuments environmentDocumentsModel = new EnvironmentDocuments(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EnvironmentTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EnvironmentTest.java deleted file mode 100644 index fee64f22d0b..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EnvironmentTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the Environment model. */ -public class EnvironmentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testEnvironment() throws Throwable { - Environment environmentModel = new Environment(); - assertNull(environmentModel.getName()); - assertNull(environmentModel.getDescription()); - assertNull(environmentModel.getSize()); - assertNull(environmentModel.getRequestedSize()); - assertNull(environmentModel.getIndexCapacity()); - assertNull(environmentModel.getSearchStatus()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EventDataTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EventDataTest.java deleted file mode 100644 index 41ad4c76fa4..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/EventDataTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the EventData model. */ -public class EventDataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testEventData() throws Throwable { - EventData eventDataModel = - new EventData.Builder() - .environmentId("testString") - .sessionToken("testString") - .clientTimestamp(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .displayRank(Long.valueOf("26")) - .collectionId("testString") - .documentId("testString") - .build(); - assertEquals(eventDataModel.environmentId(), "testString"); - assertEquals(eventDataModel.sessionToken(), "testString"); - assertEquals( - eventDataModel.clientTimestamp(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(eventDataModel.displayRank(), Long.valueOf("26")); - assertEquals(eventDataModel.collectionId(), "testString"); - assertEquals(eventDataModel.documentId(), "testString"); - - String json = TestUtilities.serialize(eventDataModel); - - EventData eventDataModelNew = TestUtilities.deserialize(json, EventData.class); - assertTrue(eventDataModelNew instanceof EventData); - assertEquals(eventDataModelNew.environmentId(), "testString"); - assertEquals(eventDataModelNew.sessionToken(), "testString"); - assertEquals( - eventDataModelNew.clientTimestamp(), DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(eventDataModelNew.displayRank(), Long.valueOf("26")); - assertEquals(eventDataModelNew.collectionId(), "testString"); - assertEquals(eventDataModelNew.documentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testEventDataError() throws Throwable { - new EventData.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ExpansionTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ExpansionTest.java deleted file mode 100644 index c958e477014..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ExpansionTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the Expansion model. */ -public class ExpansionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExpansion() throws Throwable { - Expansion expansionModel = - new Expansion.Builder() - .inputTerms(java.util.Arrays.asList("testString")) - .expandedTerms(java.util.Arrays.asList("testString")) - .build(); - assertEquals(expansionModel.inputTerms(), java.util.Arrays.asList("testString")); - assertEquals(expansionModel.expandedTerms(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(expansionModel); - - Expansion expansionModelNew = TestUtilities.deserialize(json, Expansion.class); - assertTrue(expansionModelNew instanceof Expansion); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testExpansionError() throws Throwable { - new Expansion.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ExpansionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ExpansionsTest.java deleted file mode 100644 index 19b2fda37e7..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ExpansionsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the Expansions model. */ -public class ExpansionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testExpansions() throws Throwable { - Expansion expansionModel = - new Expansion.Builder() - .inputTerms(java.util.Arrays.asList("testString")) - .expandedTerms(java.util.Arrays.asList("testString")) - .build(); - assertEquals(expansionModel.inputTerms(), java.util.Arrays.asList("testString")); - assertEquals(expansionModel.expandedTerms(), java.util.Arrays.asList("testString")); - - Expansions expansionsModel = - new Expansions.Builder().expansions(java.util.Arrays.asList(expansionModel)).build(); - assertEquals(expansionsModel.expansions(), java.util.Arrays.asList(expansionModel)); - - String json = TestUtilities.serialize(expansionsModel); - - Expansions expansionsModelNew = TestUtilities.deserialize(json, Expansions.class); - assertTrue(expansionsModelNew instanceof Expansions); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testExpansionsError() throws Throwable { - new Expansions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptionsTest.java deleted file mode 100644 index 96542fce441..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/FederatedQueryNoticesOptionsTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the FederatedQueryNoticesOptions model. */ -public class FederatedQueryNoticesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testFederatedQueryNoticesOptions() throws Throwable { - FederatedQueryNoticesOptions federatedQueryNoticesOptionsModel = - new FederatedQueryNoticesOptions.Builder() - .environmentId("testString") - .collectionIds(java.util.Arrays.asList("testString")) - .filter("testString") - .query("testString") - .naturalLanguageQuery("testString") - .aggregation("testString") - .count(Long.valueOf("10")) - .xReturn(java.util.Arrays.asList("testString")) - .offset(Long.valueOf("26")) - .sort(java.util.Arrays.asList("testString")) - .highlight(false) - .deduplicateField("testString") - .similar(false) - .similarDocumentIds(java.util.Arrays.asList("testString")) - .similarFields(java.util.Arrays.asList("testString")) - .build(); - assertEquals(federatedQueryNoticesOptionsModel.environmentId(), "testString"); - assertEquals( - federatedQueryNoticesOptionsModel.collectionIds(), java.util.Arrays.asList("testString")); - assertEquals(federatedQueryNoticesOptionsModel.filter(), "testString"); - assertEquals(federatedQueryNoticesOptionsModel.query(), "testString"); - assertEquals(federatedQueryNoticesOptionsModel.naturalLanguageQuery(), "testString"); - assertEquals(federatedQueryNoticesOptionsModel.aggregation(), "testString"); - assertEquals(federatedQueryNoticesOptionsModel.count(), Long.valueOf("10")); - assertEquals( - federatedQueryNoticesOptionsModel.xReturn(), java.util.Arrays.asList("testString")); - assertEquals(federatedQueryNoticesOptionsModel.offset(), Long.valueOf("26")); - assertEquals(federatedQueryNoticesOptionsModel.sort(), java.util.Arrays.asList("testString")); - assertEquals(federatedQueryNoticesOptionsModel.highlight(), Boolean.valueOf(false)); - assertEquals(federatedQueryNoticesOptionsModel.deduplicateField(), "testString"); - assertEquals(federatedQueryNoticesOptionsModel.similar(), Boolean.valueOf(false)); - assertEquals( - federatedQueryNoticesOptionsModel.similarDocumentIds(), - java.util.Arrays.asList("testString")); - assertEquals( - federatedQueryNoticesOptionsModel.similarFields(), java.util.Arrays.asList("testString")); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testFederatedQueryNoticesOptionsError() throws Throwable { - new FederatedQueryNoticesOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptionsTest.java deleted file mode 100644 index f5f2d93ffae..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/FederatedQueryOptionsTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the FederatedQueryOptions model. */ -public class FederatedQueryOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testFederatedQueryOptions() throws Throwable { - FederatedQueryOptions federatedQueryOptionsModel = - new FederatedQueryOptions.Builder() - .environmentId("testString") - .collectionIds("testString") - .filter("testString") - .query("testString") - .naturalLanguageQuery("testString") - .passages(true) - .aggregation("testString") - .count(Long.valueOf("10")) - .xReturn("testString") - .offset(Long.valueOf("26")) - .sort("testString") - .highlight(false) - .passagesFields("testString") - .passagesCount(Long.valueOf("10")) - .passagesCharacters(Long.valueOf("400")) - .deduplicate(false) - .deduplicateField("testString") - .similar(false) - .similarDocumentIds("testString") - .similarFields("testString") - .bias("testString") - .xWatsonLoggingOptOut(false) - .build(); - assertEquals(federatedQueryOptionsModel.environmentId(), "testString"); - assertEquals(federatedQueryOptionsModel.collectionIds(), "testString"); - assertEquals(federatedQueryOptionsModel.filter(), "testString"); - assertEquals(federatedQueryOptionsModel.query(), "testString"); - assertEquals(federatedQueryOptionsModel.naturalLanguageQuery(), "testString"); - assertEquals(federatedQueryOptionsModel.passages(), Boolean.valueOf(true)); - assertEquals(federatedQueryOptionsModel.aggregation(), "testString"); - assertEquals(federatedQueryOptionsModel.count(), Long.valueOf("10")); - assertEquals(federatedQueryOptionsModel.xReturn(), "testString"); - assertEquals(federatedQueryOptionsModel.offset(), Long.valueOf("26")); - assertEquals(federatedQueryOptionsModel.sort(), "testString"); - assertEquals(federatedQueryOptionsModel.highlight(), Boolean.valueOf(false)); - assertEquals(federatedQueryOptionsModel.passagesFields(), "testString"); - assertEquals(federatedQueryOptionsModel.passagesCount(), Long.valueOf("10")); - assertEquals(federatedQueryOptionsModel.passagesCharacters(), Long.valueOf("400")); - assertEquals(federatedQueryOptionsModel.deduplicate(), Boolean.valueOf(false)); - assertEquals(federatedQueryOptionsModel.deduplicateField(), "testString"); - assertEquals(federatedQueryOptionsModel.similar(), Boolean.valueOf(false)); - assertEquals(federatedQueryOptionsModel.similarDocumentIds(), "testString"); - assertEquals(federatedQueryOptionsModel.similarFields(), "testString"); - assertEquals(federatedQueryOptionsModel.bias(), "testString"); - assertEquals(federatedQueryOptionsModel.xWatsonLoggingOptOut(), Boolean.valueOf(false)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testFederatedQueryOptionsError() throws Throwable { - new FederatedQueryOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/FieldTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/FieldTest.java deleted file mode 100644 index c0e96eb45c8..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/FieldTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the Field model. */ -public class FieldTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testField() throws Throwable { - Field fieldModel = new Field(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/FontSettingTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/FontSettingTest.java deleted file mode 100644 index 42a095938e1..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/FontSettingTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the FontSetting model. */ -public class FontSettingTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testFontSetting() throws Throwable { - FontSetting fontSettingModel = - new FontSetting.Builder() - .level(Long.valueOf("26")) - .minSize(Long.valueOf("26")) - .maxSize(Long.valueOf("26")) - .bold(true) - .italic(true) - .name("testString") - .build(); - assertEquals(fontSettingModel.level(), Long.valueOf("26")); - assertEquals(fontSettingModel.minSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.maxSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.bold(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.italic(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.name(), "testString"); - - String json = TestUtilities.serialize(fontSettingModel); - - FontSetting fontSettingModelNew = TestUtilities.deserialize(json, FontSetting.class); - assertTrue(fontSettingModelNew instanceof FontSetting); - assertEquals(fontSettingModelNew.level(), Long.valueOf("26")); - assertEquals(fontSettingModelNew.minSize(), Long.valueOf("26")); - assertEquals(fontSettingModelNew.maxSize(), Long.valueOf("26")); - assertEquals(fontSettingModelNew.bold(), Boolean.valueOf(true)); - assertEquals(fontSettingModelNew.italic(), Boolean.valueOf(true)); - assertEquals(fontSettingModelNew.name(), "testString"); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GatewayDeleteTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GatewayDeleteTest.java deleted file mode 100644 index 4e2442edf25..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GatewayDeleteTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GatewayDelete model. */ -public class GatewayDeleteTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGatewayDelete() throws Throwable { - GatewayDelete gatewayDeleteModel = new GatewayDelete(); - assertNull(gatewayDeleteModel.getGatewayId()); - assertNull(gatewayDeleteModel.getStatus()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GatewayListTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GatewayListTest.java deleted file mode 100644 index cceccd8dc43..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GatewayListTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GatewayList model. */ -public class GatewayListTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGatewayList() throws Throwable { - GatewayList gatewayListModel = new GatewayList(); - assertNull(gatewayListModel.getGateways()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GatewayTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GatewayTest.java deleted file mode 100644 index 4d35166ea79..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GatewayTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the Gateway model. */ -public class GatewayTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGateway() throws Throwable { - Gateway gatewayModel = new Gateway(); - assertNull(gatewayModel.getGatewayId()); - assertNull(gatewayModel.getName()); - assertNull(gatewayModel.getStatus()); - assertNull(gatewayModel.getToken()); - assertNull(gatewayModel.getTokenId()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetAutocompletionOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetAutocompletionOptionsTest.java deleted file mode 100644 index efff2c0af07..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetAutocompletionOptionsTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetAutocompletionOptions model. */ -public class GetAutocompletionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetAutocompletionOptions() throws Throwable { - GetAutocompletionOptions getAutocompletionOptionsModel = - new GetAutocompletionOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .prefix("testString") - .field("testString") - .count(Long.valueOf("5")) - .build(); - assertEquals(getAutocompletionOptionsModel.environmentId(), "testString"); - assertEquals(getAutocompletionOptionsModel.collectionId(), "testString"); - assertEquals(getAutocompletionOptionsModel.prefix(), "testString"); - assertEquals(getAutocompletionOptionsModel.field(), "testString"); - assertEquals(getAutocompletionOptionsModel.count(), Long.valueOf("5")); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetAutocompletionOptionsError() throws Throwable { - new GetAutocompletionOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetCollectionOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetCollectionOptionsTest.java deleted file mode 100644 index 690a5ca70fb..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetCollectionOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetCollectionOptions model. */ -public class GetCollectionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetCollectionOptions() throws Throwable { - GetCollectionOptions getCollectionOptionsModel = - new GetCollectionOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - assertEquals(getCollectionOptionsModel.environmentId(), "testString"); - assertEquals(getCollectionOptionsModel.collectionId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetCollectionOptionsError() throws Throwable { - new GetCollectionOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetConfigurationOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetConfigurationOptionsTest.java deleted file mode 100644 index b9bc7c7af77..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetConfigurationOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetConfigurationOptions model. */ -public class GetConfigurationOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetConfigurationOptions() throws Throwable { - GetConfigurationOptions getConfigurationOptionsModel = - new GetConfigurationOptions.Builder() - .environmentId("testString") - .configurationId("testString") - .build(); - assertEquals(getConfigurationOptionsModel.environmentId(), "testString"); - assertEquals(getConfigurationOptionsModel.configurationId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetConfigurationOptionsError() throws Throwable { - new GetConfigurationOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetCredentialsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetCredentialsOptionsTest.java deleted file mode 100644 index 4c7a4cf31e3..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetCredentialsOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetCredentialsOptions model. */ -public class GetCredentialsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetCredentialsOptions() throws Throwable { - GetCredentialsOptions getCredentialsOptionsModel = - new GetCredentialsOptions.Builder() - .environmentId("testString") - .credentialId("testString") - .build(); - assertEquals(getCredentialsOptionsModel.environmentId(), "testString"); - assertEquals(getCredentialsOptionsModel.credentialId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetCredentialsOptionsError() throws Throwable { - new GetCredentialsOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetDocumentStatusOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetDocumentStatusOptionsTest.java deleted file mode 100644 index e8ada11a6f2..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetDocumentStatusOptionsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetDocumentStatusOptions model. */ -public class GetDocumentStatusOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetDocumentStatusOptions() throws Throwable { - GetDocumentStatusOptions getDocumentStatusOptionsModel = - new GetDocumentStatusOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .documentId("testString") - .build(); - assertEquals(getDocumentStatusOptionsModel.environmentId(), "testString"); - assertEquals(getDocumentStatusOptionsModel.collectionId(), "testString"); - assertEquals(getDocumentStatusOptionsModel.documentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetDocumentStatusOptionsError() throws Throwable { - new GetDocumentStatusOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetEnvironmentOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetEnvironmentOptionsTest.java deleted file mode 100644 index 08fa7ca9d9b..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetEnvironmentOptionsTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetEnvironmentOptions model. */ -public class GetEnvironmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetEnvironmentOptions() throws Throwable { - GetEnvironmentOptions getEnvironmentOptionsModel = - new GetEnvironmentOptions.Builder().environmentId("testString").build(); - assertEquals(getEnvironmentOptionsModel.environmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetEnvironmentOptionsError() throws Throwable { - new GetEnvironmentOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetGatewayOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetGatewayOptionsTest.java deleted file mode 100644 index 9214b446c77..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetGatewayOptionsTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetGatewayOptions model. */ -public class GetGatewayOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetGatewayOptions() throws Throwable { - GetGatewayOptions getGatewayOptionsModel = - new GetGatewayOptions.Builder().environmentId("testString").gatewayId("testString").build(); - assertEquals(getGatewayOptionsModel.environmentId(), "testString"); - assertEquals(getGatewayOptionsModel.gatewayId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetGatewayOptionsError() throws Throwable { - new GetGatewayOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsEventRateOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsEventRateOptionsTest.java deleted file mode 100644 index 87317eb4806..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsEventRateOptionsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetMetricsEventRateOptions model. */ -public class GetMetricsEventRateOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetMetricsEventRateOptions() throws Throwable { - GetMetricsEventRateOptions getMetricsEventRateOptionsModel = - new GetMetricsEventRateOptions.Builder() - .startTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .endTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .resultType("document") - .build(); - assertEquals( - getMetricsEventRateOptionsModel.startTime(), - DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals( - getMetricsEventRateOptionsModel.endTime(), - DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(getMetricsEventRateOptionsModel.resultType(), "document"); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryEventOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryEventOptionsTest.java deleted file mode 100644 index d1400c24c77..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryEventOptionsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetMetricsQueryEventOptions model. */ -public class GetMetricsQueryEventOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetMetricsQueryEventOptions() throws Throwable { - GetMetricsQueryEventOptions getMetricsQueryEventOptionsModel = - new GetMetricsQueryEventOptions.Builder() - .startTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .endTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .resultType("document") - .build(); - assertEquals( - getMetricsQueryEventOptionsModel.startTime(), - DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals( - getMetricsQueryEventOptionsModel.endTime(), - DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(getMetricsQueryEventOptionsModel.resultType(), "document"); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryNoResultsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryNoResultsOptionsTest.java deleted file mode 100644 index 9de882c132d..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryNoResultsOptionsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetMetricsQueryNoResultsOptions model. */ -public class GetMetricsQueryNoResultsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetMetricsQueryNoResultsOptions() throws Throwable { - GetMetricsQueryNoResultsOptions getMetricsQueryNoResultsOptionsModel = - new GetMetricsQueryNoResultsOptions.Builder() - .startTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .endTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .resultType("document") - .build(); - assertEquals( - getMetricsQueryNoResultsOptionsModel.startTime(), - DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals( - getMetricsQueryNoResultsOptionsModel.endTime(), - DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(getMetricsQueryNoResultsOptionsModel.resultType(), "document"); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryOptionsTest.java deleted file mode 100644 index 586d5588320..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryOptionsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetMetricsQueryOptions model. */ -public class GetMetricsQueryOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetMetricsQueryOptions() throws Throwable { - GetMetricsQueryOptions getMetricsQueryOptionsModel = - new GetMetricsQueryOptions.Builder() - .startTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .endTime(DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")) - .resultType("document") - .build(); - assertEquals( - getMetricsQueryOptionsModel.startTime(), - DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals( - getMetricsQueryOptionsModel.endTime(), - DateUtils.parseAsDateTime("2019-01-01T12:00:00.000Z")); - assertEquals(getMetricsQueryOptionsModel.resultType(), "document"); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryTokenEventOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryTokenEventOptionsTest.java deleted file mode 100644 index a907da416e0..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetMetricsQueryTokenEventOptionsTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetMetricsQueryTokenEventOptions model. */ -public class GetMetricsQueryTokenEventOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetMetricsQueryTokenEventOptions() throws Throwable { - GetMetricsQueryTokenEventOptions getMetricsQueryTokenEventOptionsModel = - new GetMetricsQueryTokenEventOptions.Builder().count(Long.valueOf("10")).build(); - assertEquals(getMetricsQueryTokenEventOptionsModel.count(), Long.valueOf("10")); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetStopwordListStatusOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetStopwordListStatusOptionsTest.java deleted file mode 100644 index e3f9455c1eb..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetStopwordListStatusOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetStopwordListStatusOptions model. */ -public class GetStopwordListStatusOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetStopwordListStatusOptions() throws Throwable { - GetStopwordListStatusOptions getStopwordListStatusOptionsModel = - new GetStopwordListStatusOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - assertEquals(getStopwordListStatusOptionsModel.environmentId(), "testString"); - assertEquals(getStopwordListStatusOptionsModel.collectionId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetStopwordListStatusOptionsError() throws Throwable { - new GetStopwordListStatusOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetTokenizationDictionaryStatusOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetTokenizationDictionaryStatusOptionsTest.java deleted file mode 100644 index 72ca1cff4a3..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetTokenizationDictionaryStatusOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetTokenizationDictionaryStatusOptions model. */ -public class GetTokenizationDictionaryStatusOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetTokenizationDictionaryStatusOptions() throws Throwable { - GetTokenizationDictionaryStatusOptions getTokenizationDictionaryStatusOptionsModel = - new GetTokenizationDictionaryStatusOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - assertEquals(getTokenizationDictionaryStatusOptionsModel.environmentId(), "testString"); - assertEquals(getTokenizationDictionaryStatusOptionsModel.collectionId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetTokenizationDictionaryStatusOptionsError() throws Throwable { - new GetTokenizationDictionaryStatusOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetTrainingDataOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetTrainingDataOptionsTest.java deleted file mode 100644 index 21a4fa68a0d..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetTrainingDataOptionsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetTrainingDataOptions model. */ -public class GetTrainingDataOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetTrainingDataOptions() throws Throwable { - GetTrainingDataOptions getTrainingDataOptionsModel = - new GetTrainingDataOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .build(); - assertEquals(getTrainingDataOptionsModel.environmentId(), "testString"); - assertEquals(getTrainingDataOptionsModel.collectionId(), "testString"); - assertEquals(getTrainingDataOptionsModel.queryId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetTrainingDataOptionsError() throws Throwable { - new GetTrainingDataOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetTrainingExampleOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetTrainingExampleOptionsTest.java deleted file mode 100644 index 1b984d66cad..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/GetTrainingExampleOptionsTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the GetTrainingExampleOptions model. */ -public class GetTrainingExampleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testGetTrainingExampleOptions() throws Throwable { - GetTrainingExampleOptions getTrainingExampleOptionsModel = - new GetTrainingExampleOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .exampleId("testString") - .build(); - assertEquals(getTrainingExampleOptionsModel.environmentId(), "testString"); - assertEquals(getTrainingExampleOptionsModel.collectionId(), "testString"); - assertEquals(getTrainingExampleOptionsModel.queryId(), "testString"); - assertEquals(getTrainingExampleOptionsModel.exampleId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testGetTrainingExampleOptionsError() throws Throwable { - new GetTrainingExampleOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/HtmlSettingsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/HtmlSettingsTest.java deleted file mode 100644 index e88be8750bb..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/HtmlSettingsTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the HtmlSettings model. */ -public class HtmlSettingsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testHtmlSettings() throws Throwable { - XPathPatterns xPathPatternsModel = - new XPathPatterns.Builder().xpaths(java.util.Arrays.asList("testString")).build(); - assertEquals(xPathPatternsModel.xpaths(), java.util.Arrays.asList("testString")); - - HtmlSettings htmlSettingsModel = - new HtmlSettings.Builder() - .excludeTagsCompletely(java.util.Arrays.asList("testString")) - .excludeTagsKeepContent(java.util.Arrays.asList("testString")) - .keepContent(xPathPatternsModel) - .excludeContent(xPathPatternsModel) - .keepTagAttributes(java.util.Arrays.asList("testString")) - .excludeTagAttributes(java.util.Arrays.asList("testString")) - .build(); - assertEquals(htmlSettingsModel.excludeTagsCompletely(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.excludeTagsKeepContent(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.keepContent(), xPathPatternsModel); - assertEquals(htmlSettingsModel.excludeContent(), xPathPatternsModel); - assertEquals(htmlSettingsModel.keepTagAttributes(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.excludeTagAttributes(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(htmlSettingsModel); - - HtmlSettings htmlSettingsModelNew = TestUtilities.deserialize(json, HtmlSettings.class); - assertTrue(htmlSettingsModelNew instanceof HtmlSettings); - assertEquals(htmlSettingsModelNew.keepContent().toString(), xPathPatternsModel.toString()); - assertEquals(htmlSettingsModelNew.excludeContent().toString(), xPathPatternsModel.toString()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/IndexCapacityTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/IndexCapacityTest.java deleted file mode 100644 index 582875bf601..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/IndexCapacityTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the IndexCapacity model. */ -public class IndexCapacityTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testIndexCapacity() throws Throwable { - IndexCapacity indexCapacityModel = new IndexCapacity(); - assertNull(indexCapacityModel.getDocuments()); - assertNull(indexCapacityModel.getDiskUsage()); - assertNull(indexCapacityModel.getCollections()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsOptionsTest.java deleted file mode 100644 index 80194e357a2..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListCollectionFieldsOptions model. */ -public class ListCollectionFieldsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListCollectionFieldsOptions() throws Throwable { - ListCollectionFieldsOptions listCollectionFieldsOptionsModel = - new ListCollectionFieldsOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - assertEquals(listCollectionFieldsOptionsModel.environmentId(), "testString"); - assertEquals(listCollectionFieldsOptionsModel.collectionId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListCollectionFieldsOptionsError() throws Throwable { - new ListCollectionFieldsOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsResponseTest.java deleted file mode 100644 index e2f68335ced..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCollectionFieldsResponseTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListCollectionFieldsResponse model. */ -public class ListCollectionFieldsResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListCollectionFieldsResponse() throws Throwable { - ListCollectionFieldsResponse listCollectionFieldsResponseModel = - new ListCollectionFieldsResponse(); - assertNull(listCollectionFieldsResponseModel.getFields()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCollectionsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCollectionsOptionsTest.java deleted file mode 100644 index dfd2bd7cf60..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCollectionsOptionsTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListCollectionsOptions model. */ -public class ListCollectionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListCollectionsOptions() throws Throwable { - ListCollectionsOptions listCollectionsOptionsModel = - new ListCollectionsOptions.Builder().environmentId("testString").name("testString").build(); - assertEquals(listCollectionsOptionsModel.environmentId(), "testString"); - assertEquals(listCollectionsOptionsModel.name(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListCollectionsOptionsError() throws Throwable { - new ListCollectionsOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCollectionsResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCollectionsResponseTest.java deleted file mode 100644 index 87a68a9ed87..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCollectionsResponseTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListCollectionsResponse model. */ -public class ListCollectionsResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListCollectionsResponse() throws Throwable { - ListCollectionsResponse listCollectionsResponseModel = new ListCollectionsResponse(); - assertNull(listCollectionsResponseModel.getCollections()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListConfigurationsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListConfigurationsOptionsTest.java deleted file mode 100644 index cfc6d5a42fa..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListConfigurationsOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListConfigurationsOptions model. */ -public class ListConfigurationsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListConfigurationsOptions() throws Throwable { - ListConfigurationsOptions listConfigurationsOptionsModel = - new ListConfigurationsOptions.Builder() - .environmentId("testString") - .name("testString") - .build(); - assertEquals(listConfigurationsOptionsModel.environmentId(), "testString"); - assertEquals(listConfigurationsOptionsModel.name(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListConfigurationsOptionsError() throws Throwable { - new ListConfigurationsOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListConfigurationsResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListConfigurationsResponseTest.java deleted file mode 100644 index ebd8ad4d4fc..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListConfigurationsResponseTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListConfigurationsResponse model. */ -public class ListConfigurationsResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListConfigurationsResponse() throws Throwable { - ListConfigurationsResponse listConfigurationsResponseModel = new ListConfigurationsResponse(); - assertNull(listConfigurationsResponseModel.getConfigurations()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCredentialsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCredentialsOptionsTest.java deleted file mode 100644 index d3fbbd93587..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListCredentialsOptionsTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListCredentialsOptions model. */ -public class ListCredentialsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListCredentialsOptions() throws Throwable { - ListCredentialsOptions listCredentialsOptionsModel = - new ListCredentialsOptions.Builder().environmentId("testString").build(); - assertEquals(listCredentialsOptionsModel.environmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListCredentialsOptionsError() throws Throwable { - new ListCredentialsOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsOptionsTest.java deleted file mode 100644 index 951d62f7296..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsOptionsTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListEnvironmentsOptions model. */ -public class ListEnvironmentsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListEnvironmentsOptions() throws Throwable { - ListEnvironmentsOptions listEnvironmentsOptionsModel = - new ListEnvironmentsOptions.Builder().name("testString").build(); - assertEquals(listEnvironmentsOptionsModel.name(), "testString"); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsResponseTest.java deleted file mode 100644 index 9f21d05ab57..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListEnvironmentsResponseTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListEnvironmentsResponse model. */ -public class ListEnvironmentsResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListEnvironmentsResponse() throws Throwable { - ListEnvironmentsResponse listEnvironmentsResponseModel = new ListEnvironmentsResponse(); - assertNull(listEnvironmentsResponseModel.getEnvironments()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListExpansionsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListExpansionsOptionsTest.java deleted file mode 100644 index 127a09598f0..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListExpansionsOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListExpansionsOptions model. */ -public class ListExpansionsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListExpansionsOptions() throws Throwable { - ListExpansionsOptions listExpansionsOptionsModel = - new ListExpansionsOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - assertEquals(listExpansionsOptionsModel.environmentId(), "testString"); - assertEquals(listExpansionsOptionsModel.collectionId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListExpansionsOptionsError() throws Throwable { - new ListExpansionsOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListFieldsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListFieldsOptionsTest.java deleted file mode 100644 index 2ebb3e83027..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListFieldsOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListFieldsOptions model. */ -public class ListFieldsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListFieldsOptions() throws Throwable { - ListFieldsOptions listFieldsOptionsModel = - new ListFieldsOptions.Builder() - .environmentId("testString") - .collectionIds(java.util.Arrays.asList("testString")) - .build(); - assertEquals(listFieldsOptionsModel.environmentId(), "testString"); - assertEquals(listFieldsOptionsModel.collectionIds(), java.util.Arrays.asList("testString")); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListFieldsOptionsError() throws Throwable { - new ListFieldsOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListGatewaysOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListGatewaysOptionsTest.java deleted file mode 100644 index 69ea7382000..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListGatewaysOptionsTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListGatewaysOptions model. */ -public class ListGatewaysOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListGatewaysOptions() throws Throwable { - ListGatewaysOptions listGatewaysOptionsModel = - new ListGatewaysOptions.Builder().environmentId("testString").build(); - assertEquals(listGatewaysOptionsModel.environmentId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListGatewaysOptionsError() throws Throwable { - new ListGatewaysOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListTrainingDataOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListTrainingDataOptionsTest.java deleted file mode 100644 index 2e13dcffdc4..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListTrainingDataOptionsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListTrainingDataOptions model. */ -public class ListTrainingDataOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListTrainingDataOptions() throws Throwable { - ListTrainingDataOptions listTrainingDataOptionsModel = - new ListTrainingDataOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .build(); - assertEquals(listTrainingDataOptionsModel.environmentId(), "testString"); - assertEquals(listTrainingDataOptionsModel.collectionId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListTrainingDataOptionsError() throws Throwable { - new ListTrainingDataOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListTrainingExamplesOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListTrainingExamplesOptionsTest.java deleted file mode 100644 index c4160649b1d..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/ListTrainingExamplesOptionsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the ListTrainingExamplesOptions model. */ -public class ListTrainingExamplesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testListTrainingExamplesOptions() throws Throwable { - ListTrainingExamplesOptions listTrainingExamplesOptionsModel = - new ListTrainingExamplesOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .build(); - assertEquals(listTrainingExamplesOptionsModel.environmentId(), "testString"); - assertEquals(listTrainingExamplesOptionsModel.collectionId(), "testString"); - assertEquals(listTrainingExamplesOptionsModel.queryId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testListTrainingExamplesOptionsError() throws Throwable { - new ListTrainingExamplesOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocumentsResultTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocumentsResultTest.java deleted file mode 100644 index b771dc71ba4..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocumentsResultTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the LogQueryResponseResultDocumentsResult model. */ -public class LogQueryResponseResultDocumentsResultTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testLogQueryResponseResultDocumentsResult() throws Throwable { - LogQueryResponseResultDocumentsResult logQueryResponseResultDocumentsResultModel = - new LogQueryResponseResultDocumentsResult(); - assertNull(logQueryResponseResultDocumentsResultModel.getPosition()); - assertNull(logQueryResponseResultDocumentsResultModel.getDocumentId()); - assertNull(logQueryResponseResultDocumentsResultModel.getScore()); - assertNull(logQueryResponseResultDocumentsResultModel.getConfidence()); - assertNull(logQueryResponseResultDocumentsResultModel.getCollectionId()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocumentsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocumentsTest.java deleted file mode 100644 index eecaec4069d..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultDocumentsTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the LogQueryResponseResultDocuments model. */ -public class LogQueryResponseResultDocumentsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testLogQueryResponseResultDocuments() throws Throwable { - LogQueryResponseResultDocuments logQueryResponseResultDocumentsModel = - new LogQueryResponseResultDocuments(); - assertNull(logQueryResponseResultDocumentsModel.getResults()); - assertNull(logQueryResponseResultDocumentsModel.getCount()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultTest.java deleted file mode 100644 index f9a47ecd4d8..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/LogQueryResponseResultTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the LogQueryResponseResult model. */ -public class LogQueryResponseResultTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testLogQueryResponseResult() throws Throwable { - LogQueryResponseResult logQueryResponseResultModel = new LogQueryResponseResult(); - assertNull(logQueryResponseResultModel.getEnvironmentId()); - assertNull(logQueryResponseResultModel.getCustomerId()); - assertNull(logQueryResponseResultModel.getDocumentType()); - assertNull(logQueryResponseResultModel.getNaturalLanguageQuery()); - assertNull(logQueryResponseResultModel.getDocumentResults()); - assertNull(logQueryResponseResultModel.getCreatedTimestamp()); - assertNull(logQueryResponseResultModel.getClientTimestamp()); - assertNull(logQueryResponseResultModel.getQueryId()); - assertNull(logQueryResponseResultModel.getSessionToken()); - assertNull(logQueryResponseResultModel.getCollectionId()); - assertNull(logQueryResponseResultModel.getDisplayRank()); - assertNull(logQueryResponseResultModel.getDocumentId()); - assertNull(logQueryResponseResultModel.getEventType()); - assertNull(logQueryResponseResultModel.getResultType()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/LogQueryResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/LogQueryResponseTest.java deleted file mode 100644 index 609abffe157..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/LogQueryResponseTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the LogQueryResponse model. */ -public class LogQueryResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testLogQueryResponse() throws Throwable { - LogQueryResponse logQueryResponseModel = new LogQueryResponse(); - assertNull(logQueryResponseModel.getMatchingResults()); - assertNull(logQueryResponseModel.getResults()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricAggregationResultTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricAggregationResultTest.java deleted file mode 100644 index c776ce9e687..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricAggregationResultTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the MetricAggregationResult model. */ -public class MetricAggregationResultTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testMetricAggregationResult() throws Throwable { - MetricAggregationResult metricAggregationResultModel = new MetricAggregationResult(); - assertNull(metricAggregationResultModel.getKeyAsString()); - assertNull(metricAggregationResultModel.getKey()); - assertNull(metricAggregationResultModel.getMatchingResults()); - assertNull(metricAggregationResultModel.getEventRate()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricAggregationTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricAggregationTest.java deleted file mode 100644 index c57836b3abd..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricAggregationTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the MetricAggregation model. */ -public class MetricAggregationTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testMetricAggregation() throws Throwable { - MetricAggregation metricAggregationModel = new MetricAggregation(); - assertNull(metricAggregationModel.getInterval()); - assertNull(metricAggregationModel.getEventType()); - assertNull(metricAggregationModel.getResults()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricResponseTest.java deleted file mode 100644 index 6040800f5a7..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricResponseTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the MetricResponse model. */ -public class MetricResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testMetricResponse() throws Throwable { - MetricResponse metricResponseModel = new MetricResponse(); - assertNull(metricResponseModel.getAggregations()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregationResultTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregationResultTest.java deleted file mode 100644 index e06d469376a..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregationResultTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the MetricTokenAggregationResult model. */ -public class MetricTokenAggregationResultTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testMetricTokenAggregationResult() throws Throwable { - MetricTokenAggregationResult metricTokenAggregationResultModel = - new MetricTokenAggregationResult(); - assertNull(metricTokenAggregationResultModel.getKey()); - assertNull(metricTokenAggregationResultModel.getMatchingResults()); - assertNull(metricTokenAggregationResultModel.getEventRate()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregationTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregationTest.java deleted file mode 100644 index 0944f3f501d..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricTokenAggregationTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the MetricTokenAggregation model. */ -public class MetricTokenAggregationTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testMetricTokenAggregation() throws Throwable { - MetricTokenAggregation metricTokenAggregationModel = new MetricTokenAggregation(); - assertNull(metricTokenAggregationModel.getEventType()); - assertNull(metricTokenAggregationModel.getResults()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricTokenResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricTokenResponseTest.java deleted file mode 100644 index d7e6acf5547..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/MetricTokenResponseTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the MetricTokenResponse model. */ -public class MetricTokenResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testMetricTokenResponse() throws Throwable { - MetricTokenResponse metricTokenResponseModel = new MetricTokenResponse(); - assertNull(metricTokenResponseModel.getAggregations()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentConceptsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentConceptsTest.java deleted file mode 100644 index 8a3a337ab43..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentConceptsTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the NluEnrichmentConcepts model. */ -public class NluEnrichmentConceptsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNluEnrichmentConcepts() throws Throwable { - NluEnrichmentConcepts nluEnrichmentConceptsModel = - new NluEnrichmentConcepts.Builder().limit(Long.valueOf("26")).build(); - assertEquals(nluEnrichmentConceptsModel.limit(), Long.valueOf("26")); - - String json = TestUtilities.serialize(nluEnrichmentConceptsModel); - - NluEnrichmentConcepts nluEnrichmentConceptsModelNew = - TestUtilities.deserialize(json, NluEnrichmentConcepts.class); - assertTrue(nluEnrichmentConceptsModelNew instanceof NluEnrichmentConcepts); - assertEquals(nluEnrichmentConceptsModelNew.limit(), Long.valueOf("26")); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEmotionTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEmotionTest.java deleted file mode 100644 index e725c11c93c..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEmotionTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the NluEnrichmentEmotion model. */ -public class NluEnrichmentEmotionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNluEnrichmentEmotion() throws Throwable { - NluEnrichmentEmotion nluEnrichmentEmotionModel = - new NluEnrichmentEmotion.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - assertEquals(nluEnrichmentEmotionModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEmotionModel.targets(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(nluEnrichmentEmotionModel); - - NluEnrichmentEmotion nluEnrichmentEmotionModelNew = - TestUtilities.deserialize(json, NluEnrichmentEmotion.class); - assertTrue(nluEnrichmentEmotionModelNew instanceof NluEnrichmentEmotion); - assertEquals(nluEnrichmentEmotionModelNew.document(), Boolean.valueOf(true)); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEntitiesTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEntitiesTest.java deleted file mode 100644 index d05172a0a64..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentEntitiesTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the NluEnrichmentEntities model. */ -public class NluEnrichmentEntitiesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNluEnrichmentEntities() throws Throwable { - NluEnrichmentEntities nluEnrichmentEntitiesModel = - new NluEnrichmentEntities.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .mentions(true) - .mentionTypes(true) - .sentenceLocations(true) - .model("testString") - .build(); - assertEquals(nluEnrichmentEntitiesModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.limit(), Long.valueOf("26")); - assertEquals(nluEnrichmentEntitiesModel.mentions(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.mentionTypes(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.sentenceLocations(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.model(), "testString"); - - String json = TestUtilities.serialize(nluEnrichmentEntitiesModel); - - NluEnrichmentEntities nluEnrichmentEntitiesModelNew = - TestUtilities.deserialize(json, NluEnrichmentEntities.class); - assertTrue(nluEnrichmentEntitiesModelNew instanceof NluEnrichmentEntities); - assertEquals(nluEnrichmentEntitiesModelNew.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModelNew.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModelNew.limit(), Long.valueOf("26")); - assertEquals(nluEnrichmentEntitiesModelNew.mentions(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModelNew.mentionTypes(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModelNew.sentenceLocations(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModelNew.model(), "testString"); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentFeaturesTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentFeaturesTest.java deleted file mode 100644 index 93c77ae1e04..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentFeaturesTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the NluEnrichmentFeatures model. */ -public class NluEnrichmentFeaturesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNluEnrichmentFeatures() throws Throwable { - NluEnrichmentKeywords nluEnrichmentKeywordsModel = - new NluEnrichmentKeywords.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .build(); - assertEquals(nluEnrichmentKeywordsModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModel.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModel.limit(), Long.valueOf("26")); - - NluEnrichmentEntities nluEnrichmentEntitiesModel = - new NluEnrichmentEntities.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .mentions(true) - .mentionTypes(true) - .sentenceLocations(true) - .model("testString") - .build(); - assertEquals(nluEnrichmentEntitiesModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.limit(), Long.valueOf("26")); - assertEquals(nluEnrichmentEntitiesModel.mentions(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.mentionTypes(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.sentenceLocations(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.model(), "testString"); - - NluEnrichmentSentiment nluEnrichmentSentimentModel = - new NluEnrichmentSentiment.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - assertEquals(nluEnrichmentSentimentModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSentimentModel.targets(), java.util.Arrays.asList("testString")); - - NluEnrichmentEmotion nluEnrichmentEmotionModel = - new NluEnrichmentEmotion.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - assertEquals(nluEnrichmentEmotionModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEmotionModel.targets(), java.util.Arrays.asList("testString")); - - NluEnrichmentSemanticRoles nluEnrichmentSemanticRolesModel = - new NluEnrichmentSemanticRoles.Builder() - .entities(true) - .keywords(true) - .limit(Long.valueOf("26")) - .build(); - assertEquals(nluEnrichmentSemanticRolesModel.entities(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.keywords(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.limit(), Long.valueOf("26")); - - NluEnrichmentRelations nluEnrichmentRelationsModel = - new NluEnrichmentRelations.Builder().model("testString").build(); - assertEquals(nluEnrichmentRelationsModel.model(), "testString"); - - NluEnrichmentConcepts nluEnrichmentConceptsModel = - new NluEnrichmentConcepts.Builder().limit(Long.valueOf("26")).build(); - assertEquals(nluEnrichmentConceptsModel.limit(), Long.valueOf("26")); - - NluEnrichmentFeatures nluEnrichmentFeaturesModel = - new NluEnrichmentFeatures.Builder() - .keywords(nluEnrichmentKeywordsModel) - .entities(nluEnrichmentEntitiesModel) - .sentiment(nluEnrichmentSentimentModel) - .emotion(nluEnrichmentEmotionModel) - .categories(java.util.Collections.singletonMap("anyKey", "anyValue")) - .semanticRoles(nluEnrichmentSemanticRolesModel) - .relations(nluEnrichmentRelationsModel) - .concepts(nluEnrichmentConceptsModel) - .build(); - assertEquals(nluEnrichmentFeaturesModel.keywords(), nluEnrichmentKeywordsModel); - assertEquals(nluEnrichmentFeaturesModel.entities(), nluEnrichmentEntitiesModel); - assertEquals(nluEnrichmentFeaturesModel.sentiment(), nluEnrichmentSentimentModel); - assertEquals(nluEnrichmentFeaturesModel.emotion(), nluEnrichmentEmotionModel); - assertEquals( - nluEnrichmentFeaturesModel.categories(), - java.util.Collections.singletonMap("anyKey", "anyValue")); - assertEquals(nluEnrichmentFeaturesModel.semanticRoles(), nluEnrichmentSemanticRolesModel); - assertEquals(nluEnrichmentFeaturesModel.relations(), nluEnrichmentRelationsModel); - assertEquals(nluEnrichmentFeaturesModel.concepts(), nluEnrichmentConceptsModel); - - String json = TestUtilities.serialize(nluEnrichmentFeaturesModel); - - NluEnrichmentFeatures nluEnrichmentFeaturesModelNew = - TestUtilities.deserialize(json, NluEnrichmentFeatures.class); - assertTrue(nluEnrichmentFeaturesModelNew instanceof NluEnrichmentFeatures); - assertEquals( - nluEnrichmentFeaturesModelNew.keywords().toString(), nluEnrichmentKeywordsModel.toString()); - assertEquals( - nluEnrichmentFeaturesModelNew.entities().toString(), nluEnrichmentEntitiesModel.toString()); - assertEquals( - nluEnrichmentFeaturesModelNew.sentiment().toString(), - nluEnrichmentSentimentModel.toString()); - assertEquals( - nluEnrichmentFeaturesModelNew.emotion().toString(), nluEnrichmentEmotionModel.toString()); - assertEquals( - nluEnrichmentFeaturesModelNew.categories().toString(), - java.util.Collections.singletonMap("anyKey", "anyValue").toString()); - assertEquals( - nluEnrichmentFeaturesModelNew.semanticRoles().toString(), - nluEnrichmentSemanticRolesModel.toString()); - assertEquals( - nluEnrichmentFeaturesModelNew.relations().toString(), - nluEnrichmentRelationsModel.toString()); - assertEquals( - nluEnrichmentFeaturesModelNew.concepts().toString(), nluEnrichmentConceptsModel.toString()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentKeywordsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentKeywordsTest.java deleted file mode 100644 index cea1b8cf10a..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentKeywordsTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the NluEnrichmentKeywords model. */ -public class NluEnrichmentKeywordsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNluEnrichmentKeywords() throws Throwable { - NluEnrichmentKeywords nluEnrichmentKeywordsModel = - new NluEnrichmentKeywords.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .build(); - assertEquals(nluEnrichmentKeywordsModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModel.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModel.limit(), Long.valueOf("26")); - - String json = TestUtilities.serialize(nluEnrichmentKeywordsModel); - - NluEnrichmentKeywords nluEnrichmentKeywordsModelNew = - TestUtilities.deserialize(json, NluEnrichmentKeywords.class); - assertTrue(nluEnrichmentKeywordsModelNew instanceof NluEnrichmentKeywords); - assertEquals(nluEnrichmentKeywordsModelNew.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModelNew.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModelNew.limit(), Long.valueOf("26")); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentRelationsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentRelationsTest.java deleted file mode 100644 index 777e296b325..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentRelationsTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the NluEnrichmentRelations model. */ -public class NluEnrichmentRelationsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNluEnrichmentRelations() throws Throwable { - NluEnrichmentRelations nluEnrichmentRelationsModel = - new NluEnrichmentRelations.Builder().model("testString").build(); - assertEquals(nluEnrichmentRelationsModel.model(), "testString"); - - String json = TestUtilities.serialize(nluEnrichmentRelationsModel); - - NluEnrichmentRelations nluEnrichmentRelationsModelNew = - TestUtilities.deserialize(json, NluEnrichmentRelations.class); - assertTrue(nluEnrichmentRelationsModelNew instanceof NluEnrichmentRelations); - assertEquals(nluEnrichmentRelationsModelNew.model(), "testString"); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSemanticRolesTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSemanticRolesTest.java deleted file mode 100644 index 1df2e7c2902..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSemanticRolesTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the NluEnrichmentSemanticRoles model. */ -public class NluEnrichmentSemanticRolesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNluEnrichmentSemanticRoles() throws Throwable { - NluEnrichmentSemanticRoles nluEnrichmentSemanticRolesModel = - new NluEnrichmentSemanticRoles.Builder() - .entities(true) - .keywords(true) - .limit(Long.valueOf("26")) - .build(); - assertEquals(nluEnrichmentSemanticRolesModel.entities(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.keywords(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.limit(), Long.valueOf("26")); - - String json = TestUtilities.serialize(nluEnrichmentSemanticRolesModel); - - NluEnrichmentSemanticRoles nluEnrichmentSemanticRolesModelNew = - TestUtilities.deserialize(json, NluEnrichmentSemanticRoles.class); - assertTrue(nluEnrichmentSemanticRolesModelNew instanceof NluEnrichmentSemanticRoles); - assertEquals(nluEnrichmentSemanticRolesModelNew.entities(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModelNew.keywords(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModelNew.limit(), Long.valueOf("26")); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSentimentTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSentimentTest.java deleted file mode 100644 index 6a30965c252..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NluEnrichmentSentimentTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the NluEnrichmentSentiment model. */ -public class NluEnrichmentSentimentTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNluEnrichmentSentiment() throws Throwable { - NluEnrichmentSentiment nluEnrichmentSentimentModel = - new NluEnrichmentSentiment.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - assertEquals(nluEnrichmentSentimentModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSentimentModel.targets(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(nluEnrichmentSentimentModel); - - NluEnrichmentSentiment nluEnrichmentSentimentModelNew = - TestUtilities.deserialize(json, NluEnrichmentSentiment.class); - assertTrue(nluEnrichmentSentimentModelNew instanceof NluEnrichmentSentiment); - assertEquals(nluEnrichmentSentimentModelNew.document(), Boolean.valueOf(true)); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NormalizationOperationTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NormalizationOperationTest.java deleted file mode 100644 index 1000f68fa00..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NormalizationOperationTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the NormalizationOperation model. */ -public class NormalizationOperationTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNormalizationOperation() throws Throwable { - NormalizationOperation normalizationOperationModel = - new NormalizationOperation.Builder() - .operation("copy") - .sourceField("testString") - .destinationField("testString") - .build(); - assertEquals(normalizationOperationModel.operation(), "copy"); - assertEquals(normalizationOperationModel.sourceField(), "testString"); - assertEquals(normalizationOperationModel.destinationField(), "testString"); - - String json = TestUtilities.serialize(normalizationOperationModel); - - NormalizationOperation normalizationOperationModelNew = - TestUtilities.deserialize(json, NormalizationOperation.class); - assertTrue(normalizationOperationModelNew instanceof NormalizationOperation); - assertEquals(normalizationOperationModelNew.operation(), "copy"); - assertEquals(normalizationOperationModelNew.sourceField(), "testString"); - assertEquals(normalizationOperationModelNew.destinationField(), "testString"); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NoticeTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NoticeTest.java deleted file mode 100644 index 5f4d6a40324..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/NoticeTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the Notice model. */ -public class NoticeTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testNotice() throws Throwable { - Notice noticeModel = new Notice(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/PdfHeadingDetectionTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/PdfHeadingDetectionTest.java deleted file mode 100644 index 6b603409cf4..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/PdfHeadingDetectionTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the PdfHeadingDetection model. */ -public class PdfHeadingDetectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPdfHeadingDetection() throws Throwable { - FontSetting fontSettingModel = - new FontSetting.Builder() - .level(Long.valueOf("26")) - .minSize(Long.valueOf("26")) - .maxSize(Long.valueOf("26")) - .bold(true) - .italic(true) - .name("testString") - .build(); - assertEquals(fontSettingModel.level(), Long.valueOf("26")); - assertEquals(fontSettingModel.minSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.maxSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.bold(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.italic(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.name(), "testString"); - - PdfHeadingDetection pdfHeadingDetectionModel = - new PdfHeadingDetection.Builder().fonts(java.util.Arrays.asList(fontSettingModel)).build(); - assertEquals(pdfHeadingDetectionModel.fonts(), java.util.Arrays.asList(fontSettingModel)); - - String json = TestUtilities.serialize(pdfHeadingDetectionModel); - - PdfHeadingDetection pdfHeadingDetectionModelNew = - TestUtilities.deserialize(json, PdfHeadingDetection.class); - assertTrue(pdfHeadingDetectionModelNew instanceof PdfHeadingDetection); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/PdfSettingsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/PdfSettingsTest.java deleted file mode 100644 index bc83bd6dfd9..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/PdfSettingsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the PdfSettings model. */ -public class PdfSettingsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testPdfSettings() throws Throwable { - FontSetting fontSettingModel = - new FontSetting.Builder() - .level(Long.valueOf("26")) - .minSize(Long.valueOf("26")) - .maxSize(Long.valueOf("26")) - .bold(true) - .italic(true) - .name("testString") - .build(); - assertEquals(fontSettingModel.level(), Long.valueOf("26")); - assertEquals(fontSettingModel.minSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.maxSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.bold(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.italic(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.name(), "testString"); - - PdfHeadingDetection pdfHeadingDetectionModel = - new PdfHeadingDetection.Builder().fonts(java.util.Arrays.asList(fontSettingModel)).build(); - assertEquals(pdfHeadingDetectionModel.fonts(), java.util.Arrays.asList(fontSettingModel)); - - PdfSettings pdfSettingsModel = - new PdfSettings.Builder().heading(pdfHeadingDetectionModel).build(); - assertEquals(pdfSettingsModel.heading(), pdfHeadingDetectionModel); - - String json = TestUtilities.serialize(pdfSettingsModel); - - PdfSettings pdfSettingsModelNew = TestUtilities.deserialize(json, PdfSettings.class); - assertTrue(pdfSettingsModelNew instanceof PdfSettings); - assertEquals(pdfSettingsModelNew.heading().toString(), pdfHeadingDetectionModel.toString()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryAggregationTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryAggregationTest.java deleted file mode 100644 index 1618a0e836a..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryAggregationTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryAggregation model. */ -public class QueryAggregationTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - // TODO: Add tests for models that are abstract - @Test - public void testQueryAggregation() throws Throwable { - QueryAggregation queryAggregationModel = new QueryAggregation(); - assertNotNull(queryAggregationModel); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryCalculationAggregationTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryCalculationAggregationTest.java deleted file mode 100644 index 137b6670048..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryCalculationAggregationTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryCalculationAggregation model. */ -public class QueryCalculationAggregationTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryCalculationAggregation() throws Throwable { - QueryCalculationAggregation queryCalculationAggregationModel = - new QueryCalculationAggregation(); - assertNull(queryCalculationAggregationModel.getType()); - assertNull(queryCalculationAggregationModel.getField()); - assertNull(queryCalculationAggregationModel.getValue()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryFilterAggregationTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryFilterAggregationTest.java deleted file mode 100644 index 883b65ffb2f..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryFilterAggregationTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryFilterAggregation model. */ -public class QueryFilterAggregationTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryFilterAggregation() throws Throwable { - QueryFilterAggregation queryFilterAggregationModel = new QueryFilterAggregation(); - assertNull(queryFilterAggregationModel.getType()); - assertNull(queryFilterAggregationModel.getMatch()); - assertNull(queryFilterAggregationModel.getMatchingResults()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryHistogramAggregationResultTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryHistogramAggregationResultTest.java deleted file mode 100644 index a13e1008634..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryHistogramAggregationResultTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryHistogramAggregationResult model. */ -public class QueryHistogramAggregationResultTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryHistogramAggregationResult() throws Throwable { - QueryHistogramAggregationResult queryHistogramAggregationResultModel = - new QueryHistogramAggregationResult(); - assertNull(queryHistogramAggregationResultModel.getKey()); - assertNull(queryHistogramAggregationResultModel.getMatchingResults()); - assertNull(queryHistogramAggregationResultModel.getAggregations()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryHistogramAggregationTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryHistogramAggregationTest.java deleted file mode 100644 index a54a7160824..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryHistogramAggregationTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryHistogramAggregation model. */ -public class QueryHistogramAggregationTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryHistogramAggregation() throws Throwable { - QueryHistogramAggregation queryHistogramAggregationModel = new QueryHistogramAggregation(); - assertNull(queryHistogramAggregationModel.getType()); - assertNull(queryHistogramAggregationModel.getField()); - assertNull(queryHistogramAggregationModel.getInterval()); - assertNull(queryHistogramAggregationModel.getName()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryLogOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryLogOptionsTest.java deleted file mode 100644 index 2bdbea22eae..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryLogOptionsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryLogOptions model. */ -public class QueryLogOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryLogOptions() throws Throwable { - QueryLogOptions queryLogOptionsModel = - new QueryLogOptions.Builder() - .filter("testString") - .query("testString") - .count(Long.valueOf("10")) - .offset(Long.valueOf("26")) - .sort(java.util.Arrays.asList("testString")) - .build(); - assertEquals(queryLogOptionsModel.filter(), "testString"); - assertEquals(queryLogOptionsModel.query(), "testString"); - assertEquals(queryLogOptionsModel.count(), Long.valueOf("10")); - assertEquals(queryLogOptionsModel.offset(), Long.valueOf("26")); - assertEquals(queryLogOptionsModel.sort(), java.util.Arrays.asList("testString")); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryNestedAggregationTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryNestedAggregationTest.java deleted file mode 100644 index 7fa78163ad9..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryNestedAggregationTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryNestedAggregation model. */ -public class QueryNestedAggregationTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryNestedAggregation() throws Throwable { - QueryNestedAggregation queryNestedAggregationModel = new QueryNestedAggregation(); - assertNull(queryNestedAggregationModel.getType()); - assertNull(queryNestedAggregationModel.getPath()); - assertNull(queryNestedAggregationModel.getMatchingResults()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptionsTest.java deleted file mode 100644 index e4368501563..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryNoticesOptionsTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryNoticesOptions model. */ -public class QueryNoticesOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryNoticesOptions() throws Throwable { - QueryNoticesOptions queryNoticesOptionsModel = - new QueryNoticesOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .filter("testString") - .query("testString") - .naturalLanguageQuery("testString") - .passages(true) - .aggregation("testString") - .count(Long.valueOf("10")) - .xReturn(java.util.Arrays.asList("testString")) - .offset(Long.valueOf("26")) - .sort(java.util.Arrays.asList("testString")) - .highlight(false) - .passagesFields(java.util.Arrays.asList("testString")) - .passagesCount(Long.valueOf("10")) - .passagesCharacters(Long.valueOf("400")) - .deduplicateField("testString") - .similar(false) - .similarDocumentIds(java.util.Arrays.asList("testString")) - .similarFields(java.util.Arrays.asList("testString")) - .build(); - assertEquals(queryNoticesOptionsModel.environmentId(), "testString"); - assertEquals(queryNoticesOptionsModel.collectionId(), "testString"); - assertEquals(queryNoticesOptionsModel.filter(), "testString"); - assertEquals(queryNoticesOptionsModel.query(), "testString"); - assertEquals(queryNoticesOptionsModel.naturalLanguageQuery(), "testString"); - assertEquals(queryNoticesOptionsModel.passages(), Boolean.valueOf(true)); - assertEquals(queryNoticesOptionsModel.aggregation(), "testString"); - assertEquals(queryNoticesOptionsModel.count(), Long.valueOf("10")); - assertEquals(queryNoticesOptionsModel.xReturn(), java.util.Arrays.asList("testString")); - assertEquals(queryNoticesOptionsModel.offset(), Long.valueOf("26")); - assertEquals(queryNoticesOptionsModel.sort(), java.util.Arrays.asList("testString")); - assertEquals(queryNoticesOptionsModel.highlight(), Boolean.valueOf(false)); - assertEquals(queryNoticesOptionsModel.passagesFields(), java.util.Arrays.asList("testString")); - assertEquals(queryNoticesOptionsModel.passagesCount(), Long.valueOf("10")); - assertEquals(queryNoticesOptionsModel.passagesCharacters(), Long.valueOf("400")); - assertEquals(queryNoticesOptionsModel.deduplicateField(), "testString"); - assertEquals(queryNoticesOptionsModel.similar(), Boolean.valueOf(false)); - assertEquals( - queryNoticesOptionsModel.similarDocumentIds(), java.util.Arrays.asList("testString")); - assertEquals(queryNoticesOptionsModel.similarFields(), java.util.Arrays.asList("testString")); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testQueryNoticesOptionsError() throws Throwable { - new QueryNoticesOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryNoticesResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryNoticesResponseTest.java deleted file mode 100644 index f22556ec0e6..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryNoticesResponseTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryNoticesResponse model. */ -public class QueryNoticesResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryNoticesResponse() throws Throwable { - QueryNoticesResponse queryNoticesResponseModel = new QueryNoticesResponse(); - assertNull(queryNoticesResponseModel.getMatchingResults()); - assertNull(queryNoticesResponseModel.getResults()); - assertNull(queryNoticesResponseModel.getAggregations()); - assertNull(queryNoticesResponseModel.getPassages()); - assertNull(queryNoticesResponseModel.getDuplicatesRemoved()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryNoticesResultTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryNoticesResultTest.java deleted file mode 100644 index 8d3d190eddc..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryNoticesResultTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryNoticesResult model. */ -public class QueryNoticesResultTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryNoticesResult() throws Throwable { - QueryNoticesResult queryNoticesResultModel = new QueryNoticesResult(); - assertNull(queryNoticesResultModel.getId()); - assertNull(queryNoticesResultModel.getMetadata()); - assertNull(queryNoticesResultModel.getCollectionId()); - assertNull(queryNoticesResultModel.getResultMetadata()); - assertNull(queryNoticesResultModel.getCode()); - assertNull(queryNoticesResultModel.getFilename()); - assertNull(queryNoticesResultModel.getFileType()); - assertNull(queryNoticesResultModel.getSha1()); - assertNull(queryNoticesResultModel.getNotices()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryOptionsTest.java deleted file mode 100644 index bf2a3d93149..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryOptionsTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryOptions model. */ -public class QueryOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryOptions() throws Throwable { - QueryOptions queryOptionsModel = - new QueryOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .filter("testString") - .query("testString") - .naturalLanguageQuery("testString") - .passages(true) - .aggregation("testString") - .count(Long.valueOf("10")) - .xReturn("testString") - .offset(Long.valueOf("26")) - .sort("testString") - .highlight(false) - .passagesFields("testString") - .passagesCount(Long.valueOf("10")) - .passagesCharacters(Long.valueOf("400")) - .deduplicate(false) - .deduplicateField("testString") - .similar(false) - .similarDocumentIds("testString") - .similarFields("testString") - .bias("testString") - .spellingSuggestions(false) - .xWatsonLoggingOptOut(false) - .build(); - assertEquals(queryOptionsModel.environmentId(), "testString"); - assertEquals(queryOptionsModel.collectionId(), "testString"); - assertEquals(queryOptionsModel.filter(), "testString"); - assertEquals(queryOptionsModel.query(), "testString"); - assertEquals(queryOptionsModel.naturalLanguageQuery(), "testString"); - assertEquals(queryOptionsModel.passages(), Boolean.valueOf(true)); - assertEquals(queryOptionsModel.aggregation(), "testString"); - assertEquals(queryOptionsModel.count(), Long.valueOf("10")); - assertEquals(queryOptionsModel.xReturn(), "testString"); - assertEquals(queryOptionsModel.offset(), Long.valueOf("26")); - assertEquals(queryOptionsModel.sort(), "testString"); - assertEquals(queryOptionsModel.highlight(), Boolean.valueOf(false)); - assertEquals(queryOptionsModel.passagesFields(), "testString"); - assertEquals(queryOptionsModel.passagesCount(), Long.valueOf("10")); - assertEquals(queryOptionsModel.passagesCharacters(), Long.valueOf("400")); - assertEquals(queryOptionsModel.deduplicate(), Boolean.valueOf(false)); - assertEquals(queryOptionsModel.deduplicateField(), "testString"); - assertEquals(queryOptionsModel.similar(), Boolean.valueOf(false)); - assertEquals(queryOptionsModel.similarDocumentIds(), "testString"); - assertEquals(queryOptionsModel.similarFields(), "testString"); - assertEquals(queryOptionsModel.bias(), "testString"); - assertEquals(queryOptionsModel.spellingSuggestions(), Boolean.valueOf(false)); - assertEquals(queryOptionsModel.xWatsonLoggingOptOut(), Boolean.valueOf(false)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testQueryOptionsError() throws Throwable { - new QueryOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryPassagesTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryPassagesTest.java deleted file mode 100644 index 62ba7f801e1..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryPassagesTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryPassages model. */ -public class QueryPassagesTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryPassages() throws Throwable { - QueryPassages queryPassagesModel = new QueryPassages(); - assertNull(queryPassagesModel.getDocumentId()); - assertNull(queryPassagesModel.getPassageScore()); - assertNull(queryPassagesModel.getPassageText()); - assertNull(queryPassagesModel.getStartOffset()); - assertNull(queryPassagesModel.getEndOffset()); - assertNull(queryPassagesModel.getField()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryResponseTest.java deleted file mode 100644 index 07ca90ddda4..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryResponseTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryResponse model. */ -public class QueryResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryResponse() throws Throwable { - QueryResponse queryResponseModel = new QueryResponse(); - assertNull(queryResponseModel.getMatchingResults()); - assertNull(queryResponseModel.getResults()); - assertNull(queryResponseModel.getAggregations()); - assertNull(queryResponseModel.getPassages()); - assertNull(queryResponseModel.getDuplicatesRemoved()); - assertNull(queryResponseModel.getSessionToken()); - assertNull(queryResponseModel.getRetrievalDetails()); - assertNull(queryResponseModel.getSuggestedQuery()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryResultMetadataTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryResultMetadataTest.java deleted file mode 100644 index fd9230b5283..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryResultMetadataTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryResultMetadata model. */ -public class QueryResultMetadataTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryResultMetadata() throws Throwable { - QueryResultMetadata queryResultMetadataModel = new QueryResultMetadata(); - assertNull(queryResultMetadataModel.getScore()); - assertNull(queryResultMetadataModel.getConfidence()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryResultTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryResultTest.java deleted file mode 100644 index 11b72ce56b9..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryResultTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryResult model. */ -public class QueryResultTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryResult() throws Throwable { - QueryResult queryResultModel = new QueryResult(); - assertNull(queryResultModel.getId()); - assertNull(queryResultModel.getMetadata()); - assertNull(queryResultModel.getCollectionId()); - assertNull(queryResultModel.getResultMetadata()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTermAggregationResultTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTermAggregationResultTest.java deleted file mode 100644 index d0e9c3f5d83..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTermAggregationResultTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryTermAggregationResult model. */ -public class QueryTermAggregationResultTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryTermAggregationResult() throws Throwable { - QueryTermAggregationResult queryTermAggregationResultModel = new QueryTermAggregationResult(); - assertNull(queryTermAggregationResultModel.getKey()); - assertNull(queryTermAggregationResultModel.getMatchingResults()); - assertNull(queryTermAggregationResultModel.getRelevancy()); - assertNull(queryTermAggregationResultModel.getTotalMatchingDocuments()); - assertNull(queryTermAggregationResultModel.getEstimatedMatchingDocuments()); - assertNull(queryTermAggregationResultModel.getAggregations()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTermAggregationTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTermAggregationTest.java deleted file mode 100644 index ecb524ff51f..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTermAggregationTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryTermAggregation model. */ -public class QueryTermAggregationTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryTermAggregation() throws Throwable { - QueryTermAggregation queryTermAggregationModel = new QueryTermAggregation(); - assertNull(queryTermAggregationModel.getType()); - assertNull(queryTermAggregationModel.getField()); - assertNull(queryTermAggregationModel.getCount()); - assertNull(queryTermAggregationModel.getName()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTimesliceAggregationResultTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTimesliceAggregationResultTest.java deleted file mode 100644 index ee0b0a778d8..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTimesliceAggregationResultTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryTimesliceAggregationResult model. */ -public class QueryTimesliceAggregationResultTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryTimesliceAggregationResult() throws Throwable { - QueryTimesliceAggregationResult queryTimesliceAggregationResultModel = - new QueryTimesliceAggregationResult(); - assertNull(queryTimesliceAggregationResultModel.getKeyAsString()); - assertNull(queryTimesliceAggregationResultModel.getKey()); - assertNull(queryTimesliceAggregationResultModel.getMatchingResults()); - assertNull(queryTimesliceAggregationResultModel.getAggregations()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTimesliceAggregationTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTimesliceAggregationTest.java deleted file mode 100644 index f485db48ef0..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTimesliceAggregationTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryTimesliceAggregation model. */ -public class QueryTimesliceAggregationTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryTimesliceAggregation() throws Throwable { - QueryTimesliceAggregation queryTimesliceAggregationModel = new QueryTimesliceAggregation(); - assertNull(queryTimesliceAggregationModel.getType()); - assertNull(queryTimesliceAggregationModel.getField()); - assertNull(queryTimesliceAggregationModel.getInterval()); - assertNull(queryTimesliceAggregationModel.getName()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTopHitsAggregationResultTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTopHitsAggregationResultTest.java deleted file mode 100644 index 7d9ba8d6243..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTopHitsAggregationResultTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryTopHitsAggregationResult model. */ -public class QueryTopHitsAggregationResultTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryTopHitsAggregationResult() throws Throwable { - QueryTopHitsAggregationResult queryTopHitsAggregationResultModel = - new QueryTopHitsAggregationResult(); - assertNull(queryTopHitsAggregationResultModel.getMatchingResults()); - assertNull(queryTopHitsAggregationResultModel.getHits()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTopHitsAggregationTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTopHitsAggregationTest.java deleted file mode 100644 index 4917969d86c..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/QueryTopHitsAggregationTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the QueryTopHitsAggregation model. */ -public class QueryTopHitsAggregationTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testQueryTopHitsAggregation() throws Throwable { - QueryTopHitsAggregation queryTopHitsAggregationModel = new QueryTopHitsAggregation(); - assertNull(queryTopHitsAggregationModel.getType()); - assertNull(queryTopHitsAggregationModel.getSize()); - assertNull(queryTopHitsAggregationModel.getName()); - assertNull(queryTopHitsAggregationModel.getHits()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/RetrievalDetailsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/RetrievalDetailsTest.java deleted file mode 100644 index b330baa87b7..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/RetrievalDetailsTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the RetrievalDetails model. */ -public class RetrievalDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testRetrievalDetails() throws Throwable { - RetrievalDetails retrievalDetailsModel = new RetrievalDetails(); - assertNull(retrievalDetailsModel.getDocumentRetrievalStrategy()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SduStatusCustomFieldsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SduStatusCustomFieldsTest.java deleted file mode 100644 index 449ad4b31bb..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SduStatusCustomFieldsTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the SduStatusCustomFields model. */ -public class SduStatusCustomFieldsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSduStatusCustomFields() throws Throwable { - SduStatusCustomFields sduStatusCustomFieldsModel = new SduStatusCustomFields(); - assertNull(sduStatusCustomFieldsModel.getDefined()); - assertNull(sduStatusCustomFieldsModel.getMaximumAllowed()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SduStatusTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SduStatusTest.java deleted file mode 100644 index 2dc022fa53f..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SduStatusTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the SduStatus model. */ -public class SduStatusTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSduStatus() throws Throwable { - SduStatus sduStatusModel = new SduStatus(); - assertNull(sduStatusModel.isEnabled()); - assertNull(sduStatusModel.getTotalAnnotatedPages()); - assertNull(sduStatusModel.getTotalPages()); - assertNull(sduStatusModel.getTotalDocuments()); - assertNull(sduStatusModel.getCustomFields()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SearchStatusTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SearchStatusTest.java deleted file mode 100644 index 557c077f5e9..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SearchStatusTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the SearchStatus model. */ -public class SearchStatusTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSearchStatus() throws Throwable { - SearchStatus searchStatusModel = new SearchStatus(); - assertNull(searchStatusModel.getScope()); - assertNull(searchStatusModel.getStatus()); - assertNull(searchStatusModel.getStatusDescription()); - assertNull(searchStatusModel.getLastTrained()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SegmentSettingsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SegmentSettingsTest.java deleted file mode 100644 index ac444654aae..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SegmentSettingsTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the SegmentSettings model. */ -public class SegmentSettingsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSegmentSettings() throws Throwable { - SegmentSettings segmentSettingsModel = - new SegmentSettings.Builder() - .enabled(false) - .selectorTags(java.util.Arrays.asList("h1", "h2")) - .annotatedFields(java.util.Arrays.asList("testString")) - .build(); - assertEquals(segmentSettingsModel.enabled(), Boolean.valueOf(false)); - assertEquals(segmentSettingsModel.selectorTags(), java.util.Arrays.asList("h1", "h2")); - assertEquals(segmentSettingsModel.annotatedFields(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(segmentSettingsModel); - - SegmentSettings segmentSettingsModelNew = - TestUtilities.deserialize(json, SegmentSettings.class); - assertTrue(segmentSettingsModelNew instanceof SegmentSettings); - assertEquals(segmentSettingsModelNew.enabled(), Boolean.valueOf(false)); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsBucketsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsBucketsTest.java deleted file mode 100644 index bcd8445aa7d..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsBucketsTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the SourceOptionsBuckets model. */ -public class SourceOptionsBucketsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSourceOptionsBuckets() throws Throwable { - SourceOptionsBuckets sourceOptionsBucketsModel = - new SourceOptionsBuckets.Builder().name("testString").limit(Long.valueOf("26")).build(); - assertEquals(sourceOptionsBucketsModel.name(), "testString"); - assertEquals(sourceOptionsBucketsModel.limit(), Long.valueOf("26")); - - String json = TestUtilities.serialize(sourceOptionsBucketsModel); - - SourceOptionsBuckets sourceOptionsBucketsModelNew = - TestUtilities.deserialize(json, SourceOptionsBuckets.class); - assertTrue(sourceOptionsBucketsModelNew instanceof SourceOptionsBuckets); - assertEquals(sourceOptionsBucketsModelNew.name(), "testString"); - assertEquals(sourceOptionsBucketsModelNew.limit(), Long.valueOf("26")); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testSourceOptionsBucketsError() throws Throwable { - new SourceOptionsBuckets.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsFolderTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsFolderTest.java deleted file mode 100644 index c8a7b2aa599..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsFolderTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the SourceOptionsFolder model. */ -public class SourceOptionsFolderTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSourceOptionsFolder() throws Throwable { - SourceOptionsFolder sourceOptionsFolderModel = - new SourceOptionsFolder.Builder() - .ownerUserId("testString") - .folderId("testString") - .limit(Long.valueOf("26")) - .build(); - assertEquals(sourceOptionsFolderModel.ownerUserId(), "testString"); - assertEquals(sourceOptionsFolderModel.folderId(), "testString"); - assertEquals(sourceOptionsFolderModel.limit(), Long.valueOf("26")); - - String json = TestUtilities.serialize(sourceOptionsFolderModel); - - SourceOptionsFolder sourceOptionsFolderModelNew = - TestUtilities.deserialize(json, SourceOptionsFolder.class); - assertTrue(sourceOptionsFolderModelNew instanceof SourceOptionsFolder); - assertEquals(sourceOptionsFolderModelNew.ownerUserId(), "testString"); - assertEquals(sourceOptionsFolderModelNew.folderId(), "testString"); - assertEquals(sourceOptionsFolderModelNew.limit(), Long.valueOf("26")); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testSourceOptionsFolderError() throws Throwable { - new SourceOptionsFolder.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsObjectTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsObjectTest.java deleted file mode 100644 index b3c12a7d9aa..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsObjectTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the SourceOptionsObject model. */ -public class SourceOptionsObjectTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSourceOptionsObject() throws Throwable { - SourceOptionsObject sourceOptionsObjectModel = - new SourceOptionsObject.Builder().name("testString").limit(Long.valueOf("26")).build(); - assertEquals(sourceOptionsObjectModel.name(), "testString"); - assertEquals(sourceOptionsObjectModel.limit(), Long.valueOf("26")); - - String json = TestUtilities.serialize(sourceOptionsObjectModel); - - SourceOptionsObject sourceOptionsObjectModelNew = - TestUtilities.deserialize(json, SourceOptionsObject.class); - assertTrue(sourceOptionsObjectModelNew instanceof SourceOptionsObject); - assertEquals(sourceOptionsObjectModelNew.name(), "testString"); - assertEquals(sourceOptionsObjectModelNew.limit(), Long.valueOf("26")); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testSourceOptionsObjectError() throws Throwable { - new SourceOptionsObject.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsSiteCollTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsSiteCollTest.java deleted file mode 100644 index 1316e7b5372..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsSiteCollTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the SourceOptionsSiteColl model. */ -public class SourceOptionsSiteCollTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSourceOptionsSiteColl() throws Throwable { - SourceOptionsSiteColl sourceOptionsSiteCollModel = - new SourceOptionsSiteColl.Builder() - .siteCollectionPath("testString") - .limit(Long.valueOf("26")) - .build(); - assertEquals(sourceOptionsSiteCollModel.siteCollectionPath(), "testString"); - assertEquals(sourceOptionsSiteCollModel.limit(), Long.valueOf("26")); - - String json = TestUtilities.serialize(sourceOptionsSiteCollModel); - - SourceOptionsSiteColl sourceOptionsSiteCollModelNew = - TestUtilities.deserialize(json, SourceOptionsSiteColl.class); - assertTrue(sourceOptionsSiteCollModelNew instanceof SourceOptionsSiteColl); - assertEquals(sourceOptionsSiteCollModelNew.siteCollectionPath(), "testString"); - assertEquals(sourceOptionsSiteCollModelNew.limit(), Long.valueOf("26")); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testSourceOptionsSiteCollError() throws Throwable { - new SourceOptionsSiteColl.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsTest.java deleted file mode 100644 index 9a19a304315..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the SourceOptions model. */ -public class SourceOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSourceOptions() throws Throwable { - SourceOptionsFolder sourceOptionsFolderModel = - new SourceOptionsFolder.Builder() - .ownerUserId("testString") - .folderId("testString") - .limit(Long.valueOf("26")) - .build(); - assertEquals(sourceOptionsFolderModel.ownerUserId(), "testString"); - assertEquals(sourceOptionsFolderModel.folderId(), "testString"); - assertEquals(sourceOptionsFolderModel.limit(), Long.valueOf("26")); - - SourceOptionsObject sourceOptionsObjectModel = - new SourceOptionsObject.Builder().name("testString").limit(Long.valueOf("26")).build(); - assertEquals(sourceOptionsObjectModel.name(), "testString"); - assertEquals(sourceOptionsObjectModel.limit(), Long.valueOf("26")); - - SourceOptionsSiteColl sourceOptionsSiteCollModel = - new SourceOptionsSiteColl.Builder() - .siteCollectionPath("testString") - .limit(Long.valueOf("26")) - .build(); - assertEquals(sourceOptionsSiteCollModel.siteCollectionPath(), "testString"); - assertEquals(sourceOptionsSiteCollModel.limit(), Long.valueOf("26")); - - SourceOptionsWebCrawl sourceOptionsWebCrawlModel = - new SourceOptionsWebCrawl.Builder() - .url("testString") - .limitToStartingHosts(true) - .crawlSpeed("normal") - .allowUntrustedCertificate(false) - .maximumHops(Long.valueOf("2")) - .requestTimeout(Long.valueOf("30000")) - .overrideRobotsTxt(false) - .blacklist(java.util.Arrays.asList("testString")) - .build(); - assertEquals(sourceOptionsWebCrawlModel.url(), "testString"); - assertEquals(sourceOptionsWebCrawlModel.limitToStartingHosts(), Boolean.valueOf(true)); - assertEquals(sourceOptionsWebCrawlModel.crawlSpeed(), "normal"); - assertEquals(sourceOptionsWebCrawlModel.allowUntrustedCertificate(), Boolean.valueOf(false)); - assertEquals(sourceOptionsWebCrawlModel.maximumHops(), Long.valueOf("2")); - assertEquals(sourceOptionsWebCrawlModel.requestTimeout(), Long.valueOf("30000")); - assertEquals(sourceOptionsWebCrawlModel.overrideRobotsTxt(), Boolean.valueOf(false)); - assertEquals(sourceOptionsWebCrawlModel.blacklist(), java.util.Arrays.asList("testString")); - - SourceOptionsBuckets sourceOptionsBucketsModel = - new SourceOptionsBuckets.Builder().name("testString").limit(Long.valueOf("26")).build(); - assertEquals(sourceOptionsBucketsModel.name(), "testString"); - assertEquals(sourceOptionsBucketsModel.limit(), Long.valueOf("26")); - - SourceOptions sourceOptionsModel = - new SourceOptions.Builder() - .folders(java.util.Arrays.asList(sourceOptionsFolderModel)) - .objects(java.util.Arrays.asList(sourceOptionsObjectModel)) - .siteCollections(java.util.Arrays.asList(sourceOptionsSiteCollModel)) - .urls(java.util.Arrays.asList(sourceOptionsWebCrawlModel)) - .buckets(java.util.Arrays.asList(sourceOptionsBucketsModel)) - .crawlAllBuckets(true) - .build(); - assertEquals(sourceOptionsModel.folders(), java.util.Arrays.asList(sourceOptionsFolderModel)); - assertEquals(sourceOptionsModel.objects(), java.util.Arrays.asList(sourceOptionsObjectModel)); - assertEquals( - sourceOptionsModel.siteCollections(), java.util.Arrays.asList(sourceOptionsSiteCollModel)); - assertEquals(sourceOptionsModel.urls(), java.util.Arrays.asList(sourceOptionsWebCrawlModel)); - assertEquals(sourceOptionsModel.buckets(), java.util.Arrays.asList(sourceOptionsBucketsModel)); - assertEquals(sourceOptionsModel.crawlAllBuckets(), Boolean.valueOf(true)); - - String json = TestUtilities.serialize(sourceOptionsModel); - - SourceOptions sourceOptionsModelNew = TestUtilities.deserialize(json, SourceOptions.class); - assertTrue(sourceOptionsModelNew instanceof SourceOptions); - assertEquals(sourceOptionsModelNew.crawlAllBuckets(), Boolean.valueOf(true)); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsWebCrawlTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsWebCrawlTest.java deleted file mode 100644 index 8c094565eb9..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceOptionsWebCrawlTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the SourceOptionsWebCrawl model. */ -public class SourceOptionsWebCrawlTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSourceOptionsWebCrawl() throws Throwable { - SourceOptionsWebCrawl sourceOptionsWebCrawlModel = - new SourceOptionsWebCrawl.Builder() - .url("testString") - .limitToStartingHosts(true) - .crawlSpeed("normal") - .allowUntrustedCertificate(false) - .maximumHops(Long.valueOf("2")) - .requestTimeout(Long.valueOf("30000")) - .overrideRobotsTxt(false) - .blacklist(java.util.Arrays.asList("testString")) - .build(); - assertEquals(sourceOptionsWebCrawlModel.url(), "testString"); - assertEquals(sourceOptionsWebCrawlModel.limitToStartingHosts(), Boolean.valueOf(true)); - assertEquals(sourceOptionsWebCrawlModel.crawlSpeed(), "normal"); - assertEquals(sourceOptionsWebCrawlModel.allowUntrustedCertificate(), Boolean.valueOf(false)); - assertEquals(sourceOptionsWebCrawlModel.maximumHops(), Long.valueOf("2")); - assertEquals(sourceOptionsWebCrawlModel.requestTimeout(), Long.valueOf("30000")); - assertEquals(sourceOptionsWebCrawlModel.overrideRobotsTxt(), Boolean.valueOf(false)); - assertEquals(sourceOptionsWebCrawlModel.blacklist(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(sourceOptionsWebCrawlModel); - - SourceOptionsWebCrawl sourceOptionsWebCrawlModelNew = - TestUtilities.deserialize(json, SourceOptionsWebCrawl.class); - assertTrue(sourceOptionsWebCrawlModelNew instanceof SourceOptionsWebCrawl); - assertEquals(sourceOptionsWebCrawlModelNew.url(), "testString"); - assertEquals(sourceOptionsWebCrawlModelNew.limitToStartingHosts(), Boolean.valueOf(true)); - assertEquals(sourceOptionsWebCrawlModelNew.crawlSpeed(), "normal"); - assertEquals(sourceOptionsWebCrawlModelNew.allowUntrustedCertificate(), Boolean.valueOf(false)); - assertEquals(sourceOptionsWebCrawlModelNew.maximumHops(), Long.valueOf("2")); - assertEquals(sourceOptionsWebCrawlModelNew.requestTimeout(), Long.valueOf("30000")); - assertEquals(sourceOptionsWebCrawlModelNew.overrideRobotsTxt(), Boolean.valueOf(false)); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testSourceOptionsWebCrawlError() throws Throwable { - new SourceOptionsWebCrawl.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceScheduleTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceScheduleTest.java deleted file mode 100644 index 889bde8bb80..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceScheduleTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the SourceSchedule model. */ -public class SourceScheduleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSourceSchedule() throws Throwable { - SourceSchedule sourceScheduleModel = - new SourceSchedule.Builder() - .enabled(true) - .timeZone("America/New_York") - .frequency("daily") - .build(); - assertEquals(sourceScheduleModel.enabled(), Boolean.valueOf(true)); - assertEquals(sourceScheduleModel.timeZone(), "America/New_York"); - assertEquals(sourceScheduleModel.frequency(), "daily"); - - String json = TestUtilities.serialize(sourceScheduleModel); - - SourceSchedule sourceScheduleModelNew = TestUtilities.deserialize(json, SourceSchedule.class); - assertTrue(sourceScheduleModelNew instanceof SourceSchedule); - assertEquals(sourceScheduleModelNew.enabled(), Boolean.valueOf(true)); - assertEquals(sourceScheduleModelNew.timeZone(), "America/New_York"); - assertEquals(sourceScheduleModelNew.frequency(), "daily"); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceStatusTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceStatusTest.java deleted file mode 100644 index 307714a701c..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceStatusTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the SourceStatus model. */ -public class SourceStatusTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSourceStatus() throws Throwable { - SourceStatus sourceStatusModel = new SourceStatus(); - assertNull(sourceStatusModel.getStatus()); - assertNull(sourceStatusModel.getNextCrawl()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceTest.java deleted file mode 100644 index 082e1f2df68..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/SourceTest.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the Source model. */ -public class SourceTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testSource() throws Throwable { - SourceSchedule sourceScheduleModel = - new SourceSchedule.Builder() - .enabled(true) - .timeZone("America/New_York") - .frequency("daily") - .build(); - assertEquals(sourceScheduleModel.enabled(), Boolean.valueOf(true)); - assertEquals(sourceScheduleModel.timeZone(), "America/New_York"); - assertEquals(sourceScheduleModel.frequency(), "daily"); - - SourceOptionsFolder sourceOptionsFolderModel = - new SourceOptionsFolder.Builder() - .ownerUserId("testString") - .folderId("testString") - .limit(Long.valueOf("26")) - .build(); - assertEquals(sourceOptionsFolderModel.ownerUserId(), "testString"); - assertEquals(sourceOptionsFolderModel.folderId(), "testString"); - assertEquals(sourceOptionsFolderModel.limit(), Long.valueOf("26")); - - SourceOptionsObject sourceOptionsObjectModel = - new SourceOptionsObject.Builder().name("testString").limit(Long.valueOf("26")).build(); - assertEquals(sourceOptionsObjectModel.name(), "testString"); - assertEquals(sourceOptionsObjectModel.limit(), Long.valueOf("26")); - - SourceOptionsSiteColl sourceOptionsSiteCollModel = - new SourceOptionsSiteColl.Builder() - .siteCollectionPath("testString") - .limit(Long.valueOf("26")) - .build(); - assertEquals(sourceOptionsSiteCollModel.siteCollectionPath(), "testString"); - assertEquals(sourceOptionsSiteCollModel.limit(), Long.valueOf("26")); - - SourceOptionsWebCrawl sourceOptionsWebCrawlModel = - new SourceOptionsWebCrawl.Builder() - .url("testString") - .limitToStartingHosts(true) - .crawlSpeed("normal") - .allowUntrustedCertificate(false) - .maximumHops(Long.valueOf("2")) - .requestTimeout(Long.valueOf("30000")) - .overrideRobotsTxt(false) - .blacklist(java.util.Arrays.asList("testString")) - .build(); - assertEquals(sourceOptionsWebCrawlModel.url(), "testString"); - assertEquals(sourceOptionsWebCrawlModel.limitToStartingHosts(), Boolean.valueOf(true)); - assertEquals(sourceOptionsWebCrawlModel.crawlSpeed(), "normal"); - assertEquals(sourceOptionsWebCrawlModel.allowUntrustedCertificate(), Boolean.valueOf(false)); - assertEquals(sourceOptionsWebCrawlModel.maximumHops(), Long.valueOf("2")); - assertEquals(sourceOptionsWebCrawlModel.requestTimeout(), Long.valueOf("30000")); - assertEquals(sourceOptionsWebCrawlModel.overrideRobotsTxt(), Boolean.valueOf(false)); - assertEquals(sourceOptionsWebCrawlModel.blacklist(), java.util.Arrays.asList("testString")); - - SourceOptionsBuckets sourceOptionsBucketsModel = - new SourceOptionsBuckets.Builder().name("testString").limit(Long.valueOf("26")).build(); - assertEquals(sourceOptionsBucketsModel.name(), "testString"); - assertEquals(sourceOptionsBucketsModel.limit(), Long.valueOf("26")); - - SourceOptions sourceOptionsModel = - new SourceOptions.Builder() - .folders(java.util.Arrays.asList(sourceOptionsFolderModel)) - .objects(java.util.Arrays.asList(sourceOptionsObjectModel)) - .siteCollections(java.util.Arrays.asList(sourceOptionsSiteCollModel)) - .urls(java.util.Arrays.asList(sourceOptionsWebCrawlModel)) - .buckets(java.util.Arrays.asList(sourceOptionsBucketsModel)) - .crawlAllBuckets(true) - .build(); - assertEquals(sourceOptionsModel.folders(), java.util.Arrays.asList(sourceOptionsFolderModel)); - assertEquals(sourceOptionsModel.objects(), java.util.Arrays.asList(sourceOptionsObjectModel)); - assertEquals( - sourceOptionsModel.siteCollections(), java.util.Arrays.asList(sourceOptionsSiteCollModel)); - assertEquals(sourceOptionsModel.urls(), java.util.Arrays.asList(sourceOptionsWebCrawlModel)); - assertEquals(sourceOptionsModel.buckets(), java.util.Arrays.asList(sourceOptionsBucketsModel)); - assertEquals(sourceOptionsModel.crawlAllBuckets(), Boolean.valueOf(true)); - - Source sourceModel = - new Source.Builder() - .type("box") - .credentialId("testString") - .schedule(sourceScheduleModel) - .options(sourceOptionsModel) - .build(); - assertEquals(sourceModel.type(), "box"); - assertEquals(sourceModel.credentialId(), "testString"); - assertEquals(sourceModel.schedule(), sourceScheduleModel); - assertEquals(sourceModel.options(), sourceOptionsModel); - - String json = TestUtilities.serialize(sourceModel); - - Source sourceModelNew = TestUtilities.deserialize(json, Source.class); - assertTrue(sourceModelNew instanceof Source); - assertEquals(sourceModelNew.type(), "box"); - assertEquals(sourceModelNew.credentialId(), "testString"); - assertEquals(sourceModelNew.schedule().toString(), sourceScheduleModel.toString()); - assertEquals(sourceModelNew.options().toString(), sourceOptionsModel.toString()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/StatusDetailsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/StatusDetailsTest.java deleted file mode 100644 index 8f811af355c..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/StatusDetailsTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the StatusDetails model. */ -public class StatusDetailsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testStatusDetails() throws Throwable { - StatusDetails statusDetailsModel = - new StatusDetails.Builder().authenticated(true).errorMessage("testString").build(); - assertEquals(statusDetailsModel.authenticated(), Boolean.valueOf(true)); - assertEquals(statusDetailsModel.errorMessage(), "testString"); - - String json = TestUtilities.serialize(statusDetailsModel); - - StatusDetails statusDetailsModelNew = TestUtilities.deserialize(json, StatusDetails.class); - assertTrue(statusDetailsModelNew instanceof StatusDetails); - assertEquals(statusDetailsModelNew.authenticated(), Boolean.valueOf(true)); - assertEquals(statusDetailsModelNew.errorMessage(), "testString"); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TokenDictRuleTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TokenDictRuleTest.java deleted file mode 100644 index 882706f1931..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TokenDictRuleTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the TokenDictRule model. */ -public class TokenDictRuleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTokenDictRule() throws Throwable { - TokenDictRule tokenDictRuleModel = - new TokenDictRule.Builder() - .text("testString") - .tokens(java.util.Arrays.asList("testString")) - .readings(java.util.Arrays.asList("testString")) - .partOfSpeech("testString") - .build(); - assertEquals(tokenDictRuleModel.text(), "testString"); - assertEquals(tokenDictRuleModel.tokens(), java.util.Arrays.asList("testString")); - assertEquals(tokenDictRuleModel.readings(), java.util.Arrays.asList("testString")); - assertEquals(tokenDictRuleModel.partOfSpeech(), "testString"); - - String json = TestUtilities.serialize(tokenDictRuleModel); - - TokenDictRule tokenDictRuleModelNew = TestUtilities.deserialize(json, TokenDictRule.class); - assertTrue(tokenDictRuleModelNew instanceof TokenDictRule); - assertEquals(tokenDictRuleModelNew.text(), "testString"); - assertEquals(tokenDictRuleModelNew.partOfSpeech(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testTokenDictRuleError() throws Throwable { - new TokenDictRule.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TokenDictStatusResponseTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TokenDictStatusResponseTest.java deleted file mode 100644 index 7243225b393..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TokenDictStatusResponseTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the TokenDictStatusResponse model. */ -public class TokenDictStatusResponseTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTokenDictStatusResponse() throws Throwable { - TokenDictStatusResponse tokenDictStatusResponseModel = new TokenDictStatusResponse(); - assertNull(tokenDictStatusResponseModel.getStatus()); - assertNull(tokenDictStatusResponseModel.getType()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TopHitsResultsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TopHitsResultsTest.java deleted file mode 100644 index 7495172a3af..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TopHitsResultsTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the TopHitsResults model. */ -public class TopHitsResultsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTopHitsResults() throws Throwable { - TopHitsResults topHitsResultsModel = new TopHitsResults(); - assertNull(topHitsResultsModel.getMatchingResults()); - assertNull(topHitsResultsModel.getHits()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingDataSetTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingDataSetTest.java deleted file mode 100644 index e21cbe3bff3..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingDataSetTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the TrainingDataSet model. */ -public class TrainingDataSetTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTrainingDataSet() throws Throwable { - TrainingDataSet trainingDataSetModel = new TrainingDataSet(); - assertNull(trainingDataSetModel.getEnvironmentId()); - assertNull(trainingDataSetModel.getCollectionId()); - assertNull(trainingDataSetModel.getQueries()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingExampleListTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingExampleListTest.java deleted file mode 100644 index 6ac589a45d8..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingExampleListTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the TrainingExampleList model. */ -public class TrainingExampleListTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTrainingExampleList() throws Throwable { - TrainingExampleList trainingExampleListModel = new TrainingExampleList(); - assertNull(trainingExampleListModel.getExamples()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingExampleTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingExampleTest.java deleted file mode 100644 index bf6456ad7dc..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingExampleTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the TrainingExample model. */ -public class TrainingExampleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTrainingExample() throws Throwable { - TrainingExample trainingExampleModel = - new TrainingExample.Builder() - .documentId("testString") - .crossReference("testString") - .relevance(Long.valueOf("26")) - .build(); - assertEquals(trainingExampleModel.documentId(), "testString"); - assertEquals(trainingExampleModel.crossReference(), "testString"); - assertEquals(trainingExampleModel.relevance(), Long.valueOf("26")); - - String json = TestUtilities.serialize(trainingExampleModel); - - TrainingExample trainingExampleModelNew = - TestUtilities.deserialize(json, TrainingExample.class); - assertTrue(trainingExampleModelNew instanceof TrainingExample); - assertEquals(trainingExampleModelNew.documentId(), "testString"); - assertEquals(trainingExampleModelNew.crossReference(), "testString"); - assertEquals(trainingExampleModelNew.relevance(), Long.valueOf("26")); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingQueryTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingQueryTest.java deleted file mode 100644 index 231000a0d3a..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingQueryTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the TrainingQuery model. */ -public class TrainingQueryTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTrainingQuery() throws Throwable { - TrainingQuery trainingQueryModel = new TrainingQuery(); - assertNull(trainingQueryModel.getQueryId()); - assertNull(trainingQueryModel.getNaturalLanguageQuery()); - assertNull(trainingQueryModel.getFilter()); - assertNull(trainingQueryModel.getExamples()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingStatusTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingStatusTest.java deleted file mode 100644 index e21cb3199b3..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/TrainingStatusTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the TrainingStatus model. */ -public class TrainingStatusTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testTrainingStatus() throws Throwable { - TrainingStatus trainingStatusModel = new TrainingStatus(); - assertNull(trainingStatusModel.getTotalExamples()); - assertNull(trainingStatusModel.isAvailable()); - assertNull(trainingStatusModel.isProcessing()); - assertNull(trainingStatusModel.isMinimumQueriesAdded()); - assertNull(trainingStatusModel.isMinimumExamplesAdded()); - assertNull(trainingStatusModel.isSufficientLabelDiversity()); - assertNull(trainingStatusModel.getNotices()); - assertNull(trainingStatusModel.getSuccessfullyTrained()); - assertNull(trainingStatusModel.getDataUpdated()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateCollectionOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateCollectionOptionsTest.java deleted file mode 100644 index 8c3e814df61..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateCollectionOptionsTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the UpdateCollectionOptions model. */ -public class UpdateCollectionOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateCollectionOptions() throws Throwable { - UpdateCollectionOptions updateCollectionOptionsModel = - new UpdateCollectionOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .name("testString") - .description("testString") - .configurationId("testString") - .build(); - assertEquals(updateCollectionOptionsModel.environmentId(), "testString"); - assertEquals(updateCollectionOptionsModel.collectionId(), "testString"); - assertEquals(updateCollectionOptionsModel.name(), "testString"); - assertEquals(updateCollectionOptionsModel.description(), "testString"); - assertEquals(updateCollectionOptionsModel.configurationId(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateCollectionOptionsError() throws Throwable { - new UpdateCollectionOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateConfigurationOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateConfigurationOptionsTest.java deleted file mode 100644 index e9b78a414bd..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateConfigurationOptionsTest.java +++ /dev/null @@ -1,362 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the UpdateConfigurationOptions model. */ -public class UpdateConfigurationOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateConfigurationOptions() throws Throwable { - FontSetting fontSettingModel = - new FontSetting.Builder() - .level(Long.valueOf("26")) - .minSize(Long.valueOf("26")) - .maxSize(Long.valueOf("26")) - .bold(true) - .italic(true) - .name("testString") - .build(); - assertEquals(fontSettingModel.level(), Long.valueOf("26")); - assertEquals(fontSettingModel.minSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.maxSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.bold(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.italic(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.name(), "testString"); - - PdfHeadingDetection pdfHeadingDetectionModel = - new PdfHeadingDetection.Builder().fonts(java.util.Arrays.asList(fontSettingModel)).build(); - assertEquals(pdfHeadingDetectionModel.fonts(), java.util.Arrays.asList(fontSettingModel)); - - PdfSettings pdfSettingsModel = - new PdfSettings.Builder().heading(pdfHeadingDetectionModel).build(); - assertEquals(pdfSettingsModel.heading(), pdfHeadingDetectionModel); - - WordStyle wordStyleModel = - new WordStyle.Builder() - .level(Long.valueOf("26")) - .names(java.util.Arrays.asList("testString")) - .build(); - assertEquals(wordStyleModel.level(), Long.valueOf("26")); - assertEquals(wordStyleModel.names(), java.util.Arrays.asList("testString")); - - WordHeadingDetection wordHeadingDetectionModel = - new WordHeadingDetection.Builder() - .fonts(java.util.Arrays.asList(fontSettingModel)) - .styles(java.util.Arrays.asList(wordStyleModel)) - .build(); - assertEquals(wordHeadingDetectionModel.fonts(), java.util.Arrays.asList(fontSettingModel)); - assertEquals(wordHeadingDetectionModel.styles(), java.util.Arrays.asList(wordStyleModel)); - - WordSettings wordSettingsModel = - new WordSettings.Builder().heading(wordHeadingDetectionModel).build(); - assertEquals(wordSettingsModel.heading(), wordHeadingDetectionModel); - - XPathPatterns xPathPatternsModel = - new XPathPatterns.Builder().xpaths(java.util.Arrays.asList("testString")).build(); - assertEquals(xPathPatternsModel.xpaths(), java.util.Arrays.asList("testString")); - - HtmlSettings htmlSettingsModel = - new HtmlSettings.Builder() - .excludeTagsCompletely(java.util.Arrays.asList("testString")) - .excludeTagsKeepContent(java.util.Arrays.asList("testString")) - .keepContent(xPathPatternsModel) - .excludeContent(xPathPatternsModel) - .keepTagAttributes(java.util.Arrays.asList("testString")) - .excludeTagAttributes(java.util.Arrays.asList("testString")) - .build(); - assertEquals(htmlSettingsModel.excludeTagsCompletely(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.excludeTagsKeepContent(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.keepContent(), xPathPatternsModel); - assertEquals(htmlSettingsModel.excludeContent(), xPathPatternsModel); - assertEquals(htmlSettingsModel.keepTagAttributes(), java.util.Arrays.asList("testString")); - assertEquals(htmlSettingsModel.excludeTagAttributes(), java.util.Arrays.asList("testString")); - - SegmentSettings segmentSettingsModel = - new SegmentSettings.Builder() - .enabled(false) - .selectorTags(java.util.Arrays.asList("h1", "h2")) - .annotatedFields(java.util.Arrays.asList("testString")) - .build(); - assertEquals(segmentSettingsModel.enabled(), Boolean.valueOf(false)); - assertEquals(segmentSettingsModel.selectorTags(), java.util.Arrays.asList("h1", "h2")); - assertEquals(segmentSettingsModel.annotatedFields(), java.util.Arrays.asList("testString")); - - NormalizationOperation normalizationOperationModel = - new NormalizationOperation.Builder() - .operation("copy") - .sourceField("testString") - .destinationField("testString") - .build(); - assertEquals(normalizationOperationModel.operation(), "copy"); - assertEquals(normalizationOperationModel.sourceField(), "testString"); - assertEquals(normalizationOperationModel.destinationField(), "testString"); - - Conversions conversionsModel = - new Conversions.Builder() - .pdf(pdfSettingsModel) - .word(wordSettingsModel) - .html(htmlSettingsModel) - .segment(segmentSettingsModel) - .jsonNormalizations(java.util.Arrays.asList(normalizationOperationModel)) - .imageTextRecognition(true) - .build(); - assertEquals(conversionsModel.pdf(), pdfSettingsModel); - assertEquals(conversionsModel.word(), wordSettingsModel); - assertEquals(conversionsModel.html(), htmlSettingsModel); - assertEquals(conversionsModel.segment(), segmentSettingsModel); - assertEquals( - conversionsModel.jsonNormalizations(), - java.util.Arrays.asList(normalizationOperationModel)); - assertEquals(conversionsModel.imageTextRecognition(), Boolean.valueOf(true)); - - NluEnrichmentKeywords nluEnrichmentKeywordsModel = - new NluEnrichmentKeywords.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .build(); - assertEquals(nluEnrichmentKeywordsModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModel.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentKeywordsModel.limit(), Long.valueOf("26")); - - NluEnrichmentEntities nluEnrichmentEntitiesModel = - new NluEnrichmentEntities.Builder() - .sentiment(true) - .emotion(true) - .limit(Long.valueOf("26")) - .mentions(true) - .mentionTypes(true) - .sentenceLocations(true) - .model("testString") - .build(); - assertEquals(nluEnrichmentEntitiesModel.sentiment(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.emotion(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.limit(), Long.valueOf("26")); - assertEquals(nluEnrichmentEntitiesModel.mentions(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.mentionTypes(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.sentenceLocations(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEntitiesModel.model(), "testString"); - - NluEnrichmentSentiment nluEnrichmentSentimentModel = - new NluEnrichmentSentiment.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - assertEquals(nluEnrichmentSentimentModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSentimentModel.targets(), java.util.Arrays.asList("testString")); - - NluEnrichmentEmotion nluEnrichmentEmotionModel = - new NluEnrichmentEmotion.Builder() - .document(true) - .targets(java.util.Arrays.asList("testString")) - .build(); - assertEquals(nluEnrichmentEmotionModel.document(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentEmotionModel.targets(), java.util.Arrays.asList("testString")); - - NluEnrichmentSemanticRoles nluEnrichmentSemanticRolesModel = - new NluEnrichmentSemanticRoles.Builder() - .entities(true) - .keywords(true) - .limit(Long.valueOf("26")) - .build(); - assertEquals(nluEnrichmentSemanticRolesModel.entities(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.keywords(), Boolean.valueOf(true)); - assertEquals(nluEnrichmentSemanticRolesModel.limit(), Long.valueOf("26")); - - NluEnrichmentRelations nluEnrichmentRelationsModel = - new NluEnrichmentRelations.Builder().model("testString").build(); - assertEquals(nluEnrichmentRelationsModel.model(), "testString"); - - NluEnrichmentConcepts nluEnrichmentConceptsModel = - new NluEnrichmentConcepts.Builder().limit(Long.valueOf("26")).build(); - assertEquals(nluEnrichmentConceptsModel.limit(), Long.valueOf("26")); - - NluEnrichmentFeatures nluEnrichmentFeaturesModel = - new NluEnrichmentFeatures.Builder() - .keywords(nluEnrichmentKeywordsModel) - .entities(nluEnrichmentEntitiesModel) - .sentiment(nluEnrichmentSentimentModel) - .emotion(nluEnrichmentEmotionModel) - .categories(java.util.Collections.singletonMap("anyKey", "anyValue")) - .semanticRoles(nluEnrichmentSemanticRolesModel) - .relations(nluEnrichmentRelationsModel) - .concepts(nluEnrichmentConceptsModel) - .build(); - assertEquals(nluEnrichmentFeaturesModel.keywords(), nluEnrichmentKeywordsModel); - assertEquals(nluEnrichmentFeaturesModel.entities(), nluEnrichmentEntitiesModel); - assertEquals(nluEnrichmentFeaturesModel.sentiment(), nluEnrichmentSentimentModel); - assertEquals(nluEnrichmentFeaturesModel.emotion(), nluEnrichmentEmotionModel); - assertEquals( - nluEnrichmentFeaturesModel.categories(), - java.util.Collections.singletonMap("anyKey", "anyValue")); - assertEquals(nluEnrichmentFeaturesModel.semanticRoles(), nluEnrichmentSemanticRolesModel); - assertEquals(nluEnrichmentFeaturesModel.relations(), nluEnrichmentRelationsModel); - assertEquals(nluEnrichmentFeaturesModel.concepts(), nluEnrichmentConceptsModel); - - EnrichmentOptions enrichmentOptionsModel = - new EnrichmentOptions.Builder() - .features(nluEnrichmentFeaturesModel) - .language("ar") - .model("testString") - .build(); - assertEquals(enrichmentOptionsModel.features(), nluEnrichmentFeaturesModel); - assertEquals(enrichmentOptionsModel.language(), "ar"); - assertEquals(enrichmentOptionsModel.model(), "testString"); - - Enrichment enrichmentModel = - new Enrichment.Builder() - .description("testString") - .destinationField("testString") - .sourceField("testString") - .overwrite(false) - .enrichment("testString") - .ignoreDownstreamErrors(false) - .options(enrichmentOptionsModel) - .build(); - assertEquals(enrichmentModel.description(), "testString"); - assertEquals(enrichmentModel.destinationField(), "testString"); - assertEquals(enrichmentModel.sourceField(), "testString"); - assertEquals(enrichmentModel.overwrite(), Boolean.valueOf(false)); - assertEquals(enrichmentModel.enrichment(), "testString"); - assertEquals(enrichmentModel.ignoreDownstreamErrors(), Boolean.valueOf(false)); - assertEquals(enrichmentModel.options(), enrichmentOptionsModel); - - SourceSchedule sourceScheduleModel = - new SourceSchedule.Builder() - .enabled(true) - .timeZone("America/New_York") - .frequency("daily") - .build(); - assertEquals(sourceScheduleModel.enabled(), Boolean.valueOf(true)); - assertEquals(sourceScheduleModel.timeZone(), "America/New_York"); - assertEquals(sourceScheduleModel.frequency(), "daily"); - - SourceOptionsFolder sourceOptionsFolderModel = - new SourceOptionsFolder.Builder() - .ownerUserId("testString") - .folderId("testString") - .limit(Long.valueOf("26")) - .build(); - assertEquals(sourceOptionsFolderModel.ownerUserId(), "testString"); - assertEquals(sourceOptionsFolderModel.folderId(), "testString"); - assertEquals(sourceOptionsFolderModel.limit(), Long.valueOf("26")); - - SourceOptionsObject sourceOptionsObjectModel = - new SourceOptionsObject.Builder().name("testString").limit(Long.valueOf("26")).build(); - assertEquals(sourceOptionsObjectModel.name(), "testString"); - assertEquals(sourceOptionsObjectModel.limit(), Long.valueOf("26")); - - SourceOptionsSiteColl sourceOptionsSiteCollModel = - new SourceOptionsSiteColl.Builder() - .siteCollectionPath("testString") - .limit(Long.valueOf("26")) - .build(); - assertEquals(sourceOptionsSiteCollModel.siteCollectionPath(), "testString"); - assertEquals(sourceOptionsSiteCollModel.limit(), Long.valueOf("26")); - - SourceOptionsWebCrawl sourceOptionsWebCrawlModel = - new SourceOptionsWebCrawl.Builder() - .url("testString") - .limitToStartingHosts(true) - .crawlSpeed("normal") - .allowUntrustedCertificate(false) - .maximumHops(Long.valueOf("2")) - .requestTimeout(Long.valueOf("30000")) - .overrideRobotsTxt(false) - .blacklist(java.util.Arrays.asList("testString")) - .build(); - assertEquals(sourceOptionsWebCrawlModel.url(), "testString"); - assertEquals(sourceOptionsWebCrawlModel.limitToStartingHosts(), Boolean.valueOf(true)); - assertEquals(sourceOptionsWebCrawlModel.crawlSpeed(), "normal"); - assertEquals(sourceOptionsWebCrawlModel.allowUntrustedCertificate(), Boolean.valueOf(false)); - assertEquals(sourceOptionsWebCrawlModel.maximumHops(), Long.valueOf("2")); - assertEquals(sourceOptionsWebCrawlModel.requestTimeout(), Long.valueOf("30000")); - assertEquals(sourceOptionsWebCrawlModel.overrideRobotsTxt(), Boolean.valueOf(false)); - assertEquals(sourceOptionsWebCrawlModel.blacklist(), java.util.Arrays.asList("testString")); - - SourceOptionsBuckets sourceOptionsBucketsModel = - new SourceOptionsBuckets.Builder().name("testString").limit(Long.valueOf("26")).build(); - assertEquals(sourceOptionsBucketsModel.name(), "testString"); - assertEquals(sourceOptionsBucketsModel.limit(), Long.valueOf("26")); - - SourceOptions sourceOptionsModel = - new SourceOptions.Builder() - .folders(java.util.Arrays.asList(sourceOptionsFolderModel)) - .objects(java.util.Arrays.asList(sourceOptionsObjectModel)) - .siteCollections(java.util.Arrays.asList(sourceOptionsSiteCollModel)) - .urls(java.util.Arrays.asList(sourceOptionsWebCrawlModel)) - .buckets(java.util.Arrays.asList(sourceOptionsBucketsModel)) - .crawlAllBuckets(true) - .build(); - assertEquals(sourceOptionsModel.folders(), java.util.Arrays.asList(sourceOptionsFolderModel)); - assertEquals(sourceOptionsModel.objects(), java.util.Arrays.asList(sourceOptionsObjectModel)); - assertEquals( - sourceOptionsModel.siteCollections(), java.util.Arrays.asList(sourceOptionsSiteCollModel)); - assertEquals(sourceOptionsModel.urls(), java.util.Arrays.asList(sourceOptionsWebCrawlModel)); - assertEquals(sourceOptionsModel.buckets(), java.util.Arrays.asList(sourceOptionsBucketsModel)); - assertEquals(sourceOptionsModel.crawlAllBuckets(), Boolean.valueOf(true)); - - Source sourceModel = - new Source.Builder() - .type("box") - .credentialId("testString") - .schedule(sourceScheduleModel) - .options(sourceOptionsModel) - .build(); - assertEquals(sourceModel.type(), "box"); - assertEquals(sourceModel.credentialId(), "testString"); - assertEquals(sourceModel.schedule(), sourceScheduleModel); - assertEquals(sourceModel.options(), sourceOptionsModel); - - UpdateConfigurationOptions updateConfigurationOptionsModel = - new UpdateConfigurationOptions.Builder() - .environmentId("testString") - .configurationId("testString") - .name("testString") - .description("testString") - .conversions(conversionsModel) - .enrichments(java.util.Arrays.asList(enrichmentModel)) - .normalizations(java.util.Arrays.asList(normalizationOperationModel)) - .source(sourceModel) - .build(); - assertEquals(updateConfigurationOptionsModel.environmentId(), "testString"); - assertEquals(updateConfigurationOptionsModel.configurationId(), "testString"); - assertEquals(updateConfigurationOptionsModel.name(), "testString"); - assertEquals(updateConfigurationOptionsModel.description(), "testString"); - assertEquals(updateConfigurationOptionsModel.conversions(), conversionsModel); - assertEquals( - updateConfigurationOptionsModel.enrichments(), java.util.Arrays.asList(enrichmentModel)); - assertEquals( - updateConfigurationOptionsModel.normalizations(), - java.util.Arrays.asList(normalizationOperationModel)); - assertEquals(updateConfigurationOptionsModel.source(), sourceModel); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateConfigurationOptionsError() throws Throwable { - new UpdateConfigurationOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptionsTest.java deleted file mode 100644 index ec223048a90..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateCredentialsOptionsTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the UpdateCredentialsOptions model. */ -public class UpdateCredentialsOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateCredentialsOptions() throws Throwable { - CredentialDetails credentialDetailsModel = - new CredentialDetails.Builder() - .credentialType("oauth2") - .clientId("testString") - .enterpriseId("testString") - .url("testString") - .username("testString") - .organizationUrl("testString") - .siteCollectionPath("testString") - .clientSecret("testString") - .publicKeyId("testString") - .privateKey("testString") - .passphrase("testString") - .password("testString") - .gatewayId("testString") - .sourceVersion("online") - .webApplicationUrl("testString") - .domain("testString") - .endpoint("testString") - .accessKeyId("testString") - .secretAccessKey("testString") - .build(); - assertEquals(credentialDetailsModel.credentialType(), "oauth2"); - assertEquals(credentialDetailsModel.clientId(), "testString"); - assertEquals(credentialDetailsModel.enterpriseId(), "testString"); - assertEquals(credentialDetailsModel.url(), "testString"); - assertEquals(credentialDetailsModel.username(), "testString"); - assertEquals(credentialDetailsModel.organizationUrl(), "testString"); - assertEquals(credentialDetailsModel.siteCollectionPath(), "testString"); - assertEquals(credentialDetailsModel.clientSecret(), "testString"); - assertEquals(credentialDetailsModel.publicKeyId(), "testString"); - assertEquals(credentialDetailsModel.privateKey(), "testString"); - assertEquals(credentialDetailsModel.passphrase(), "testString"); - assertEquals(credentialDetailsModel.password(), "testString"); - assertEquals(credentialDetailsModel.gatewayId(), "testString"); - assertEquals(credentialDetailsModel.sourceVersion(), "online"); - assertEquals(credentialDetailsModel.webApplicationUrl(), "testString"); - assertEquals(credentialDetailsModel.domain(), "testString"); - assertEquals(credentialDetailsModel.endpoint(), "testString"); - assertEquals(credentialDetailsModel.accessKeyId(), "testString"); - assertEquals(credentialDetailsModel.secretAccessKey(), "testString"); - - StatusDetails statusDetailsModel = - new StatusDetails.Builder().authenticated(true).errorMessage("testString").build(); - assertEquals(statusDetailsModel.authenticated(), Boolean.valueOf(true)); - assertEquals(statusDetailsModel.errorMessage(), "testString"); - - UpdateCredentialsOptions updateCredentialsOptionsModel = - new UpdateCredentialsOptions.Builder() - .environmentId("testString") - .credentialId("testString") - .sourceType("box") - .credentialDetails(credentialDetailsModel) - .status(statusDetailsModel) - .build(); - assertEquals(updateCredentialsOptionsModel.environmentId(), "testString"); - assertEquals(updateCredentialsOptionsModel.credentialId(), "testString"); - assertEquals(updateCredentialsOptionsModel.sourceType(), "box"); - assertEquals(updateCredentialsOptionsModel.credentialDetails(), credentialDetailsModel); - assertEquals(updateCredentialsOptionsModel.status(), statusDetailsModel); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateCredentialsOptionsError() throws Throwable { - new UpdateCredentialsOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateDocumentOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateDocumentOptionsTest.java deleted file mode 100644 index 0f5bcbbc4e8..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateDocumentOptionsTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.apache.commons.io.IOUtils; -import org.testng.annotations.Test; - -/** Unit test class for the UpdateDocumentOptions model. */ -public class UpdateDocumentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateDocumentOptions() throws Throwable { - UpdateDocumentOptions updateDocumentOptionsModel = - new UpdateDocumentOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .documentId("testString") - .file(TestUtilities.createMockStream("This is a mock file.")) - .filename("testString") - .fileContentType("application/json") - .metadata("testString") - .build(); - assertEquals(updateDocumentOptionsModel.environmentId(), "testString"); - assertEquals(updateDocumentOptionsModel.collectionId(), "testString"); - assertEquals(updateDocumentOptionsModel.documentId(), "testString"); - assertEquals( - IOUtils.toString(updateDocumentOptionsModel.file()), - IOUtils.toString(TestUtilities.createMockStream("This is a mock file."))); - assertEquals(updateDocumentOptionsModel.filename(), "testString"); - assertEquals(updateDocumentOptionsModel.fileContentType(), "application/json"); - assertEquals(updateDocumentOptionsModel.metadata(), "testString"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateDocumentOptionsError() throws Throwable { - new UpdateDocumentOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateEnvironmentOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateEnvironmentOptionsTest.java deleted file mode 100644 index b13b98c389b..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateEnvironmentOptionsTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the UpdateEnvironmentOptions model. */ -public class UpdateEnvironmentOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateEnvironmentOptions() throws Throwable { - UpdateEnvironmentOptions updateEnvironmentOptionsModel = - new UpdateEnvironmentOptions.Builder() - .environmentId("testString") - .name("testString") - .description("testString") - .size("S") - .build(); - assertEquals(updateEnvironmentOptionsModel.environmentId(), "testString"); - assertEquals(updateEnvironmentOptionsModel.name(), "testString"); - assertEquals(updateEnvironmentOptionsModel.description(), "testString"); - assertEquals(updateEnvironmentOptionsModel.size(), "S"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateEnvironmentOptionsError() throws Throwable { - new UpdateEnvironmentOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateTrainingExampleOptionsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateTrainingExampleOptionsTest.java deleted file mode 100644 index 9b847e2bc8c..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/UpdateTrainingExampleOptionsTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the UpdateTrainingExampleOptions model. */ -public class UpdateTrainingExampleOptionsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testUpdateTrainingExampleOptions() throws Throwable { - UpdateTrainingExampleOptions updateTrainingExampleOptionsModel = - new UpdateTrainingExampleOptions.Builder() - .environmentId("testString") - .collectionId("testString") - .queryId("testString") - .exampleId("testString") - .crossReference("testString") - .relevance(Long.valueOf("26")) - .build(); - assertEquals(updateTrainingExampleOptionsModel.environmentId(), "testString"); - assertEquals(updateTrainingExampleOptionsModel.collectionId(), "testString"); - assertEquals(updateTrainingExampleOptionsModel.queryId(), "testString"); - assertEquals(updateTrainingExampleOptionsModel.exampleId(), "testString"); - assertEquals(updateTrainingExampleOptionsModel.crossReference(), "testString"); - assertEquals(updateTrainingExampleOptionsModel.relevance(), Long.valueOf("26")); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testUpdateTrainingExampleOptionsError() throws Throwable { - new UpdateTrainingExampleOptions.Builder().build(); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/WordHeadingDetectionTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/WordHeadingDetectionTest.java deleted file mode 100644 index aa22536e859..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/WordHeadingDetectionTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the WordHeadingDetection model. */ -public class WordHeadingDetectionTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testWordHeadingDetection() throws Throwable { - FontSetting fontSettingModel = - new FontSetting.Builder() - .level(Long.valueOf("26")) - .minSize(Long.valueOf("26")) - .maxSize(Long.valueOf("26")) - .bold(true) - .italic(true) - .name("testString") - .build(); - assertEquals(fontSettingModel.level(), Long.valueOf("26")); - assertEquals(fontSettingModel.minSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.maxSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.bold(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.italic(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.name(), "testString"); - - WordStyle wordStyleModel = - new WordStyle.Builder() - .level(Long.valueOf("26")) - .names(java.util.Arrays.asList("testString")) - .build(); - assertEquals(wordStyleModel.level(), Long.valueOf("26")); - assertEquals(wordStyleModel.names(), java.util.Arrays.asList("testString")); - - WordHeadingDetection wordHeadingDetectionModel = - new WordHeadingDetection.Builder() - .fonts(java.util.Arrays.asList(fontSettingModel)) - .styles(java.util.Arrays.asList(wordStyleModel)) - .build(); - assertEquals(wordHeadingDetectionModel.fonts(), java.util.Arrays.asList(fontSettingModel)); - assertEquals(wordHeadingDetectionModel.styles(), java.util.Arrays.asList(wordStyleModel)); - - String json = TestUtilities.serialize(wordHeadingDetectionModel); - - WordHeadingDetection wordHeadingDetectionModelNew = - TestUtilities.deserialize(json, WordHeadingDetection.class); - assertTrue(wordHeadingDetectionModelNew instanceof WordHeadingDetection); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/WordSettingsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/WordSettingsTest.java deleted file mode 100644 index 6a247ada835..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/WordSettingsTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the WordSettings model. */ -public class WordSettingsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testWordSettings() throws Throwable { - FontSetting fontSettingModel = - new FontSetting.Builder() - .level(Long.valueOf("26")) - .minSize(Long.valueOf("26")) - .maxSize(Long.valueOf("26")) - .bold(true) - .italic(true) - .name("testString") - .build(); - assertEquals(fontSettingModel.level(), Long.valueOf("26")); - assertEquals(fontSettingModel.minSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.maxSize(), Long.valueOf("26")); - assertEquals(fontSettingModel.bold(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.italic(), Boolean.valueOf(true)); - assertEquals(fontSettingModel.name(), "testString"); - - WordStyle wordStyleModel = - new WordStyle.Builder() - .level(Long.valueOf("26")) - .names(java.util.Arrays.asList("testString")) - .build(); - assertEquals(wordStyleModel.level(), Long.valueOf("26")); - assertEquals(wordStyleModel.names(), java.util.Arrays.asList("testString")); - - WordHeadingDetection wordHeadingDetectionModel = - new WordHeadingDetection.Builder() - .fonts(java.util.Arrays.asList(fontSettingModel)) - .styles(java.util.Arrays.asList(wordStyleModel)) - .build(); - assertEquals(wordHeadingDetectionModel.fonts(), java.util.Arrays.asList(fontSettingModel)); - assertEquals(wordHeadingDetectionModel.styles(), java.util.Arrays.asList(wordStyleModel)); - - WordSettings wordSettingsModel = - new WordSettings.Builder().heading(wordHeadingDetectionModel).build(); - assertEquals(wordSettingsModel.heading(), wordHeadingDetectionModel); - - String json = TestUtilities.serialize(wordSettingsModel); - - WordSettings wordSettingsModelNew = TestUtilities.deserialize(json, WordSettings.class); - assertTrue(wordSettingsModelNew instanceof WordSettings); - assertEquals(wordSettingsModelNew.heading().toString(), wordHeadingDetectionModel.toString()); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/WordStyleTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/WordStyleTest.java deleted file mode 100644 index f46738e9f70..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/WordStyleTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the WordStyle model. */ -public class WordStyleTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testWordStyle() throws Throwable { - WordStyle wordStyleModel = - new WordStyle.Builder() - .level(Long.valueOf("26")) - .names(java.util.Arrays.asList("testString")) - .build(); - assertEquals(wordStyleModel.level(), Long.valueOf("26")); - assertEquals(wordStyleModel.names(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(wordStyleModel); - - WordStyle wordStyleModelNew = TestUtilities.deserialize(json, WordStyle.class); - assertTrue(wordStyleModelNew instanceof WordStyle); - assertEquals(wordStyleModelNew.level(), Long.valueOf("26")); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/XPathPatternsTest.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/model/XPathPatternsTest.java deleted file mode 100644 index d852fc20145..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/model/XPathPatternsTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020, 2022. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package com.ibm.watson.discovery.v1.model; - -import static org.testng.Assert.*; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.watson.discovery.v1.utils.TestUtilities; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import org.testng.annotations.Test; - -/** Unit test class for the XPathPatterns model. */ -public class XPathPatternsTest { - final HashMap mockStreamMap = TestUtilities.createMockStreamMap(); - final List mockListFileWithMetadata = - TestUtilities.creatMockListFileWithMetadata(); - - @Test - public void testXPathPatterns() throws Throwable { - XPathPatterns xPathPatternsModel = - new XPathPatterns.Builder().xpaths(java.util.Arrays.asList("testString")).build(); - assertEquals(xPathPatternsModel.xpaths(), java.util.Arrays.asList("testString")); - - String json = TestUtilities.serialize(xPathPatternsModel); - - XPathPatterns xPathPatternsModelNew = TestUtilities.deserialize(json, XPathPatterns.class); - assertTrue(xPathPatternsModelNew instanceof XPathPatterns); - } -} diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/testng.xml b/discovery/src/test/java/com/ibm/watson/discovery/v1/testng.xml deleted file mode 100644 index 59beff01620..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/testng.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/discovery/src/test/java/com/ibm/watson/discovery/v1/utils/TestUtilities.java b/discovery/src/test/java/com/ibm/watson/discovery/v1/utils/TestUtilities.java deleted file mode 100644 index a944fd256d4..00000000000 --- a/discovery/src/test/java/com/ibm/watson/discovery/v1/utils/TestUtilities.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.ibm.watson.discovery.v1.utils; - -import com.ibm.cloud.sdk.core.service.model.FileWithMetadata; -import com.ibm.cloud.sdk.core.util.DateUtils; -import com.ibm.cloud.sdk.core.util.GsonSingleton; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import okhttp3.HttpUrl; -import okhttp3.mockwebserver.RecordedRequest; - -/** A class used by the unit tests containing utility functions. */ -public class TestUtilities { - public static Map createMockMap() { - Map mockMap = new HashMap<>(); - mockMap.put("foo", "bar"); - return mockMap; - } - - public static HashMap createMockStreamMap() { - return new HashMap() { - { - put("key1", createMockStream("This is a mock file.")); - } - }; - } - - public static Map parseQueryString(RecordedRequest req) { - Map queryMap = new HashMap<>(); - - try { - HttpUrl requestUrl = req.getRequestUrl(); - - if (requestUrl != null) { - Set queryParamsNames = requestUrl.queryParameterNames(); - // map the parameter name to its corresponding value - for (String p : queryParamsNames) { - // get the corresponding value for the parameter (p) - List val = requestUrl.queryParameterValues(p); - if (val != null && !val.isEmpty()) { - String joinedQuery = String.join(",", val); - queryMap.put(p, joinedQuery); - } - } - } - if (queryMap.isEmpty()) { - return null; - } - } catch (Exception e) { - return null; - } - - return queryMap; - } - - public static String parseReqPath(RecordedRequest req) { - String parsedPath = null; - - try { - String fullPath = req.getPath(); - if (fullPath != null && !fullPath.isEmpty()) { - // retrieve the path segment before the query parameter - parsedPath = fullPath.split("\\?", 2)[0]; - } - if (parsedPath.isEmpty() || parsedPath == null) { - return null; - } - - } catch (Exception e) { - return null; - } - - return parsedPath; - } - - public static String serialize(Object obj) { - return GsonSingleton.getGson().toJson(obj); - } - - public static T deserialize(String json, Class clazz) { - return GsonSingleton.getGson().fromJson(json, clazz); - } - - public static InputStream createMockStream(String s) { - return new ByteArrayInputStream(s.getBytes()); - } - - public static List creatMockListFileWithMetadata() { - List list = new ArrayList(); - byte[] fileBytes = {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef}; - InputStream inputStream = new ByteArrayInputStream(fileBytes); - FileWithMetadata.Builder builder = new FileWithMetadata.Builder(); - builder.data(inputStream); - FileWithMetadata fileWithMetadata = builder.build(); - list.add(fileWithMetadata); - - return list; - } - - public static byte[] createMockByteArray(String bytes) { - return bytes.getBytes(); - } - - public static Date createMockDate(String date) throws Exception { - return DateUtils.parseAsDate(date); - } - - public static Date createMockDateTime(String date) throws Exception { - return DateUtils.parseAsDateTime(date); - } -} diff --git a/discovery/src/test/resources/discovery/v1/add_training_example_resp.json b/discovery/src/test/resources/discovery/v1/add_training_example_resp.json deleted file mode 100644 index bc3d3cd680f..00000000000 --- a/discovery/src/test/resources/discovery/v1/add_training_example_resp.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "document_id": "mock_docid", - "relevance": 0 -} \ No newline at end of file diff --git a/discovery/src/test/resources/discovery/v1/add_training_query_resp.json b/discovery/src/test/resources/discovery/v1/add_training_query_resp.json deleted file mode 100644 index cf268ea13c8..00000000000 --- a/discovery/src/test/resources/discovery/v1/add_training_query_resp.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "query_id": "mock_queryid", - "natural_language_query": "Example query", - "examples": [ - { - "document_id": "mock_docid", - "relevance": 0 - } - ] -} \ No newline at end of file diff --git a/discovery/src/test/resources/discovery/v1/create_coll_resp.json b/discovery/src/test/resources/discovery/v1/create_coll_resp.json deleted file mode 100644 index 6d811a6ea50..00000000000 --- a/discovery/src/test/resources/discovery/v1/create_coll_resp.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "test_collection", - "description": "My test collection for doc", - "created": "2016-12-14T03:20:28.739Z", - "updated": "2016-12-14T03:20:28.739Z", - "status": "available", - "configuration_id": "c84c21d0-ac94-42bf-b619-7d277f325fdc" -} diff --git a/discovery/src/test/resources/discovery/v1/create_conf_resp.json b/discovery/src/test/resources/discovery/v1/create_conf_resp.json deleted file mode 100644 index e5067c71761..00000000000 --- a/discovery/src/test/resources/discovery/v1/create_conf_resp.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "configuration_id": "2e079259-7dd2-40a9-998f-3e716f5a7b88", - "name": "doc-config", - "description": "this is a demo configuration", - "created": "2016-12-14T02:33:34.396Z", - "updated": "2016-12-14T02:33:34.396Z", - "conversions": { - "word": { - "heading": { - "fonts": [ - { - "level": 1, - "min_size": 24, - "bold": false, - "italic": false - }, - { - "level": 2, - "min_size": 18, - "max_size": 23, - "bold": true, - "italic": false - }, - { - "level": 3, - "min_size": 14, - "max_size": 17, - "bold": false, - "italic": false - }, - { - "level": 4, - "min_size": 13, - "max_size": 13, - "bold": true, - "italic": false - } - ], - "styles": [ - { - "level": 1, - "names": [ - "pullout heading", - "pulloutheading", - "header" - ] - }, - { - "level": 2, - "names": [ - "subtitle" - ] - } - ] - } - }, - "pdf": { - "heading": { - "fonts": [ - { - "level": 1, - "min_size": 24, - "max_size": 80 - }, - { - "level": 2, - "min_size": 18, - "max_size": 24, - "bold": false, - "italic": false - }, - { - "level": 2, - "min_size": 18, - "max_size": 24, - "bold": true - }, - { - "level": 3, - "min_size": 13, - "max_size": 18, - "bold": false, - "italic": false - }, - { - "level": 3, - "min_size": 13, - "max_size": 18, - "bold": true - }, - { - "level": 4, - "min_size": 11, - "max_size": 13, - "bold": false, - "italic": false - } - ] - } - }, - "html": { - "exclude_tags_completely": [ - "script", - "sup" - ], - "exclude_tags_keep_content": [ - "font", - "em", - "span" - ], - "exclude_content": { - "xpaths": [] - }, - "keep_content": { - "xpaths": [] - }, - "exclude_tag_attributes": [ - "EVENT_ACTIONS" - ] - }, - "json_normalizations": [] - }, - "enrichments": [ - { - "destination_field": "enriched_text", - "source_field": "text", - "enrichment": "alchemy_language", - "options": { - "extract": [ - "keyword", - "entity", - "doc-sentiment", - "taxonomy", - "concept", - "relation" - ], - "sentiment": true, - "quotations": true - } - } - ] -} diff --git a/discovery/src/test/resources/discovery/v1/create_doc_resp.json b/discovery/src/test/resources/discovery/v1/create_doc_resp.json deleted file mode 100644 index f89b8a20406..00000000000 --- a/discovery/src/test/resources/discovery/v1/create_doc_resp.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "document_id": "8691f0dd-7181-45b7-81de-5cb16206b3a1", - "status": "pending" -} diff --git a/discovery/src/test/resources/discovery/v1/create_env_resp.json b/discovery/src/test/resources/discovery/v1/create_env_resp.json deleted file mode 100644 index 5b0109a68d9..00000000000 --- a/discovery/src/test/resources/discovery/v1/create_env_resp.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "environment_id": "9e21069a-8bc1-475e-a1d3-2121c49ef060", - "name": "my_environment", - "description": "My Discovery environment", - "created": "2016-12-14T17:32:41.593Z", - "updated": "2016-12-14T17:32:41.593Z", - "status": "pending", - "read_only": false, - "index_capacity": { - "disk_usage": { - "used_bytes": 0, - "total_bytes": 1073741824, - "used": "0 KB", - "total": "1024 MB", - "percent_used": 0 - }, - "memory_usage": { - "used_bytes": 0, - "total_bytes": 0, - "used": "0 KB", - "total": "0 KB", - "percent_used": 0 - } - } -} diff --git a/discovery/src/test/resources/discovery/v1/create_event_resp.json b/discovery/src/test/resources/discovery/v1/create_event_resp.json deleted file mode 100644 index 7d5a3ef391b..00000000000 --- a/discovery/src/test/resources/discovery/v1/create_event_resp.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "type": "click", - "data": { - "environment_id": "mock_envid", - "session_token": "mock_session_token", - "client_timestamp": "2016-12-14T17:32:41.593Z", - "display_rank": 1, - "collection_id": "mock_collid", - "document_id": "mock_docid", - "query_id": "mock_queryid" - } -} diff --git a/discovery/src/test/resources/discovery/v1/credentials_resp.json b/discovery/src/test/resources/discovery/v1/credentials_resp.json deleted file mode 100644 index 358c4bbd58b..00000000000 --- a/discovery/src/test/resources/discovery/v1/credentials_resp.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "credential_id" : "00000d8c-0000-00e8-ba89-0ed5f89f718b", - "source_type" : "salesforce", - "credential_details" : { - "credential_type" : "username_password", - "url" : "login.salesforce.com", - "username" : "user@email.address" - } -} diff --git a/discovery/src/test/resources/discovery/v1/delete_coll_resp.json b/discovery/src/test/resources/discovery/v1/delete_coll_resp.json deleted file mode 100644 index 5a5203844be..00000000000 --- a/discovery/src/test/resources/discovery/v1/delete_coll_resp.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "collection_id": "44e29a9a-47e3-4acd-874b-c7cbe04043f1", - "status": "deleted" -} diff --git a/discovery/src/test/resources/discovery/v1/delete_conf_resp.json b/discovery/src/test/resources/discovery/v1/delete_conf_resp.json deleted file mode 100644 index 81d69519c50..00000000000 --- a/discovery/src/test/resources/discovery/v1/delete_conf_resp.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "configuration_id": "448e3545-51ca-4530-a03b-6ff282ceac2e", - "status": "deleted", - "notices": [ - { - "notice_id": "configuration_in_use", - "created": "2016-09-28T12:34:00.000Z", - "severity": "warning", - "description": "The configuration was deleted, but it is referenced by one or more collections." - } - ] -} diff --git a/discovery/src/test/resources/discovery/v1/delete_credentials_resp.json b/discovery/src/test/resources/discovery/v1/delete_credentials_resp.json deleted file mode 100644 index a585f793f95..00000000000 --- a/discovery/src/test/resources/discovery/v1/delete_credentials_resp.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "credential_id": "448e3545-51ca-4530-a03b-6ff282ceac2e", - "status": "deleted" -} \ No newline at end of file diff --git a/discovery/src/test/resources/discovery/v1/delete_doc_resp.json b/discovery/src/test/resources/discovery/v1/delete_doc_resp.json deleted file mode 100644 index 6aeba34b3a0..00000000000 --- a/discovery/src/test/resources/discovery/v1/delete_doc_resp.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "document_id": "8691f0dd-7181-45b7-81de-5cb16206b3a1", - "status": "deleted" -} diff --git a/discovery/src/test/resources/discovery/v1/delete_env_resp.json b/discovery/src/test/resources/discovery/v1/delete_env_resp.json deleted file mode 100644 index 53df6cea614..00000000000 --- a/discovery/src/test/resources/discovery/v1/delete_env_resp.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "environment_id": "{environment_id}", - "status": "deleted" -} diff --git a/discovery/src/test/resources/discovery/v1/delete_gateway_resp.json b/discovery/src/test/resources/discovery/v1/delete_gateway_resp.json deleted file mode 100644 index 05565564d51..00000000000 --- a/discovery/src/test/resources/discovery/v1/delete_gateway_resp.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "gateway_id": "8691f0dd-7181-45b7-81de-5cb16206b3a1", - "status": "deleted" -} diff --git a/discovery/src/test/resources/discovery/v1/expansions_resp.json b/discovery/src/test/resources/discovery/v1/expansions_resp.json deleted file mode 100644 index 3456f883d6f..00000000000 --- a/discovery/src/test/resources/discovery/v1/expansions_resp.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "expansions": [ - { - "input_terms": [ - "weekday", - "week day" - ], - "expanded_terms": [ - "monday", - "tuesday", - "wednesday", - "thursday", - "friday" - ] - }, - { - "input_terms": [ - "weekend", - "week end" - ], - "expanded_terms": [ - "saturday", - "sunday" - ] - } - ] -} \ No newline at end of file diff --git a/discovery/src/test/resources/discovery/v1/gateway_resp.json b/discovery/src/test/resources/discovery/v1/gateway_resp.json deleted file mode 100644 index 59a8c308449..00000000000 --- a/discovery/src/test/resources/discovery/v1/gateway_resp.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "gateway_id": "gateway_id", - "name": "name", - "status": "connected", - "token": "token", - "token_id": "token_id" -} diff --git a/discovery/src/test/resources/discovery/v1/get_coll1_resp.json b/discovery/src/test/resources/discovery/v1/get_coll1_resp.json deleted file mode 100644 index aa9b74f432c..00000000000 --- a/discovery/src/test/resources/discovery/v1/get_coll1_resp.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "collection_id": "44e29a9a-47e3-4acd-874b-c7cbe04043f1", - "name": "test_collection", - "created": "2016-12-14T18:42:25.324Z", - "updated": "2016-12-14T18:42:25.324Z", - "status": "available", - "configuration_id": "e8b9d793-b163-452a-9373-bce07efb510b", - "language": "en_us", - "document_counts": { - "available": 1000, - "processing": 20, - "failed": 180 - } -} diff --git a/discovery/src/test/resources/discovery/v1/get_coll_resp.json b/discovery/src/test/resources/discovery/v1/get_coll_resp.json deleted file mode 100644 index 3428eddeba7..00000000000 --- a/discovery/src/test/resources/discovery/v1/get_coll_resp.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "collections": [ - { - "collection_id": "44e29a9a-47e3-4acd-874b-c7cbe04043f1", - "name": "test_collection", - "created": "2016-12-14T18:42:25.324Z", - "updated": "2016-12-14T18:42:25.324Z", - "status": "available", - "configuration_id": "e8b9d793-b163-452a-9373-bce07efb510b", - "language": "en_us" - } - ] -} diff --git a/discovery/src/test/resources/discovery/v1/get_conf_resp.json b/discovery/src/test/resources/discovery/v1/get_conf_resp.json deleted file mode 100644 index 1c38c4bca7a..00000000000 --- a/discovery/src/test/resources/discovery/v1/get_conf_resp.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "configuration_id": "2e079259-7dd2-40a9-998f-3e716f5a7b88", - "name": "doc-config", - "description": "this is a demo configuration", - "created": "2016-11-03T02:33:34.396Z", - "updated": "2016-11-03T02:33:34.396Z", - "conversions": { - "word": { - "heading": { - "fonts": [ - { - "level": 1, - "min_size": 24, - "bold": false, - "italic": false - }, - { - "level": 2, - "min_size": 18, - "max_size": 23, - "bold": true, - "italic": false - }, - { - "level": 3, - "min_size": 14, - "max_size": 17, - "bold": false, - "italic": false - }, - { - "level": 4, - "min_size": 13, - "max_size": 13, - "bold": true, - "italic": false - } - ], - "styles": [ - { - "level": 1, - "names": [ - "pullout heading", - "pulloutheading", - "header" - ] - }, - { - "level": 2, - "names": [ - "subtitle" - ] - } - ] - } - }, - "pdf": { - "heading": { - "fonts": [ - { - "level": 1, - "min_size": 24, - "max_size": 80 - }, - { - "level": 2, - "min_size": 18, - "max_size": 24, - "bold": false, - "italic": false - }, - { - "level": 2, - "min_size": 18, - "max_size": 24, - "bold": true - }, - { - "level": 3, - "min_size": 13, - "max_size": 18, - "bold": false, - "italic": false - }, - { - "level": 3, - "min_size": 13, - "max_size": 18, - "bold": true - }, - { - "level": 4, - "min_size": 11, - "max_size": 13, - "bold": false, - "italic": false - } - ] - } - }, - "html": { - "exclude_tags_completely": [ - "script", - "sup" - ], - "exclude_tags_keep_content": [ - "font", - "em", - "span" - ], - "exclude_content": { - "xpaths": [] - }, - "keep_content": { - "xpaths": [] - }, - "exclude_tag_attributes": [ - "EVENT_ACTIONS" - ] - }, - "json_normalizations": [] - }, - "enrichments": [ - { - "destination_field": "enriched_text", - "source_field": "text", - "enrichment": "alchemy_language", - "options": { - "extract": [ - "keyword", - "entity", - "doc-sentiment", - "taxonomy", - "concept", - "relation" - ], - "sentiment": true, - "quotations": true - } - } - ] -} diff --git a/discovery/src/test/resources/discovery/v1/get_confs_resp.json b/discovery/src/test/resources/discovery/v1/get_confs_resp.json deleted file mode 100644 index 50083f93f81..00000000000 --- a/discovery/src/test/resources/discovery/v1/get_confs_resp.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "configurations": [ - { - "configuration_id": "210081cb-796f-463d-ab88-a07595f452a9", - "name": "default-config", - "description": "This is a test configuration.", - "created": "2016-11-01T17:47:30.678Z", - "updated": "2016-11-01T17:47:30.678Z" - }, - { - "configuration_id": "448e3545-51ca-4530-a03b-6ff282ceac2e", - "name": "democonfig", - "description": "this is a demo configuration", - "created": "2016-12-14T18:42:25.324Z", - "updated": "2016-12-14T18:42:25.324Z" - } - ] -} diff --git a/discovery/src/test/resources/discovery/v1/get_doc_resp.json b/discovery/src/test/resources/discovery/v1/get_doc_resp.json deleted file mode 100644 index 36626fafa3b..00000000000 --- a/discovery/src/test/resources/discovery/v1/get_doc_resp.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "document_id": "8691f0dd-7181-45b7-81de-5cb16206b3a1", - "configuration_id": "e8b9d793-b163-452a-9373-bce07efb510b", - "created": "2016-11-02T18:42:25.324Z", - "updated": "2016-11-03T09:02:41.585Z", - "status": "pending", - "notices": [ - { - "notice_id": "index_342", - "severity": "warning", - "step": "indexing", - "description": "DANGER, WILL ROBINSON!" - } - ] -} diff --git a/discovery/src/test/resources/discovery/v1/get_env_resp.json b/discovery/src/test/resources/discovery/v1/get_env_resp.json deleted file mode 100644 index 65afb765910..00000000000 --- a/discovery/src/test/resources/discovery/v1/get_env_resp.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "environment_id": "448e3545-51ca-4530-a03b-6ff282ceac2e", - "name": "my_environment", - "description": "My environment", - "created": "2016-12-14T17:32:41.593Z", - "updated": "2016-12-14T17:32:41.593Z", - "status": "resizing", - "index_capacity": { - "disk_usage": { - "used_bytes": 0, - "total_bytes": 1073741824, - "used": "0 KB", - "total": "1024 MB", - "percent_used": 0 - }, - "memory_usage": { - "used_bytes": 140266264, - "total_bytes": 518979584, - "used": "133.77 MB", - "total": "494.94 MB", - "percent_used": 27.03 - } - }, - "requested_size": "LT", - "search_status": { - "scope": "environment", - "status": "TRAINING", - "status_description": "The environment is training.", - "last_trained": "2016-12-14T17:32:41.593Z" - } -} diff --git a/discovery/src/test/resources/discovery/v1/get_envs_resp.json b/discovery/src/test/resources/discovery/v1/get_envs_resp.json deleted file mode 100644 index bd3076b111c..00000000000 --- a/discovery/src/test/resources/discovery/v1/get_envs_resp.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "environments": [ - { - "environment_id": "448e3545-51ca-4530-a03b-6ff282ceac2e", - "name": "my_environment", - "description": "My environment", - "created": "2016-12-14T17:32:41.593Z", - "updated": "2016-12-14T17:32:41.593Z", - "status": "available", - "index_capacity": { - "disk_usage": { - "used_bytes": 0, - "total_bytes": 1073741824, - "used": "0 KB", - "total": "1024 MB", - "percent_used": 0 - }, - "memory_usage": { - "used_bytes": 137456520, - "total_bytes": 518979584, - "used": "131.09 MB", - "total": "494.94 MB", - "percent_used": 26.49 - } - } - } - ] -} diff --git a/discovery/src/test/resources/discovery/v1/get_training_data_resp.json b/discovery/src/test/resources/discovery/v1/get_training_data_resp.json deleted file mode 100644 index cf268ea13c8..00000000000 --- a/discovery/src/test/resources/discovery/v1/get_training_data_resp.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "query_id": "mock_queryid", - "natural_language_query": "Example query", - "examples": [ - { - "document_id": "mock_docid", - "relevance": 0 - } - ] -} \ No newline at end of file diff --git a/discovery/src/test/resources/discovery/v1/get_training_example_resp.json b/discovery/src/test/resources/discovery/v1/get_training_example_resp.json deleted file mode 100644 index bc3d3cd680f..00000000000 --- a/discovery/src/test/resources/discovery/v1/get_training_example_resp.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "document_id": "mock_docid", - "relevance": 0 -} \ No newline at end of file diff --git a/discovery/src/test/resources/discovery/v1/issue517.json b/discovery/src/test/resources/discovery/v1/issue517.json deleted file mode 100644 index 5c4ee81a99b..00000000000 --- a/discovery/src/test/resources/discovery/v1/issue517.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "my_config", - "conversions": { - "json_normalizations": [ - { - "operation": "copy", - "source_field": "some_field", - "destination_field": "other_field" - } - ] - } -} diff --git a/discovery/src/test/resources/discovery/v1/issue518.json b/discovery/src/test/resources/discovery/v1/issue518.json deleted file mode 100644 index 2e32c2ac4f7..00000000000 --- a/discovery/src/test/resources/discovery/v1/issue518.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "configuration_id": "448e3545-51ca-4530-a03b-6ff282ceac2e", - "name": "IBM News", - "created": "2015-08-24T18:42:25.324Z", - "updated": "2015-08-24T18:42:25.324Z", - "description": "A configuration useful for ingesting IBM press releases.", - "conversions": { - "html": { - "exclude_tags_keep_content": [ - "span" - ], - "exclude_content": { - "xpaths": [ - "/home" - ] - } - }, - "json_normalizations": [ - { - "operation": "move", - "source_field": "extracted_metadata.title", - "destination_field": "metadata.title" - }, - { - "operation": "move", - "source_field": "extracted_metadata.author", - "destination_field": "metadata.author" - }, - { - "operation": "remove", - "source_field": "extracted_metadata" - } - ] - }, - "enrichments": [ - { - "source_field": "text", - "destination_field": "alchemy_enriched_text", - "enrichment": "alchemy_language", - "options": { - "extract": [ - "keyword" - ], - "showSourceText": true - } - }, - { - "source_field": "alchemy_enriched_text.text", - "destination_field": "sire_enriched_text", - "enrichment": "alchemy_language", - "options": { - "extract": [ - "typed-rels" - ], - "model": "ie-en-news" - } - } - ], - "normalizations": [ - { - "operation": "move", - "source_field": "metadata.title", - "destination_field": "title" - }, - { - "operation": "copy", - "source_field": "metadata.author", - "destination_field": "author" - }, - { - "operation": "merge", - "source_field": "alchemy_enriched_text.language", - "destination_field": "language" - }, - { - "operation": "remove", - "source_field": "html" - }, - { - "operation": "remove_nulls" - } - ] -} diff --git a/discovery/src/test/resources/discovery/v1/list_credentials_resp.json b/discovery/src/test/resources/discovery/v1/list_credentials_resp.json deleted file mode 100644 index 50af9a38006..00000000000 --- a/discovery/src/test/resources/discovery/v1/list_credentials_resp.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "credentials" : [ { - "credential_id" : "00000d8c-0000-00e8-ba89-0ed5f89f718b", - "source_type" : "salesforce", - "credential_details" : { - "credential_type" : "username_password", - "url" : "login.salesforce.com", - "username" : "user@email.address" - } - }, { - "credential_id" : "00000d8c-0000-00e8-ba89-0ed5f89f111c", - "source_type" : "box", - "credential_details" : { - "credential_type" : "oauth2", - "client_id" : "1234567899bz7micz6x6p5zfnycw98e3", - "enterprise_id" : "000000001" - } - }, { - "credential_id" : "00000d8c-0000-00e8-ba22-0ed5f89f999d", - "source_type" : "sharepoint", - "credential_details" : { - "credential_type" : "saml", - "organization_url" : "https://site001.sharepointonline.com", - "site_collection_path" : "/sites/TestSite1", - "username" : "userA@sharepointonline.com" - } - } ] -} diff --git a/discovery/src/test/resources/discovery/v1/list_fields_resp.json b/discovery/src/test/resources/discovery/v1/list_fields_resp.json deleted file mode 100644 index 2a34d013a75..00000000000 --- a/discovery/src/test/resources/discovery/v1/list_fields_resp.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "fields": [ - { - "field": "field", - "type": "string" - } - ] -} \ No newline at end of file diff --git a/discovery/src/test/resources/discovery/v1/list_gateways_resp.json b/discovery/src/test/resources/discovery/v1/list_gateways_resp.json deleted file mode 100644 index 58f2a9a384b..00000000000 --- a/discovery/src/test/resources/discovery/v1/list_gateways_resp.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "gateways": [ - { - "gateway_id": "gateway_id_1", - "name": "name", - "status": "connected", - "token": "token", - "token_id": "token_id" - }, - { - "gateway_id": "gateway_id_2", - "name": "name", - "status": "connected", - "token": "token", - "token_id": "token_id" - }, - ] -} diff --git a/discovery/src/test/resources/discovery/v1/list_training_data_resp.json b/discovery/src/test/resources/discovery/v1/list_training_data_resp.json deleted file mode 100644 index 503353e69bd..00000000000 --- a/discovery/src/test/resources/discovery/v1/list_training_data_resp.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "environment_id": "mock_envid", - "collection_id": "mock_confid", - "queries": [ - { - "query_id": "mock_queryid", - "natural_language_query": "Example query", - "examples": [ - { - "document_id": "mock_docid", - "relevance": 0 - } - ] - } - ] -} \ No newline at end of file diff --git a/discovery/src/test/resources/discovery/v1/list_training_examples_resp.json b/discovery/src/test/resources/discovery/v1/list_training_examples_resp.json deleted file mode 100644 index cdfd587bf69..00000000000 --- a/discovery/src/test/resources/discovery/v1/list_training_examples_resp.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "examples": [ - { - "document_id": "mock_docid", - "relevance": 0, - "cross_reference": "cross_reference" - } - ] -} \ No newline at end of file diff --git a/discovery/src/test/resources/discovery/v1/listfields_coll_resp.json b/discovery/src/test/resources/discovery/v1/listfields_coll_resp.json deleted file mode 100644 index dc45c39a1b2..00000000000 --- a/discovery/src/test/resources/discovery/v1/listfields_coll_resp.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "fields": [ - { - "field": "warnings", - "type": "nested" - }, - { - "field": "warnings.properties.description", - "type": "string" - }, - { - "field": "warnings.properties.phase", - "type": "string" - }, - { - "field": "warnings.properties.warning_id", - "type": "string" - } - ] -} diff --git a/discovery/src/test/resources/discovery/v1/log_query_resp.json b/discovery/src/test/resources/discovery/v1/log_query_resp.json deleted file mode 100644 index 8d7eb2d5f08..00000000000 --- a/discovery/src/test/resources/discovery/v1/log_query_resp.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "matching_results": 2, - "results": [ - { - "environment_id": "mock_envid", - "customer_id": "", - "natural_language_query": "Who beat Ken Jennings in Jeopardy!", - "document_results": { - "results": [], - "count": 0 - }, - "created_timestamp": "2018-07-16T18:27:26.433", - "query_id": "mock_queryid", - "session_token": "mock_session_token", - "event_type": "query" - }, - { - "environment_id": "mock_envid", - "customer_id": "", - "document_results": { - "results": [ - { - "position": 1, - "document_id": "mock_docid", - "score": 1.0, - "collection_id": "mock_collid" - }, - { - "position": 2, - "document_id": "mock_docid", - "score": 1.0, - "collection_id": "mock_collid" - } - ], - "count": 2 - }, - "created_timestamp": "2018-07-19T11:10:32.243", - "query_id": "mock_queryid", - "session_token": "mock_session_token", - "event_type": "query" - } - ] -} diff --git a/discovery/src/test/resources/discovery/v1/metric_resp.json b/discovery/src/test/resources/discovery/v1/metric_resp.json deleted file mode 100644 index 012289e7a4c..00000000000 --- a/discovery/src/test/resources/discovery/v1/metric_resp.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "aggregations": [ - { - "interval": "1d", - "event_type": "click", - "results": [ - { - "key_as_string": "2018-08-05T20:00:00.000", - "key": 1533513600000, - "event_rate": 0.0 - }, - { - "key_as_string": "2018-08-06T20:00:00.000", - "key": 1533600000000, - "event_rate": 0.0 - }, - { - "key_as_string": "2018-08-07T20:00:00.000", - "key": 1533686400000, - "event_rate": 0.0 - }, - { - "key_as_string": "2018-08-08T20:00:00.000", - "key": 1533772800000, - "event_rate": 0.0 - }, - { - "key_as_string": "2018-08-09T20:00:00.000", - "key": 1533859200000, - "event_rate": 0.0 - }, - { - "key_as_string": "2018-08-10T20:00:00.000", - "key": 1533945600000, - "event_rate": 0.0 - }, - { - "key_as_string": "2018-08-11T20:00:00.000", - "key": 1534032000000, - "event_rate": 0.0 - }, - { - "key_as_string": "2018-08-12T20:00:00.000", - "key": 1534118400000, - "event_rate": 0.09090909090909091 - } - ] - } - ] -} diff --git a/discovery/src/test/resources/discovery/v1/metric_token_resp.json b/discovery/src/test/resources/discovery/v1/metric_token_resp.json deleted file mode 100644 index 19f33e21d81..00000000000 --- a/discovery/src/test/resources/discovery/v1/metric_token_resp.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "aggregations": [ - { - "event_type": "click", - "results": [ - { - "key": "beat", - "matching_results": 117, - "event_rate": 0.0 - }, - { - "key": "in", - "matching_results": 117, - "event_rate": 0.0 - }, - { - "key": "jennings", - "matching_results": 117, - "event_rate": 0.0 - }, - { - "key": "jeopardy", - "matching_results": 117, - "event_rate": 0.0 - }, - { - "key": "ken", - "matching_results": 117, - "event_rate": 0.0 - }, - { - "key": "who", - "matching_results": 117, - "event_rate": 0.0 - }, - { - "key": "watson", - "matching_results": 3, - "event_rate": 0.0 - }, - { - "key": "1", - "matching_results": 2, - "event_rate": 0.5 - }, - { - "key": "field", - "matching_results": 2, - "event_rate": 0.5 - }, - { - "key": "number", - "matching_results": 2, - "event_rate": 0.5 - } - ] - } - ] -} diff --git a/discovery/src/test/resources/discovery/v1/passages_test_doc_1.json b/discovery/src/test/resources/discovery/v1/passages_test_doc_1.json deleted file mode 100644 index c065af80ae5..00000000000 --- a/discovery/src/test/resources/discovery/v1/passages_test_doc_1.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "text": "Celgene and IBM Watson Health Forge Collaboration Designed to Transform Patient Safety Monitoring\nCelgene Corporation and IBM Watson Health today announced a collaboration to co-develop IBM Watson for Patient Safety, a new offering that aims to enhance pharmacovigilance methods used to collect, assess, monitor, and report adverse drug reactions. The new offering will run on the Watson Health Cloud." -} \ No newline at end of file diff --git a/discovery/src/test/resources/discovery/v1/passages_test_doc_2.json b/discovery/src/test/resources/discovery/v1/passages_test_doc_2.json deleted file mode 100644 index 3dde183fe61..00000000000 --- a/discovery/src/test/resources/discovery/v1/passages_test_doc_2.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "text": "Slack, IBM Partner to Bring Watson to Developers\nIBM and Slack are partnering to bring Watson to Slack’s global community of developers and enterprise users. Drawing on the power of Slack’s digital workplace and the cognitive computing capabilities of Watson, developers will be able to create more offerings — including bots and other conversational inferences — that will transform the platform’s user experience. Developers can easily access the range of Watson services -- such as Conversation, Sentiment Analysis or speech APIs -- and build powerful new tools for the platform with this enhanced cognitive functionality." -} \ No newline at end of file diff --git a/discovery/src/test/resources/discovery/v1/query1_resp.json b/discovery/src/test/resources/discovery/v1/query1_resp.json deleted file mode 100644 index af8303c5054..00000000000 --- a/discovery/src/test/resources/discovery/v1/query1_resp.json +++ /dev/null @@ -1,536 +0,0 @@ -{ - "matching_results": 4, - "results": [ - { - "id": "4f70a05d-6ef2-4a46-be87-380724995af8", - "score": 1, - "extracted_metadata": { - "title": "Celgene and IBM Watson Health Forge Collaboration Designed to Transform Patient Safety Monitoring" - }, - "html": "\n\n Celgene and IBM Watson Health Forge Collaboration Designed to Transform Patient Safety Monitoring\n\n\n\n\n

Published: Tue, 01 Nov 2016 08:32:23 GMT

\n

Celgene Corporation and IBM Watson Health today announced a collaboration to co-develop IBM Watson for Patient Safety, a new offering that aims to enhance pharmacovigilance methods used to collect, assess, monitor, and report adverse drug reactions. The new offering will run on the Watson Health Cloud.

\n

URL: http://www.ibm.com/press/us/en/pressrelease/50927.wss

\n\n\n", - "text": "Celgene and IBM Watson Health Forge Collaboration Designed to Transform Patient Safety Monitoring\n\nPublished: Tue, 01 Nov 2016 08:32:23 GMT\n\nCelgene Corporation and IBM Watson Health today announced a collaboration to co-develop IBM Watson for Patient Safety, a new offering that aims to enhance pharmacovigilance methods used to collect, assess, monitor, and report adverse drug reactions. The new offering will run on the Watson Health Cloud.\n\nURL: http://www.ibm.com/press/us/en/pressrelease/50927.wss", - "enriched_text": { - "status": "OK", - "language": "english", - "docSentiment": { - "type": "positive", - "score": 0.349018, - "mixed": true - }, - "concepts": [ - { - "text": "Adverse drug reaction", - "relevance": 0.97198, - "knowledgeGraph": { - "typeHierarchy": "/adverse events/adverse drug reaction" - }, - "dbpedia": "http://dbpedia.org/resource/Adverse_drug_reaction", - "freebase": "http://rdf.freebase.com/ns/m.04p93k" - }, - { - "text": "Pharmacovigilance", - "relevance": 0.57362, - "knowledgeGraph": { - "typeHierarchy": "/directors/pharmacovigilance" - }, - "dbpedia": "http://dbpedia.org/resource/Pharmacovigilance", - "freebase": "http://rdf.freebase.com/ns/m.04lmfb" - }, - { - "text": "Thomas J. Watson", - "relevance": 0.507165, - "knowledgeGraph": { - "typeHierarchy": "/people/thomas j. watson" - }, - "dbpedia": "http://dbpedia.org/resource/Thomas_J._Watson", - "freebase": "http://rdf.freebase.com/ns/m.07qkt", - "yago": "http://yago-knowledge.org/resource/Thomas_J._Watson" - }, - { - "text": "Illness", - "relevance": 0.497042, - "knowledgeGraph": { - "typeHierarchy": "/issues/conditions/circumstances/illness" - }, - "dbpedia": "http://dbpedia.org/resource/Illness", - "freebase": "http://rdf.freebase.com/ns/m.01jwdy" - }, - { - "text": "Lotus Software", - "relevance": 0.482834, - "knowledgeGraph": { - "typeHierarchy": "/products/materials/software/lotus software" - }, - "website": "http://www.ibm.com/software/lotus", - "dbpedia": "http://dbpedia.org/resource/Lotus_Software", - "freebase": "http://rdf.freebase.com/ns/m.0q4jd", - "opencyc": "http://sw.opencyc.org/concept/Mx4rvViJIZwpEbGdrcN5Y29ycA", - "yago": "http://yago-knowledge.org/resource/Lotus_Software" - }, - { - "text": "Pharmacology", - "relevance": 0.441008, - "knowledgeGraph": { - "typeHierarchy": "/fields/pharmacology" - }, - "dbpedia": "http://dbpedia.org/resource/Pharmacology", - "freebase": "http://rdf.freebase.com/ns/m.062p_", - "opencyc": "http://sw.opencyc.org/concept/Mx4rwQFiYJwpEbGdrcN5Y29ycA" - }, - { - "text": "Thomas J. Watson Research Center", - "relevance": 0.4094, - "knowledgeGraph": { - "typeHierarchy": "/organizations/research centers/thomas j. watson research center" - }, - "dbpedia": "http://dbpedia.org/resource/Thomas_J._Watson_Research_Center", - "freebase": "http://rdf.freebase.com/ns/m.04zkt5", - "yago": "http://yago-knowledge.org/resource/Thomas_J._Watson_Research_Center" - } - ], - "entities": [ - { - "type": "Company", - "relevance": 0.939431, - "knowledgeGraph": { - "typeHierarchy": "/organizations/companies/ibm/ibm watson health" - }, - "sentiment": { - "type": "positive", - "score": 0.394824, - "mixed": false - }, - "count": 1, - "text": "IBM Watson Health" - }, - { - "type": "Facility", - "relevance": 0.936844, - "knowledgeGraph": { - "typeHierarchy": "/people/watson health forge" - }, - "sentiment": { - "type": "positive", - "score": 0.450045, - "mixed": false - }, - "count": 1, - "text": "Watson Health Forge" - }, - { - "type": "Facility", - "relevance": 0.900379, - "knowledgeGraph": { - "typeHierarchy": "/people/watson health cloud" - }, - "sentiment": { - "type": "positive", - "score": 0.793685, - "mixed": false - }, - "count": 1, - "text": "Watson Health Cloud" - }, - { - "type": "Company", - "relevance": 0.847945, - "knowledgeGraph": { - "typeHierarchy": "/organizations/companies/ibm/ibm watson" - }, - "sentiment": { - "type": "positive", - "score": 0.394824, - "mixed": false - }, - "count": 1, - "text": "IBM Watson" - }, - { - "type": "JobTitle", - "relevance": 0.688245, - "knowledgeGraph": { - "typeHierarchy": "/issues/patient safety/transform patient safety monitoring" - }, - "sentiment": { - "type": "positive", - "score": 0.450045, - "mixed": false - }, - "count": 1, - "text": "Transform Patient Safety Monitoring" - }, - { - "type": "Company", - "relevance": 0.514877, - "knowledgeGraph": { - "typeHierarchy": "/organizations/companies/ibm" - }, - "sentiment": { - "type": "positive", - "score": 0.450045, - "mixed": false - }, - "count": 1, - "text": "IBM", - "disambiguated": { - "subType": [ - "SoftwareLicense", - "OperatingSystemDeveloper", - "ProcessorManufacturer", - "SoftwareDeveloper", - "CompanyFounder", - "ProgrammingLanguageDesigner", - "ProgrammingLanguageDeveloper" - ], - "name": "IBM", - "website": "http://www.ibm.com/", - "dbpedia": "http://dbpedia.org/resource/IBM", - "freebase": "http://rdf.freebase.com/ns/m.03sc8", - "opencyc": "http://sw.opencyc.org/concept/Mx4rvViMoJwpEbGdrcN5Y29ycA", - "yago": "http://yago-knowledge.org/resource/IBM", - "crunchbase": "http://www.crunchbase.com/company/ibm" - } - }, - { - "type": "Company", - "relevance": 0.332536, - "knowledgeGraph": { - "typeHierarchy": "/companies/organizations/celgene corporation" - }, - "sentiment": { - "type": "positive", - "score": 0.394824, - "mixed": false - }, - "count": 1, - "text": "Celgene Corporation", - "disambiguated": { - "subType": [ - "VentureFundedCompany" - ], - "name": "Celgene", - "website": "http://www.celgene.com/", - "dbpedia": "http://dbpedia.org/resource/Celgene", - "freebase": "http://rdf.freebase.com/ns/m.0898kv", - "opencyc": "http://sw.opencyc.org/concept/Mx4rvZdBy5wpEbGdrcN5Y29ycA", - "yago": "http://yago-knowledge.org/resource/Celgene" - } - }, - { - "type": "Person", - "relevance": 0.307186, - "knowledgeGraph": { - "typeHierarchy": "/companies/organizations/celgene" - }, - "sentiment": { - "type": "positive", - "score": 0.450045, - "mixed": false - }, - "count": 1, - "text": "Celgene" - } - ], - "relations": [ - { - "sentence": " Celgene Corporation and IBM Watson Health today announced a collaboration to co-develop IBM Watson for Patient Safety, a new offering that aims to enhance pharmacovigilance methods used to collect, assess, monitor, and report adverse drug reactions.", - "subject": { - "text": "Celgene Corporation and IBM Watson Health today", - "entities": [ - { - "type": "Company", - "text": "Celgene Corporation", - "knowledgeGraph": { - "typeHierarchy": "/companies/organizations/celgene corporation" - }, - "disambiguated": { - "subType": [ - "Organization", - "Company", - "VentureFundedCompany" - ], - "name": "Celgene", - "website": "http://www.celgene.com/", - "dbpedia": "http://dbpedia.org/resource/Celgene", - "freebase": "http://rdf.freebase.com/ns/m.0898kv", - "opencyc": "http://sw.opencyc.org/concept/Mx4rvZdBy5wpEbGdrcN5Y29ycA", - "yago": "http://yago-knowledge.org/resource/Celgene" - } - }, - { - "type": "Company", - "text": "IBM Watson Health", - "knowledgeGraph": { - "typeHierarchy": "/organizations/companies/ibm/ibm watson health" - } - } - ], - "keywords": [ - { - "text": "IBM Watson Health", - "knowledgeGraph": { - "typeHierarchy": "/organizations/companies/ibm/ibm watson health" - } - }, - { - "text": "Celgene Corporation", - "knowledgeGraph": { - "typeHierarchy": "/companies/organizations/celgene corporation" - } - } - ] - }, - "action": { - "text": "announced", - "lemmatized": "announce", - "verb": { - "text": "announce", - "tense": "past" - } - }, - "object": { - "text": "a collaboration to co-develop IBM Watson for Patient Safety, a new offering that aims to enhance pharmacovigilance methods used to collect, assess, monitor, and report adverse drug reactions", - "sentiment": { - "type": "positive", - "score": 0.576836, - "mixed": false - }, - "entities": [ - { - "type": "Company", - "text": "IBM Watson", - "knowledgeGraph": { - "typeHierarchy": "/organizations/companies/ibm/ibm watson" - } - } - ], - "keywords": [ - { - "text": "adverse drug reactions", - "knowledgeGraph": { - "typeHierarchy": "/adverse events/adverse drug reactions" - } - }, - { - "text": "pharmacovigilance methods", - "knowledgeGraph": { - "typeHierarchy": "/tools/resources/materials/methods/pharmacovigilance methods" - } - }, - { - "text": "IBM Watson", - "knowledgeGraph": { - "typeHierarchy": "/organizations/companies/ibm/ibm watson" - } - }, - { - "text": "Patient Safety", - "knowledgeGraph": { - "typeHierarchy": "/issues/patient safety" - } - } - ] - } - }, - { - "sentence": " Celgene Corporation and IBM Watson Health today announced a collaboration to co-develop IBM Watson for Patient Safety, a new offering that aims to enhance pharmacovigilance methods used to collect, assess, monitor, and report adverse drug reactions.", - "subject": { - "text": "a new offering", - "sentiment": { - "type": "positive", - "score": 0.639534, - "mixed": false - }, - "keywords": [ - { - "text": "new offering" - } - ] - }, - "action": { - "text": "aims", - "lemmatized": "aim", - "verb": { - "text": "aim", - "tense": "present" - } - }, - "object": { - "text": "to enhance pharmacovigilance methods used to collect", - "keywords": [ - { - "text": "pharmacovigilance methods", - "knowledgeGraph": { - "typeHierarchy": "/tools/resources/materials/methods/pharmacovigilance methods" - } - } - ] - } - }, - { - "sentence": " The new offering will run on the Watson Health Cloud.", - "subject": { - "text": "The new offering", - "sentiment": { - "type": "positive", - "score": 0.451284, - "mixed": false - }, - "keywords": [ - { - "text": "new offering" - } - ] - }, - "action": { - "text": "will run", - "lemmatized": "will run", - "verb": { - "text": "run", - "tense": "future" - } - }, - "location": { - "text": "on the Watson Health Cloud", - "entities": [ - { - "type": "Facility", - "text": "Watson Health Cloud", - "knowledgeGraph": { - "typeHierarchy": "/people/watson health cloud" - } - } - ] - } - } - ], - "taxonomy": [ - { - "label": "/health and fitness", - "score": 0.613225, - "confident": false - }, - { - "label": "/business and industrial/company/bankruptcy", - "score": 0.413686, - "confident": false - }, - { - "confident": false, - "label": "/technology and computing", - "score": 0.325571 - } - ], - "keywords": [ - { - "knowledgeGraph": { - "typeHierarchy": "/organizations/companies/ibm/ibm watson health" - }, - "relevance": 0.944488, - "sentiment": { - "score": 0.422434, - "type": "positive", - "mixed": false - }, - "text": "IBM Watson Health" - }, - { - "knowledgeGraph": { - "typeHierarchy": "/people/watson health forge" - }, - "relevance": 0.666311, - "sentiment": { - "score": 0.450045, - "type": "positive", - "mixed": false - }, - "text": "Watson Health Forge" - }, - { - "knowledgeGraph": { - "typeHierarchy": "/people/watson health cloud" - }, - "relevance": 0.531944, - "sentiment": { - "score": 0.793685, - "type": "positive", - "mixed": false - }, - "text": "Watson Health Cloud" - }, - { - "knowledgeGraph": { - "typeHierarchy": "/issues/patient safety/transform patient safety" - }, - "relevance": 0.47957, - "sentiment": { - "score": 0.450045, - "type": "positive", - "mixed": false - }, - "text": "Transform Patient Safety" - }, - { - "knowledgeGraph": { - "typeHierarchy": "/adverse events/adverse drug reactions" - }, - "relevance": 0.445181, - "sentiment": { - "type": "neutral", - "mixed": false - }, - "text": "adverse drug reactions" - }, - { - "relevance": 0.400895, - "sentiment": { - "score": 0.644874, - "type": "positive", - "mixed": false - }, - "text": "new offering" - }, - { - "knowledgeGraph": { - "typeHierarchy": "/activities/services/applications/collaboration/collaboration designed" - }, - "relevance": 0.301433, - "sentiment": { - "score": 0.450045, - "type": "positive", - "mixed": false - }, - "text": "Collaboration Designed" - }, - { - "knowledgeGraph": { - "typeHierarchy": "/tools/resources/materials/methods/pharmacovigilance methods" - }, - "relevance": 0.27876, - "sentiment": { - "score": 0.496064, - "type": "positive", - "mixed": false - }, - "text": "pharmacovigilance methods" - }, - { - "knowledgeGraph": { - "typeHierarchy": "/companies/organizations/celgene corporation" - }, - "relevance": 0.220786, - "sentiment": { - "score": 0.394824, - "type": "positive", - "mixed": false - }, - "text": "Celgene Corporation" - } - ] - } - } - ], - "retrieval_details": { - "document_retrieval_strategy": "relevancy_training" - } -} diff --git a/discovery/src/test/resources/discovery/v1/stopwords.txt b/discovery/src/test/resources/discovery/v1/stopwords.txt deleted file mode 100644 index 20089a6d716..00000000000 --- a/discovery/src/test/resources/discovery/v1/stopwords.txt +++ /dev/null @@ -1,35 +0,0 @@ -| US English default stopword list - -a -an -and -are -as -at -be -but -by -for -if -in -into -is -it -no -not -of -on -or -such -that -the -their -then -there -these -they -this -to -was -will -with diff --git a/discovery/src/test/resources/discovery/v1/test-config.json b/discovery/src/test/resources/discovery/v1/test-config.json deleted file mode 100644 index 120e8b6da26..00000000000 --- a/discovery/src/test/resources/discovery/v1/test-config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "watson_developer_cloud_config" -} diff --git a/discovery/src/test/resources/discovery/v1/token_dict_status_resp.json b/discovery/src/test/resources/discovery/v1/token_dict_status_resp.json deleted file mode 100644 index d6555602405..00000000000 --- a/discovery/src/test/resources/discovery/v1/token_dict_status_resp.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "status" : "active", - "type" : "tokenization_dictionary" -} \ No newline at end of file diff --git a/discovery/src/test/resources/discovery/v1/token_dict_status_resp_stopwords.json b/discovery/src/test/resources/discovery/v1/token_dict_status_resp_stopwords.json deleted file mode 100644 index 1d08a5d7605..00000000000 --- a/discovery/src/test/resources/discovery/v1/token_dict_status_resp_stopwords.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "status" : "active", - "type" : "stopwords" -} \ No newline at end of file diff --git a/discovery/src/test/resources/discovery/v1/update_conf_resp.json b/discovery/src/test/resources/discovery/v1/update_conf_resp.json deleted file mode 100644 index 97ea6fdfb57..00000000000 --- a/discovery/src/test/resources/discovery/v1/update_conf_resp.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "name": "new-config", - "description": "this is an updated configuration", - "conversions": { - "word": { - "heading": { - "fonts": [ - { - "level": 1, - "min_size": 24, - "bold": false, - "italic": false - }, - { - "level": 2, - "min_size": 18, - "max_size": 23, - "bold": true, - "italic": false - }, - { - "level": 3, - "min_size": 14, - "max_size": 17, - "bold": false, - "italic": false - }, - { - "level": 4, - "min_size": 13, - "max_size": 13, - "bold": true, - "italic": false - } - ], - "styles": [ - { - "level": 1, - "names": [ - "pullout heading", - "pulloutheading", - "header" - ] - }, - { - "level": 2, - "names": [ - "subtitle" - ] - } - ] - } - }, - "pdf": { - "heading": { - "fonts": [ - { - "level": 1, - "min_size": 24, - "max_size": 80 - }, - { - "level": 2, - "min_size": 18, - "max_size": 24, - "bold": false, - "italic": false - }, - { - "level": 2, - "min_size": 18, - "max_size": 24, - "bold": true - }, - { - "level": 3, - "min_size": 13, - "max_size": 18, - "bold": false, - "italic": false - }, - { - "level": 3, - "min_size": 13, - "max_size": 18, - "bold": true - }, - { - "level": 4, - "min_size": 11, - "max_size": 13, - "bold": false, - "italic": false - } - ] - } - }, - "html": { - "exclude_tags_completely": [ - "script", - "sup" - ], - "exclude_tags_keep_content": [ - "font", - "em", - "span" - ], - "exclude_content": { - "xpaths": [] - }, - "keep_content": { - "xpaths": [] - }, - "exclude_tag_attributes": [ - "EVENT_ACTIONS" - ] - }, - "json_normalizations": [] - }, - "enrichments": [ - { - "destination_field": "enriched_text", - "source_field": "text", - "enrichment": "alchemy_language", - "options": { - "extract": [ - "keyword", - "entity", - "doc-sentiment", - "taxonomy", - "concept", - "relation" - ], - "sentiment": true, - "quotations": true - } - } - ] -} diff --git a/discovery/src/test/resources/discovery/v1/update_doc_resp.json b/discovery/src/test/resources/discovery/v1/update_doc_resp.json deleted file mode 100644 index bd8a195c28c..00000000000 --- a/discovery/src/test/resources/discovery/v1/update_doc_resp.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "document_id": "8691f0dd-7181-45b7-81de-5cb16206b3a1", - "status": "available" -} diff --git a/discovery/src/test/resources/discovery/v1/update_env_resp.json b/discovery/src/test/resources/discovery/v1/update_env_resp.json deleted file mode 100644 index 7a7f7e9c186..00000000000 --- a/discovery/src/test/resources/discovery/v1/update_env_resp.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "environment_id": "9e21069a-8bc1-475e-a1d3-2121c49ef060", - "name": "Andrea_environment", - "description": "Dev environment for Andrea", - "created": "2016-12-13T17:42:23.067Z", - "updated": "2016-12-14T08:22:05.231Z", - "status": "available", - "index_capacity": { - "disk_usage": { - "used_bytes": 0, - "total_bytes": 1073741824, - "used": "0 KB", - "total": "1024 MB", - "percent_used": 0 - }, - "memory_usage": { - "used_bytes": 139035968, - "total_bytes": 518979584, - "used": "132.6 MB", - "total": "494.94 MB", - "percent_used": 26.79 - } - } -} diff --git a/discovery/src/test/resources/discovery/v1/update_training_example_resp.json b/discovery/src/test/resources/discovery/v1/update_training_example_resp.json deleted file mode 100644 index 68a65bd2934..00000000000 --- a/discovery/src/test/resources/discovery/v1/update_training_example_resp.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "document_id": "mock_docid", - "relevance": 100 -} \ No newline at end of file