diff --git a/sdk/elastic/azure-resourcemanager-elastic/CHANGELOG.md b/sdk/elastic/azure-resourcemanager-elastic/CHANGELOG.md index de2b6296de857..0cfa4d9a45ebb 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/CHANGELOG.md +++ b/sdk/elastic/azure-resourcemanager-elastic/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.4 (Unreleased) +## 1.0.0-beta.1 (2023-05-17) + +- Azure Resource Manager elastic client library for Java. This package contains Microsoft Azure SDK for elastic Management SDK. Package tag package-2023-02-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/elastic/azure-resourcemanager-elastic/README.md b/sdk/elastic/azure-resourcemanager-elastic/README.md index 7b55511e3fa6d..33c6d93d9afac 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/README.md +++ b/sdk/elastic/azure-resourcemanager-elastic/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-elastic - 1.0.0-beta.3 + 1.0.0-beta.4 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/elastic/azure-resourcemanager-elastic/SAMPLE.md b/sdk/elastic/azure-resourcemanager-elastic/SAMPLE.md index 4c3909175a460..db19761c9e325 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/SAMPLE.md +++ b/sdk/elastic/azure-resourcemanager-elastic/SAMPLE.md @@ -263,7 +263,7 @@ public final class ElasticVersionsListSamples { * @param manager Entry point to ElasticManager. */ public static void elasticVersionsList(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.elasticVersions().listWithResponse("myregion", com.azure.core.util.Context.NONE); + manager.elasticVersions().list("myregion", com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/ElasticManager.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/ElasticManager.java index aac8cc04c532f..2ccdffb6333c8 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/ElasticManager.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/ElasticManager.java @@ -283,7 +283,7 @@ public ElasticManager authenticate(TokenCredential credential, AzureProfile prof .append("-") .append("com.azure.resourcemanager.elastic") .append("/") - .append("1.0.0-beta.3"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/ElasticVersionsClient.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/ElasticVersionsClient.java index e10278af3543a..bc5175593b7ad 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/ElasticVersionsClient.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/ElasticVersionsClient.java @@ -6,9 +6,9 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionsListResponseInner; +import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionListFormatInner; /** An instance of this class provides access to all the operations defined in ElasticVersionsClient. */ public interface ElasticVersionsClient { @@ -16,24 +16,24 @@ public interface ElasticVersionsClient { * Get a list of available versions for a region. * * @param region Region where elastic deployment will take place. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of available versions for a region along with {@link Response}. + * @return a list of available versions for a region as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response listWithResponse(String region, Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String region); /** * Get a list of available versions for a region. * * @param region Region where elastic deployment will take place. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of available versions for a region. + * @return a list of available versions for a region as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - ElasticVersionsListResponseInner list(String region); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String region, Context context); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/ElasticVersionListFormatInner.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/ElasticVersionListFormatInner.java new file mode 100644 index 0000000000000..c469a07bd9b2c --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/ElasticVersionListFormatInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.elastic.models.ElasticVersionListProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Elastic Version List Format. */ +@Fluent +public final class ElasticVersionListFormatInner { + /* + * Elastic Version Properties + */ + @JsonProperty(value = "properties") + private ElasticVersionListProperties properties; + + /** Creates an instance of ElasticVersionListFormatInner class. */ + public ElasticVersionListFormatInner() { + } + + /** + * Get the properties property: Elastic Version Properties. + * + * @return the properties value. + */ + public ElasticVersionListProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Elastic Version Properties. + * + * @param properties the properties value to set. + * @return the ElasticVersionListFormatInner object itself. + */ + public ElasticVersionListFormatInner withProperties(ElasticVersionListProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/ElasticVersionsListResponseInner.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/ElasticVersionsListResponseInner.java deleted file mode 100644 index 34abcd2d7e3a9..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/ElasticVersionsListResponseInner.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.fluent.models; - -import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** List of elastic versions available in a region. */ -@Fluent -public final class ElasticVersionsListResponseInner { - /* - * Results of a list operation. - */ - @JsonProperty(value = "value") - private List value; - - /* - * Link to the next set of results, if any. - */ - @JsonProperty(value = "nextLink") - private String nextLink; - - /** Creates an instance of ElasticVersionsListResponseInner class. */ - public ElasticVersionsListResponseInner() { - } - - /** - * Get the value property: Results of a list operation. - * - * @return the value value. - */ - public List value() { - return this.value; - } - - /** - * Set the value property: Results of a list operation. - * - * @param value the value value to set. - * @return the ElasticVersionsListResponseInner object itself. - */ - public ElasticVersionsListResponseInner withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: Link to the next set of results, if any. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: Link to the next set of results, if any. - * - * @param nextLink the nextLink value to set. - * @return the ElasticVersionsListResponseInner object itself. - */ - public ElasticVersionsListResponseInner withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/UserApiKeyResponseInner.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/UserApiKeyResponseInner.java index 59cc8323b14a3..0fea731c006e2 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/UserApiKeyResponseInner.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/fluent/models/UserApiKeyResponseInner.java @@ -5,40 +5,39 @@ package com.azure.resourcemanager.elastic.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.elastic.models.UserApiKeyResponseProperties; import com.fasterxml.jackson.annotation.JsonProperty; /** The User Api Key created for the Organization associated with the User Email Id that was passed in the request. */ @Fluent public final class UserApiKeyResponseInner { /* - * The User Api Key Generated based on ReturnApiKey flag. This is applicable for non-Portal clients only. + * The properties property. */ - @JsonProperty(value = "apiKey") - private String apiKey; + @JsonProperty(value = "properties") + private UserApiKeyResponseProperties properties; /** Creates an instance of UserApiKeyResponseInner class. */ public UserApiKeyResponseInner() { } /** - * Get the apiKey property: The User Api Key Generated based on ReturnApiKey flag. This is applicable for non-Portal - * clients only. + * Get the properties property: The properties property. * - * @return the apiKey value. + * @return the properties value. */ - public String apiKey() { - return this.apiKey; + public UserApiKeyResponseProperties properties() { + return this.properties; } /** - * Set the apiKey property: The User Api Key Generated based on ReturnApiKey flag. This is applicable for non-Portal - * clients only. + * Set the properties property: The properties property. * - * @param apiKey the apiKey value to set. + * @param properties the properties value to set. * @return the UserApiKeyResponseInner object itself. */ - public UserApiKeyResponseInner withApiKey(String apiKey) { - this.apiKey = apiKey; + public UserApiKeyResponseInner withProperties(UserApiKeyResponseProperties properties) { + this.properties = properties; return this; } @@ -48,5 +47,8 @@ public UserApiKeyResponseInner withApiKey(String apiKey) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (properties() != null) { + properties().validate(); + } } } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionListFormatImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionListFormatImpl.java new file mode 100644 index 0000000000000..d10a42a6bd8e6 --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionListFormatImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.implementation; + +import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionListFormatInner; +import com.azure.resourcemanager.elastic.models.ElasticVersionListFormat; +import com.azure.resourcemanager.elastic.models.ElasticVersionListProperties; + +public final class ElasticVersionListFormatImpl implements ElasticVersionListFormat { + private ElasticVersionListFormatInner innerObject; + + private final com.azure.resourcemanager.elastic.ElasticManager serviceManager; + + ElasticVersionListFormatImpl( + ElasticVersionListFormatInner innerObject, com.azure.resourcemanager.elastic.ElasticManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ElasticVersionListProperties properties() { + return this.innerModel().properties(); + } + + public ElasticVersionListFormatInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.elastic.ElasticManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsClientImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsClientImpl.java index e343522026824..c7aa53d15bce5 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsClientImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsClientImpl.java @@ -16,13 +16,18 @@ import com.azure.core.annotation.ServiceInterface; import com.azure.core.annotation.ServiceMethod; import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.elastic.fluent.ElasticVersionsClient; -import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionsListResponseInner; +import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionListFormatInner; +import com.azure.resourcemanager.elastic.models.ElasticVersionsListResponse; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in ElasticVersionsClient. */ @@ -55,13 +60,23 @@ public interface ElasticVersionsService { @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/elasticVersions") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list( + Mono> list( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @QueryParam("region") String region, @HeaderParam("Accept") String accept, Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); } /** @@ -71,11 +86,11 @@ Mono> list( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of available versions for a region along with {@link Response} on successful completion of {@link - * Mono}. + * @return a list of available versions for a region along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync(String region) { + private Mono> listSinglePageAsync(String region) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -103,6 +118,15 @@ private Mono> listWithResponseAsync(S region, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -114,11 +138,11 @@ private Mono> listWithResponseAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of available versions for a region along with {@link Response} on successful completion of {@link - * Mono}. + * @return a list of available versions for a region along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync(String region, Context context) { + private Mono> listSinglePageAsync(String region, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -143,7 +167,16 @@ private Mono> listWithResponseAsync(S this.client.getSubscriptionId(), region, accept, - context); + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); } /** @@ -153,11 +186,11 @@ private Mono> listWithResponseAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of available versions for a region on successful completion of {@link Mono}. + * @return a list of available versions for a region as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono listAsync(String region) { - return listWithResponseAsync(region).flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String region) { + return new PagedFlux<>(() -> listSinglePageAsync(region), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -168,11 +201,12 @@ private Mono listAsync(String region) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of available versions for a region along with {@link Response}. + * @return a list of available versions for a region as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response listWithResponse(String region, Context context) { - return listWithResponseAsync(region, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String region, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(region, context), nextLink -> listNextSinglePageAsync(nextLink, context)); } /** @@ -182,10 +216,101 @@ public Response listWithResponse(String region * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of available versions for a region. + * @return a list of available versions for a region as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String region) { + return new PagedIterable<>(listAsync(region)); + } + + /** + * Get a list of available versions for a region. + * + * @param region Region where elastic deployment will take place. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of available versions for a region as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String region, Context context) { + return new PagedIterable<>(listAsync(region, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of elastic versions available in a region along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of elastic versions available in a region along with {@link PagedResponse} on successful completion + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ElasticVersionsListResponseInner list(String region) { - return listWithResponse(region, Context.NONE).getValue(); + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); } } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsImpl.java index ca637a231484d..8ace4748fa688 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsImpl.java @@ -4,14 +4,13 @@ package com.azure.resourcemanager.elastic.implementation; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.elastic.fluent.ElasticVersionsClient; -import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionsListResponseInner; +import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionListFormatInner; +import com.azure.resourcemanager.elastic.models.ElasticVersionListFormat; import com.azure.resourcemanager.elastic.models.ElasticVersions; -import com.azure.resourcemanager.elastic.models.ElasticVersionsListResponse; public final class ElasticVersionsImpl implements ElasticVersions { private static final ClientLogger LOGGER = new ClientLogger(ElasticVersionsImpl.class); @@ -26,26 +25,14 @@ public ElasticVersionsImpl( this.serviceManager = serviceManager; } - public Response listWithResponse(String region, Context context) { - Response inner = this.serviceClient().listWithResponse(region, context); - if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new ElasticVersionsListResponseImpl(inner.getValue(), this.manager())); - } else { - return null; - } + public PagedIterable list(String region) { + PagedIterable inner = this.serviceClient().list(region); + return Utils.mapPage(inner, inner1 -> new ElasticVersionListFormatImpl(inner1, this.manager())); } - public ElasticVersionsListResponse list(String region) { - ElasticVersionsListResponseInner inner = this.serviceClient().list(region); - if (inner != null) { - return new ElasticVersionsListResponseImpl(inner, this.manager()); - } else { - return null; - } + public PagedIterable list(String region, Context context) { + PagedIterable inner = this.serviceClient().list(region, context); + return Utils.mapPage(inner, inner1 -> new ElasticVersionListFormatImpl(inner1, this.manager())); } private ElasticVersionsClient serviceClient() { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsListResponseImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsListResponseImpl.java deleted file mode 100644 index 9630e38d3a8fc..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/ElasticVersionsListResponseImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.implementation; - -import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionsListResponseInner; -import com.azure.resourcemanager.elastic.models.ElasticVersionsListResponse; -import java.util.Collections; -import java.util.List; - -public final class ElasticVersionsListResponseImpl implements ElasticVersionsListResponse { - private ElasticVersionsListResponseInner innerObject; - - private final com.azure.resourcemanager.elastic.ElasticManager serviceManager; - - ElasticVersionsListResponseImpl( - ElasticVersionsListResponseInner innerObject, com.azure.resourcemanager.elastic.ElasticManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public List value() { - List inner = this.innerModel().value(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public String nextLink() { - return this.innerModel().nextLink(); - } - - public ElasticVersionsListResponseInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.elastic.ElasticManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/UserApiKeyResponseImpl.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/UserApiKeyResponseImpl.java index ed75c4f9d49a9..9047a7a5e42a3 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/UserApiKeyResponseImpl.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/implementation/UserApiKeyResponseImpl.java @@ -6,6 +6,7 @@ import com.azure.resourcemanager.elastic.fluent.models.UserApiKeyResponseInner; import com.azure.resourcemanager.elastic.models.UserApiKeyResponse; +import com.azure.resourcemanager.elastic.models.UserApiKeyResponseProperties; public final class UserApiKeyResponseImpl implements UserApiKeyResponse { private UserApiKeyResponseInner innerObject; @@ -18,8 +19,8 @@ public final class UserApiKeyResponseImpl implements UserApiKeyResponse { this.serviceManager = serviceManager; } - public String apiKey() { - return this.innerModel().apiKey(); + public UserApiKeyResponseProperties properties() { + return this.innerModel().properties(); } public UserApiKeyResponseInner innerModel() { diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionListFormat.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionListFormat.java new file mode 100644 index 0000000000000..cb4914dc9931b --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionListFormat.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionListFormatInner; + +/** An immutable client-side representation of ElasticVersionListFormat. */ +public interface ElasticVersionListFormat { + /** + * Gets the properties property: Elastic Version Properties. + * + * @return the properties value. + */ + ElasticVersionListProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.elastic.fluent.models.ElasticVersionListFormatInner object. + * + * @return the inner object. + */ + ElasticVersionListFormatInner innerModel(); +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionListProperties.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionListProperties.java new file mode 100644 index 0000000000000..3dcdb74e6ad1d --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionListProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Elastic Version Properties. */ +@Fluent +public final class ElasticVersionListProperties { + /* + * Available elastic version of the given region + */ + @JsonProperty(value = "version") + private String version; + + /** Creates an instance of ElasticVersionListProperties class. */ + public ElasticVersionListProperties() { + } + + /** + * Get the version property: Available elastic version of the given region. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Available elastic version of the given region. + * + * @param version the version value to set. + * @return the ElasticVersionListProperties object itself. + */ + public ElasticVersionListProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersions.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersions.java index 1a8371c87abab..1dbb69629b0a3 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersions.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersions.java @@ -4,7 +4,7 @@ package com.azure.resourcemanager.elastic.models; -import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; /** Resource collection API of ElasticVersions. */ @@ -13,22 +13,22 @@ public interface ElasticVersions { * Get a list of available versions for a region. * * @param region Region where elastic deployment will take place. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of available versions for a region along with {@link Response}. + * @return a list of available versions for a region as paginated response with {@link PagedIterable}. */ - Response listWithResponse(String region, Context context); + PagedIterable list(String region); /** * Get a list of available versions for a region. * * @param region Region where elastic deployment will take place. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of available versions for a region. + * @return a list of available versions for a region as paginated response with {@link PagedIterable}. */ - ElasticVersionsListResponse list(String region); + PagedIterable list(String region, Context context); } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionsListResponse.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionsListResponse.java index a511c49b188ca..726e4f7cff575 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionsListResponse.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/ElasticVersionsListResponse.java @@ -4,29 +4,78 @@ package com.azure.resourcemanager.elastic.models; -import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionsListResponseInner; +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionListFormatInner; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** An immutable client-side representation of ElasticVersionsListResponse. */ -public interface ElasticVersionsListResponse { +/** List of elastic versions available in a region. */ +@Fluent +public final class ElasticVersionsListResponse { + /* + * Results of a list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results, if any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of ElasticVersionsListResponse class. */ + public ElasticVersionsListResponse() { + } + /** - * Gets the value property: Results of a list operation. + * Get the value property: Results of a list operation. * * @return the value value. */ - List value(); + public List value() { + return this.value; + } /** - * Gets the nextLink property: Link to the next set of results, if any. + * Set the value property: Results of a list operation. + * + * @param value the value value to set. + * @return the ElasticVersionsListResponse object itself. + */ + public ElasticVersionsListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results, if any. * * @return the nextLink value. */ - String nextLink(); + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link to the next set of results, if any. + * + * @param nextLink the nextLink value to set. + * @return the ElasticVersionsListResponse object itself. + */ + public ElasticVersionsListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } /** - * Gets the inner com.azure.resourcemanager.elastic.fluent.models.ElasticVersionsListResponseInner object. + * Validates the instance. * - * @return the inner object. + * @throws IllegalArgumentException thrown if the instance is not valid. */ - ElasticVersionsListResponseInner innerModel(); + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/UserApiKeyResponse.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/UserApiKeyResponse.java index 34d60b22ba891..80a365791bd16 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/UserApiKeyResponse.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/UserApiKeyResponse.java @@ -9,12 +9,11 @@ /** An immutable client-side representation of UserApiKeyResponse. */ public interface UserApiKeyResponse { /** - * Gets the apiKey property: The User Api Key Generated based on ReturnApiKey flag. This is applicable for - * non-Portal clients only. + * Gets the properties property: The properties property. * - * @return the apiKey value. + * @return the properties value. */ - String apiKey(); + UserApiKeyResponseProperties properties(); /** * Gets the inner com.azure.resourcemanager.elastic.fluent.models.UserApiKeyResponseInner object. diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/UserApiKeyResponseProperties.java b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/UserApiKeyResponseProperties.java new file mode 100644 index 0000000000000..c0beb51eb4dbb --- /dev/null +++ b/sdk/elastic/azure-resourcemanager-elastic/src/main/java/com/azure/resourcemanager/elastic/models/UserApiKeyResponseProperties.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.elastic.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The UserApiKeyResponseProperties model. */ +@Fluent +public final class UserApiKeyResponseProperties { + /* + * The User Api Key Generated based on GenerateApiKey flag. This is applicable for non-Portal clients only. + */ + @JsonProperty(value = "apiKey") + private String apiKey; + + /** Creates an instance of UserApiKeyResponseProperties class. */ + public UserApiKeyResponseProperties() { + } + + /** + * Get the apiKey property: The User Api Key Generated based on GenerateApiKey flag. This is applicable for + * non-Portal clients only. + * + * @return the apiKey value. + */ + public String apiKey() { + return this.apiKey; + } + + /** + * Set the apiKey property: The User Api Key Generated based on GenerateApiKey flag. This is applicable for + * non-Portal clients only. + * + * @param apiKey the apiKey value to set. + * @return the UserApiKeyResponseProperties object itself. + */ + public UserApiKeyResponseProperties withApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListSamples.java b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListSamples.java index ef2aed3ccdf9f..37fc6580aea44 100644 --- a/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListSamples.java +++ b/sdk/elastic/azure-resourcemanager-elastic/src/samples/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListSamples.java @@ -15,6 +15,6 @@ public final class ElasticVersionsListSamples { * @param manager Entry point to ElasticManager. */ public static void elasticVersionsList(com.azure.resourcemanager.elastic.ElasticManager manager) { - manager.elasticVersions().listWithResponse("myregion", com.azure.core.util.Context.NONE); + manager.elasticVersions().list("myregion", com.azure.core.util.Context.NONE); } } diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/AllTrafficFiltersListWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/AllTrafficFiltersListWithResponseMockTests.java deleted file mode 100644 index 82ca5e39dd8fa..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/AllTrafficFiltersListWithResponseMockTests.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.ElasticTrafficFilterResponse; -import com.azure.resourcemanager.elastic.models.Type; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class AllTrafficFiltersListWithResponseMockTests { - @Test - public void testListWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"rulesets\":[{\"id\":\"bh\",\"name\":\"nlankxmyskpb\",\"description\":\"nbtkcxywnytnr\",\"region\":\"nlqidybyxczf\",\"type\":\"azure_private_endpoint\",\"includeByDefault\":false,\"rules\":[]},{\"id\":\"abphlw\",\"name\":\"lfktsths\",\"description\":\"ocmnyyazttbtwwrq\",\"region\":\"edckzywbiexzfey\",\"type\":\"ip\",\"includeByDefault\":false,\"rules\":[]},{\"id\":\"jwbhqwalmuz\",\"name\":\"xaepdkzjancuxr\",\"description\":\"wbavxbniwdj\",\"region\":\"zt\",\"type\":\"ip\",\"includeByDefault\":true,\"rules\":[]}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ElasticTrafficFilterResponse response = - manager - .allTrafficFilters() - .listWithResponse("na", "zmhjrunmp", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("bh", response.rulesets().get(0).id()); - Assertions.assertEquals("nlankxmyskpb", response.rulesets().get(0).name()); - Assertions.assertEquals("nbtkcxywnytnr", response.rulesets().get(0).description()); - Assertions.assertEquals("nlqidybyxczf", response.rulesets().get(0).region()); - Assertions.assertEquals(Type.AZURE_PRIVATE_ENDPOINT, response.rulesets().get(0).type()); - Assertions.assertEquals(false, response.rulesets().get(0).includeByDefault()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CompanyInfoTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CompanyInfoTests.java deleted file mode 100644 index 8fd3d14b87559..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CompanyInfoTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.CompanyInfo; -import org.junit.jupiter.api.Assertions; - -public final class CompanyInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CompanyInfo model = - BinaryData - .fromString( - "{\"domain\":\"ndv\",\"business\":\"ozwyiftyhxhuro\",\"employeesNumber\":\"tyxolniwpwc\",\"state\":\"jfkgiawxk\",\"country\":\"ypl\"}") - .toObject(CompanyInfo.class); - Assertions.assertEquals("ndv", model.domain()); - Assertions.assertEquals("ozwyiftyhxhuro", model.business()); - Assertions.assertEquals("tyxolniwpwc", model.employeesNumber()); - Assertions.assertEquals("jfkgiawxk", model.state()); - Assertions.assertEquals("ypl", model.country()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CompanyInfo model = - new CompanyInfo() - .withDomain("ndv") - .withBusiness("ozwyiftyhxhuro") - .withEmployeesNumber("tyxolniwpwc") - .withState("jfkgiawxk") - .withCountry("ypl"); - model = BinaryData.fromObject(model).toObject(CompanyInfo.class); - Assertions.assertEquals("ndv", model.domain()); - Assertions.assertEquals("ozwyiftyhxhuro", model.business()); - Assertions.assertEquals("tyxolniwpwc", model.employeesNumber()); - Assertions.assertEquals("jfkgiawxk", model.state()); - Assertions.assertEquals("ypl", model.country()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociateIpFiltersCreateMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociateIpFiltersCreateMockTests.java deleted file mode 100644 index af0a3a9caa148..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociateIpFiltersCreateMockTests.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class CreateAndAssociateIpFiltersCreateMockTests { - @Test - public void testCreate() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager - .createAndAssociateIpFilters() - .create("kfplgmgsxnk", "zkd", "slpvlop", "i", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociatePLFiltersCreateMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociatePLFiltersCreateMockTests.java deleted file mode 100644 index c402b82e4f93a..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/CreateAndAssociatePLFiltersCreateMockTests.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class CreateAndAssociatePLFiltersCreateMockTests { - @Test - public void testCreate() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager - .createAndAssociatePLFilters() - .create("ighxpk", "wzbaiue", "baumnyqupedeoj", "a", "ckhsmtxpsieb", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoResponseInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoResponseInnerTests.java deleted file mode 100644 index 51cb05bc9cd43..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoResponseInnerTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.DeploymentInfoResponseInner; - -public final class DeploymentInfoResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DeploymentInfoResponseInner model = - BinaryData - .fromString( - "{\"status\":\"Unhealthy\",\"version\":\"jaoyfhrtx\",\"memoryCapacity\":\"n\",\"diskCapacity\":\"kujysvlejuvfq\",\"deploymentUrl\":\"rlyxwjkcprbnw\",\"marketplaceSaasInfo\":{\"marketplaceSubscription\":{\"id\":\"vtb\"},\"marketplaceName\":\"ysszdnrujqguh\",\"marketplaceResourceId\":\"ouqfprwz\"}}") - .toObject(DeploymentInfoResponseInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DeploymentInfoResponseInner model = new DeploymentInfoResponseInner(); - model = BinaryData.fromObject(model).toObject(DeploymentInfoResponseInner.class); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoesListWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoesListWithResponseMockTests.java deleted file mode 100644 index 76f782e7d1dac..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DeploymentInfoesListWithResponseMockTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.DeploymentInfoResponse; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class DeploymentInfoesListWithResponseMockTests { - @Test - public void testListWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"status\":\"Healthy\",\"version\":\"buhfmvfaxkffeiit\",\"memoryCapacity\":\"vmezy\",\"diskCapacity\":\"hxmzsbbzoggig\",\"deploymentUrl\":\"wburvjxxjnspydpt\",\"marketplaceSaasInfo\":{\"marketplaceSubscription\":{\"id\":\"kouknvudwtiu\"},\"marketplaceName\":\"ldngkpoci\",\"marketplaceResourceId\":\"z\"}}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - DeploymentInfoResponse response = - manager - .deploymentInfoes() - .listWithResponse("csonpclhoco", "slkevle", com.azure.core.util.Context.NONE) - .getValue(); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DetachAndDeleteTrafficFiltersDeleteWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DetachAndDeleteTrafficFiltersDeleteWithResponseMockTests.java deleted file mode 100644 index e3152f9502277..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/DetachAndDeleteTrafficFiltersDeleteWithResponseMockTests.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class DetachAndDeleteTrafficFiltersDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager - .detachAndDeleteTrafficFilters() - .deleteWithResponse("fhvpesaps", "rdqmhjjdhtldwkyz", "uutkncw", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticCloudDeploymentTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticCloudDeploymentTests.java deleted file mode 100644 index 4d4f87dea6a88..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticCloudDeploymentTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticCloudDeployment; - -public final class ElasticCloudDeploymentTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticCloudDeployment model = - BinaryData - .fromString( - "{\"name\":\"wclxxwrl\",\"deploymentId\":\"ouskcqvkocrc\",\"azureSubscriptionId\":\"kwt\",\"elasticsearchRegion\":\"xbnjbiksq\",\"elasticsearchServiceUrl\":\"lssai\",\"kibanaServiceUrl\":\"p\",\"kibanaSsoUrl\":\"nzl\"}") - .toObject(ElasticCloudDeployment.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticCloudDeployment model = new ElasticCloudDeployment(); - model = BinaryData.fromObject(model).toObject(ElasticCloudDeployment.class); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticCloudUserTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticCloudUserTests.java deleted file mode 100644 index 6d1847d79e135..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticCloudUserTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticCloudUser; - -public final class ElasticCloudUserTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticCloudUser model = - BinaryData - .fromString( - "{\"emailAddress\":\"jaeq\",\"id\":\"qjbasvms\",\"elasticCloudSsoDefaultUrl\":\"qulngsntnbybkzgc\"}") - .toObject(ElasticCloudUser.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticCloudUser model = new ElasticCloudUser(); - model = BinaryData.fromObject(model).toObject(ElasticCloudUser.class); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticMonitorResourceUpdateParametersTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticMonitorResourceUpdateParametersTests.java deleted file mode 100644 index 3a6a136106eec..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticMonitorResourceUpdateParametersTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticMonitorResourceUpdateParameters; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ElasticMonitorResourceUpdateParametersTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticMonitorResourceUpdateParameters model = - BinaryData - .fromString("{\"tags\":{\"kzsmodm\":\"tbciqfouflmm\"}}") - .toObject(ElasticMonitorResourceUpdateParameters.class); - Assertions.assertEquals("tbciqfouflmm", model.tags().get("kzsmodm")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticMonitorResourceUpdateParameters model = - new ElasticMonitorResourceUpdateParameters().withTags(mapOf("kzsmodm", "tbciqfouflmm")); - model = BinaryData.fromObject(model).toObject(ElasticMonitorResourceUpdateParameters.class); - Assertions.assertEquals("tbciqfouflmm", model.tags().get("kzsmodm")); - } - - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticMonitorUpgradeTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticMonitorUpgradeTests.java deleted file mode 100644 index c9c2a26e6297c..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticMonitorUpgradeTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticMonitorUpgrade; -import org.junit.jupiter.api.Assertions; - -public final class ElasticMonitorUpgradeTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticMonitorUpgrade model = - BinaryData.fromString("{\"version\":\"xibqeojnx\"}").toObject(ElasticMonitorUpgrade.class); - Assertions.assertEquals("xibqeojnx", model.version()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticMonitorUpgrade model = new ElasticMonitorUpgrade().withVersion("xibqeojnx"); - model = BinaryData.fromObject(model).toObject(ElasticMonitorUpgrade.class); - Assertions.assertEquals("xibqeojnx", model.version()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticPropertiesTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticPropertiesTests.java deleted file mode 100644 index ebee27d335b9e..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticPropertiesTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticCloudDeployment; -import com.azure.resourcemanager.elastic.models.ElasticCloudUser; -import com.azure.resourcemanager.elastic.models.ElasticProperties; - -public final class ElasticPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticProperties model = - BinaryData - .fromString( - "{\"elasticCloudUser\":{\"emailAddress\":\"xofpdvhpfxxypi\",\"id\":\"nmayhuybb\",\"elasticCloudSsoDefaultUrl\":\"odepoogin\"},\"elasticCloudDeployment\":{\"name\":\"mihe\",\"deploymentId\":\"narxzxtheotus\",\"azureSubscriptionId\":\"yevc\",\"elasticsearchRegion\":\"qi\",\"elasticsearchServiceUrl\":\"hungbwjzrnf\",\"kibanaServiceUrl\":\"xgispemvtzfkufu\",\"kibanaSsoUrl\":\"jofxqe\"}}") - .toObject(ElasticProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticProperties model = - new ElasticProperties() - .withElasticCloudUser(new ElasticCloudUser()) - .withElasticCloudDeployment(new ElasticCloudDeployment()); - model = BinaryData.fromObject(model).toObject(ElasticProperties.class); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterResponseInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterResponseInnerTests.java deleted file mode 100644 index 09a204a489df8..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterResponseInnerTests.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.ElasticTrafficFilterResponseInner; -import com.azure.resourcemanager.elastic.models.ElasticTrafficFilter; -import com.azure.resourcemanager.elastic.models.Type; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ElasticTrafficFilterResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticTrafficFilterResponseInner model = - BinaryData - .fromString( - "{\"rulesets\":[{\"id\":\"ddntwndei\",\"name\":\"twnpzaoqvuhrhcf\",\"description\":\"yd\",\"region\":\"lmjthjq\",\"type\":\"ip\",\"includeByDefault\":true,\"rules\":[]},{\"id\":\"mqc\",\"name\":\"q\",\"description\":\"khixuigdtopbo\",\"region\":\"og\",\"type\":\"ip\",\"includeByDefault\":false,\"rules\":[]},{\"id\":\"uhrzayvvt\",\"name\":\"vdfgiotk\",\"description\":\"utqxlngx\",\"region\":\"fgugnxkrxdqmid\",\"type\":\"ip\",\"includeByDefault\":false,\"rules\":[]},{\"id\":\"rabhjybigeho\",\"name\":\"bowsk\",\"description\":\"yktz\",\"region\":\"u\",\"type\":\"ip\",\"includeByDefault\":false,\"rules\":[]}]}") - .toObject(ElasticTrafficFilterResponseInner.class); - Assertions.assertEquals("ddntwndei", model.rulesets().get(0).id()); - Assertions.assertEquals("twnpzaoqvuhrhcf", model.rulesets().get(0).name()); - Assertions.assertEquals("yd", model.rulesets().get(0).description()); - Assertions.assertEquals("lmjthjq", model.rulesets().get(0).region()); - Assertions.assertEquals(Type.IP, model.rulesets().get(0).type()); - Assertions.assertEquals(true, model.rulesets().get(0).includeByDefault()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticTrafficFilterResponseInner model = - new ElasticTrafficFilterResponseInner() - .withRulesets( - Arrays - .asList( - new ElasticTrafficFilter() - .withId("ddntwndei") - .withName("twnpzaoqvuhrhcf") - .withDescription("yd") - .withRegion("lmjthjq") - .withType(Type.IP) - .withIncludeByDefault(true) - .withRules(Arrays.asList()), - new ElasticTrafficFilter() - .withId("mqc") - .withName("q") - .withDescription("khixuigdtopbo") - .withRegion("og") - .withType(Type.IP) - .withIncludeByDefault(false) - .withRules(Arrays.asList()), - new ElasticTrafficFilter() - .withId("uhrzayvvt") - .withName("vdfgiotk") - .withDescription("utqxlngx") - .withRegion("fgugnxkrxdqmid") - .withType(Type.IP) - .withIncludeByDefault(false) - .withRules(Arrays.asList()), - new ElasticTrafficFilter() - .withId("rabhjybigeho") - .withName("bowsk") - .withDescription("yktz") - .withRegion("u") - .withType(Type.IP) - .withIncludeByDefault(false) - .withRules(Arrays.asList()))); - model = BinaryData.fromObject(model).toObject(ElasticTrafficFilterResponseInner.class); - Assertions.assertEquals("ddntwndei", model.rulesets().get(0).id()); - Assertions.assertEquals("twnpzaoqvuhrhcf", model.rulesets().get(0).name()); - Assertions.assertEquals("yd", model.rulesets().get(0).description()); - Assertions.assertEquals("lmjthjq", model.rulesets().get(0).region()); - Assertions.assertEquals(Type.IP, model.rulesets().get(0).type()); - Assertions.assertEquals(true, model.rulesets().get(0).includeByDefault()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterRuleTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterRuleTests.java deleted file mode 100644 index a4fc70e95108b..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterRuleTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticTrafficFilterRule; -import org.junit.jupiter.api.Assertions; - -public final class ElasticTrafficFilterRuleTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticTrafficFilterRule model = - BinaryData - .fromString( - "{\"source\":\"gtzxdpn\",\"description\":\"qqwx\",\"azureEndpointGuid\":\"feallnwsu\",\"azureEndpointName\":\"snjampmng\",\"id\":\"scxaq\"}") - .toObject(ElasticTrafficFilterRule.class); - Assertions.assertEquals("gtzxdpn", model.source()); - Assertions.assertEquals("qqwx", model.description()); - Assertions.assertEquals("feallnwsu", model.azureEndpointGuid()); - Assertions.assertEquals("snjampmng", model.azureEndpointName()); - Assertions.assertEquals("scxaq", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticTrafficFilterRule model = - new ElasticTrafficFilterRule() - .withSource("gtzxdpn") - .withDescription("qqwx") - .withAzureEndpointGuid("feallnwsu") - .withAzureEndpointName("snjampmng") - .withId("scxaq"); - model = BinaryData.fromObject(model).toObject(ElasticTrafficFilterRule.class); - Assertions.assertEquals("gtzxdpn", model.source()); - Assertions.assertEquals("qqwx", model.description()); - Assertions.assertEquals("feallnwsu", model.azureEndpointGuid()); - Assertions.assertEquals("snjampmng", model.azureEndpointName()); - Assertions.assertEquals("scxaq", model.id()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterTests.java deleted file mode 100644 index a4f401100f80f..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticTrafficFilterTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ElasticTrafficFilter; -import com.azure.resourcemanager.elastic.models.ElasticTrafficFilterRule; -import com.azure.resourcemanager.elastic.models.Type; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ElasticTrafficFilterTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticTrafficFilter model = - BinaryData - .fromString( - "{\"id\":\"ndrvynhzg\",\"name\":\"hrc\",\"description\":\"nc\",\"region\":\"pec\",\"type\":\"ip\",\"includeByDefault\":true,\"rules\":[{\"source\":\"sxlzevgbmqj\",\"description\":\"bcypmi\",\"azureEndpointGuid\":\"w\",\"azureEndpointName\":\"uvcc\",\"id\":\"nfnbacfionlebxe\"}]}") - .toObject(ElasticTrafficFilter.class); - Assertions.assertEquals("ndrvynhzg", model.id()); - Assertions.assertEquals("hrc", model.name()); - Assertions.assertEquals("nc", model.description()); - Assertions.assertEquals("pec", model.region()); - Assertions.assertEquals(Type.IP, model.type()); - Assertions.assertEquals(true, model.includeByDefault()); - Assertions.assertEquals("sxlzevgbmqj", model.rules().get(0).source()); - Assertions.assertEquals("bcypmi", model.rules().get(0).description()); - Assertions.assertEquals("w", model.rules().get(0).azureEndpointGuid()); - Assertions.assertEquals("uvcc", model.rules().get(0).azureEndpointName()); - Assertions.assertEquals("nfnbacfionlebxe", model.rules().get(0).id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticTrafficFilter model = - new ElasticTrafficFilter() - .withId("ndrvynhzg") - .withName("hrc") - .withDescription("nc") - .withRegion("pec") - .withType(Type.IP) - .withIncludeByDefault(true) - .withRules( - Arrays - .asList( - new ElasticTrafficFilterRule() - .withSource("sxlzevgbmqj") - .withDescription("bcypmi") - .withAzureEndpointGuid("w") - .withAzureEndpointName("uvcc") - .withId("nfnbacfionlebxe"))); - model = BinaryData.fromObject(model).toObject(ElasticTrafficFilter.class); - Assertions.assertEquals("ndrvynhzg", model.id()); - Assertions.assertEquals("hrc", model.name()); - Assertions.assertEquals("nc", model.description()); - Assertions.assertEquals("pec", model.region()); - Assertions.assertEquals(Type.IP, model.type()); - Assertions.assertEquals(true, model.includeByDefault()); - Assertions.assertEquals("sxlzevgbmqj", model.rules().get(0).source()); - Assertions.assertEquals("bcypmi", model.rules().get(0).description()); - Assertions.assertEquals("w", model.rules().get(0).azureEndpointGuid()); - Assertions.assertEquals("uvcc", model.rules().get(0).azureEndpointName()); - Assertions.assertEquals("nfnbacfionlebxe", model.rules().get(0).id()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListResponseInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListResponseInnerTests.java deleted file mode 100644 index 0a92d322209a1..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListResponseInnerTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.ElasticVersionsListResponseInner; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ElasticVersionsListResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ElasticVersionsListResponseInner model = - BinaryData - .fromString("{\"value\":[\"ulzndlikwyqk\",\"fgibmadgakeq\",\"rxybz\"],\"nextLink\":\"e\"}") - .toObject(ElasticVersionsListResponseInner.class); - Assertions.assertEquals("ulzndlikwyqk", model.value().get(0)); - Assertions.assertEquals("e", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ElasticVersionsListResponseInner model = - new ElasticVersionsListResponseInner() - .withValue(Arrays.asList("ulzndlikwyqk", "fgibmadgakeq", "rxybz")) - .withNextLink("e"); - model = BinaryData.fromObject(model).toObject(ElasticVersionsListResponseInner.class); - Assertions.assertEquals("ulzndlikwyqk", model.value().get(0)); - Assertions.assertEquals("e", model.nextLink()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListWithResponseMockTests.java deleted file mode 100644 index ea2d4b6067945..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ElasticVersionsListWithResponseMockTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.ElasticVersionsListResponse; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ElasticVersionsListWithResponseMockTests { - @Test - public void testListWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{\"value\":[\"jmflbvvnch\",\"kcciwwzjuqkhr\"],\"nextLink\":\"jiwkuofoskghsau\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ElasticVersionsListResponse response = - manager.elasticVersions().listWithResponse("kwlhzdo", com.azure.core.util.Context.NONE).getValue(); - - Assertions.assertEquals("jmflbvvnch", response.value().get(0)); - Assertions.assertEquals("jiwkuofoskghsau", response.nextLink()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ExternalUserCreationResponseInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ExternalUserCreationResponseInnerTests.java deleted file mode 100644 index 65bd448012b64..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ExternalUserCreationResponseInnerTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.ExternalUserCreationResponseInner; - -public final class ExternalUserCreationResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExternalUserCreationResponseInner model = - BinaryData.fromString("{\"created\":true}").toObject(ExternalUserCreationResponseInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExternalUserCreationResponseInner model = new ExternalUserCreationResponseInner(); - model = BinaryData.fromObject(model).toObject(ExternalUserCreationResponseInner.class); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/FilteringTagTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/FilteringTagTests.java deleted file mode 100644 index 5641106b24c01..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/FilteringTagTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.FilteringTag; -import com.azure.resourcemanager.elastic.models.TagAction; -import org.junit.jupiter.api.Assertions; - -public final class FilteringTagTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FilteringTag model = - BinaryData - .fromString("{\"name\":\"xscpaierhhbc\",\"value\":\"l\",\"action\":\"Include\"}") - .toObject(FilteringTag.class); - Assertions.assertEquals("xscpaierhhbc", model.name()); - Assertions.assertEquals("l", model.value()); - Assertions.assertEquals(TagAction.INCLUDE, model.action()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FilteringTag model = new FilteringTag().withName("xscpaierhhbc").withValue("l").withAction(TagAction.INCLUDE); - model = BinaryData.fromObject(model).toObject(FilteringTag.class); - Assertions.assertEquals("xscpaierhhbc", model.name()); - Assertions.assertEquals("l", model.value()); - Assertions.assertEquals(TagAction.INCLUDE, model.action()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/IdentityPropertiesTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/IdentityPropertiesTests.java deleted file mode 100644 index d91f2721a52ae..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/IdentityPropertiesTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.IdentityProperties; -import com.azure.resourcemanager.elastic.models.ManagedIdentityTypes; -import org.junit.jupiter.api.Assertions; - -public final class IdentityPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IdentityProperties model = - BinaryData - .fromString( - "{\"principalId\":\"kbasyypn\",\"tenantId\":\"hsgcbacphejkot\",\"type\":\"SystemAssigned\"}") - .toObject(IdentityProperties.class); - Assertions.assertEquals(ManagedIdentityTypes.SYSTEM_ASSIGNED, model.type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IdentityProperties model = new IdentityProperties().withType(ManagedIdentityTypes.SYSTEM_ASSIGNED); - model = BinaryData.fromObject(model).toObject(IdentityProperties.class); - Assertions.assertEquals(ManagedIdentityTypes.SYSTEM_ASSIGNED, model.type()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ListAssociatedTrafficFiltersListWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ListAssociatedTrafficFiltersListWithResponseMockTests.java deleted file mode 100644 index 880035e412eb7..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ListAssociatedTrafficFiltersListWithResponseMockTests.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.ElasticTrafficFilterResponse; -import com.azure.resourcemanager.elastic.models.Type; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class ListAssociatedTrafficFiltersListWithResponseMockTests { - @Test - public void testListWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"rulesets\":[{\"id\":\"hxw\",\"name\":\"tyq\",\"description\":\"lbbovplw\",\"region\":\"hvgyuguosvmk\",\"type\":\"ip\",\"includeByDefault\":false,\"rules\":[]}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ElasticTrafficFilterResponse response = - manager - .listAssociatedTrafficFilters() - .listWithResponse("ytxhp", "xbzpfzab", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("hxw", response.rulesets().get(0).id()); - Assertions.assertEquals("tyq", response.rulesets().get(0).name()); - Assertions.assertEquals("lbbovplw", response.rulesets().get(0).description()); - Assertions.assertEquals("hvgyuguosvmk", response.rulesets().get(0).region()); - Assertions.assertEquals(Type.IP, response.rulesets().get(0).type()); - Assertions.assertEquals(false, response.rulesets().get(0).includeByDefault()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/LogRulesTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/LogRulesTests.java deleted file mode 100644 index de101cb9543f3..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/LogRulesTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.FilteringTag; -import com.azure.resourcemanager.elastic.models.LogRules; -import com.azure.resourcemanager.elastic.models.TagAction; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class LogRulesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - LogRules model = - BinaryData - .fromString( - "{\"sendAadLogs\":false,\"sendSubscriptionLogs\":true,\"sendActivityLogs\":false,\"filteringTags\":[{\"name\":\"jkrlkhbzhfepg\",\"value\":\"qex\",\"action\":\"Exclude\"}]}") - .toObject(LogRules.class); - Assertions.assertEquals(false, model.sendAadLogs()); - Assertions.assertEquals(true, model.sendSubscriptionLogs()); - Assertions.assertEquals(false, model.sendActivityLogs()); - Assertions.assertEquals("jkrlkhbzhfepg", model.filteringTags().get(0).name()); - Assertions.assertEquals("qex", model.filteringTags().get(0).value()); - Assertions.assertEquals(TagAction.EXCLUDE, model.filteringTags().get(0).action()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - LogRules model = - new LogRules() - .withSendAadLogs(false) - .withSendSubscriptionLogs(true) - .withSendActivityLogs(false) - .withFilteringTags( - Arrays - .asList( - new FilteringTag() - .withName("jkrlkhbzhfepg") - .withValue("qex") - .withAction(TagAction.EXCLUDE))); - model = BinaryData.fromObject(model).toObject(LogRules.class); - Assertions.assertEquals(false, model.sendAadLogs()); - Assertions.assertEquals(true, model.sendSubscriptionLogs()); - Assertions.assertEquals(false, model.sendActivityLogs()); - Assertions.assertEquals("jkrlkhbzhfepg", model.filteringTags().get(0).name()); - Assertions.assertEquals("qex", model.filteringTags().get(0).value()); - Assertions.assertEquals(TagAction.EXCLUDE, model.filteringTags().get(0).action()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MarketplaceSaaSInfoMarketplaceSubscriptionTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MarketplaceSaaSInfoMarketplaceSubscriptionTests.java deleted file mode 100644 index 4f81a6633ee39..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MarketplaceSaaSInfoMarketplaceSubscriptionTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.MarketplaceSaaSInfoMarketplaceSubscription; -import org.junit.jupiter.api.Assertions; - -public final class MarketplaceSaaSInfoMarketplaceSubscriptionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MarketplaceSaaSInfoMarketplaceSubscription model = - BinaryData.fromString("{\"id\":\"uckyf\"}").toObject(MarketplaceSaaSInfoMarketplaceSubscription.class); - Assertions.assertEquals("uckyf", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MarketplaceSaaSInfoMarketplaceSubscription model = - new MarketplaceSaaSInfoMarketplaceSubscription().withId("uckyf"); - model = BinaryData.fromObject(model).toObject(MarketplaceSaaSInfoMarketplaceSubscription.class); - Assertions.assertEquals("uckyf", model.id()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MarketplaceSaaSInfoTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MarketplaceSaaSInfoTests.java deleted file mode 100644 index a59004cabdb26..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MarketplaceSaaSInfoTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.MarketplaceSaaSInfo; -import com.azure.resourcemanager.elastic.models.MarketplaceSaaSInfoMarketplaceSubscription; -import org.junit.jupiter.api.Assertions; - -public final class MarketplaceSaaSInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MarketplaceSaaSInfo model = - BinaryData - .fromString( - "{\"marketplaceSubscription\":{\"id\":\"g\"},\"marketplaceName\":\"tnwu\",\"marketplaceResourceId\":\"gazxuf\"}") - .toObject(MarketplaceSaaSInfo.class); - Assertions.assertEquals("g", model.marketplaceSubscription().id()); - Assertions.assertEquals("tnwu", model.marketplaceName()); - Assertions.assertEquals("gazxuf", model.marketplaceResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MarketplaceSaaSInfo model = - new MarketplaceSaaSInfo() - .withMarketplaceSubscription(new MarketplaceSaaSInfoMarketplaceSubscription().withId("g")) - .withMarketplaceName("tnwu") - .withMarketplaceResourceId("gazxuf"); - model = BinaryData.fromObject(model).toObject(MarketplaceSaaSInfo.class); - Assertions.assertEquals("g", model.marketplaceSubscription().id()); - Assertions.assertEquals("tnwu", model.marketplaceName()); - Assertions.assertEquals("gazxuf", model.marketplaceResourceId()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourceInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourceInnerTests.java deleted file mode 100644 index 70bae4b9c4b60..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourceInnerTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.MonitoredResourceInner; -import com.azure.resourcemanager.elastic.models.SendingLogs; -import org.junit.jupiter.api.Assertions; - -public final class MonitoredResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonitoredResourceInner model = - BinaryData - .fromString("{\"id\":\"qrolfpf\",\"sendingLogs\":\"False\",\"reasonForLogsStatus\":\"gbquxigj\"}") - .toObject(MonitoredResourceInner.class); - Assertions.assertEquals("qrolfpf", model.id()); - Assertions.assertEquals(SendingLogs.FALSE, model.sendingLogs()); - Assertions.assertEquals("gbquxigj", model.reasonForLogsStatus()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonitoredResourceInner model = - new MonitoredResourceInner() - .withId("qrolfpf") - .withSendingLogs(SendingLogs.FALSE) - .withReasonForLogsStatus("gbquxigj"); - model = BinaryData.fromObject(model).toObject(MonitoredResourceInner.class); - Assertions.assertEquals("qrolfpf", model.id()); - Assertions.assertEquals(SendingLogs.FALSE, model.sendingLogs()); - Assertions.assertEquals("gbquxigj", model.reasonForLogsStatus()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourceListResponseTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourceListResponseTests.java deleted file mode 100644 index ea78c89eed381..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourceListResponseTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.MonitoredResourceInner; -import com.azure.resourcemanager.elastic.models.MonitoredResourceListResponse; -import com.azure.resourcemanager.elastic.models.SendingLogs; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MonitoredResourceListResponseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonitoredResourceListResponse model = - BinaryData - .fromString( - "{\"value\":[{\"id\":\"gpbkwtmut\",\"sendingLogs\":\"False\",\"reasonForLogsStatus\":\"ta\"},{\"id\":\"pwgcuertu\",\"sendingLogs\":\"False\",\"reasonForLogsStatus\":\"svqwhbmdgbbjfd\"}],\"nextLink\":\"mbmbexppbh\"}") - .toObject(MonitoredResourceListResponse.class); - Assertions.assertEquals("gpbkwtmut", model.value().get(0).id()); - Assertions.assertEquals(SendingLogs.FALSE, model.value().get(0).sendingLogs()); - Assertions.assertEquals("ta", model.value().get(0).reasonForLogsStatus()); - Assertions.assertEquals("mbmbexppbh", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonitoredResourceListResponse model = - new MonitoredResourceListResponse() - .withValue( - Arrays - .asList( - new MonitoredResourceInner() - .withId("gpbkwtmut") - .withSendingLogs(SendingLogs.FALSE) - .withReasonForLogsStatus("ta"), - new MonitoredResourceInner() - .withId("pwgcuertu") - .withSendingLogs(SendingLogs.FALSE) - .withReasonForLogsStatus("svqwhbmdgbbjfd"))) - .withNextLink("mbmbexppbh"); - model = BinaryData.fromObject(model).toObject(MonitoredResourceListResponse.class); - Assertions.assertEquals("gpbkwtmut", model.value().get(0).id()); - Assertions.assertEquals(SendingLogs.FALSE, model.value().get(0).sendingLogs()); - Assertions.assertEquals("ta", model.value().get(0).reasonForLogsStatus()); - Assertions.assertEquals("mbmbexppbh", model.nextLink()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourcesListMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourcesListMockTests.java deleted file mode 100644 index c506024aa2fb7..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoredResourcesListMockTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.MonitoredResource; -import com.azure.resourcemanager.elastic.models.SendingLogs; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class MonitoredResourcesListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{\"value\":[{\"id\":\"y\",\"sendingLogs\":\"False\",\"reasonForLogsStatus\":\"e\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.monitoredResources().list("imjm", "xieduugidyjrr", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("y", response.iterator().next().id()); - Assertions.assertEquals(SendingLogs.FALSE, response.iterator().next().sendingLogs()); - Assertions.assertEquals("e", response.iterator().next().reasonForLogsStatus()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesInnerTests.java deleted file mode 100644 index e901d23947d9b..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesInnerTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.MonitoringTagRulesInner; -import com.azure.resourcemanager.elastic.models.LogRules; -import com.azure.resourcemanager.elastic.models.MonitoringTagRulesProperties; -import com.azure.resourcemanager.elastic.models.ProvisioningState; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MonitoringTagRulesInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonitoringTagRulesInner model = - BinaryData - .fromString( - "{\"properties\":{\"provisioningState\":\"Canceled\",\"logRules\":{\"sendAadLogs\":true,\"sendSubscriptionLogs\":true,\"sendActivityLogs\":true,\"filteringTags\":[]}},\"id\":\"rjb\",\"name\":\"norcjxvsnbyxqab\",\"type\":\"mocpc\"}") - .toObject(MonitoringTagRulesInner.class); - Assertions.assertEquals(ProvisioningState.CANCELED, model.properties().provisioningState()); - Assertions.assertEquals(true, model.properties().logRules().sendAadLogs()); - Assertions.assertEquals(true, model.properties().logRules().sendSubscriptionLogs()); - Assertions.assertEquals(true, model.properties().logRules().sendActivityLogs()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonitoringTagRulesInner model = - new MonitoringTagRulesInner() - .withProperties( - new MonitoringTagRulesProperties() - .withProvisioningState(ProvisioningState.CANCELED) - .withLogRules( - new LogRules() - .withSendAadLogs(true) - .withSendSubscriptionLogs(true) - .withSendActivityLogs(true) - .withFilteringTags(Arrays.asList()))); - model = BinaryData.fromObject(model).toObject(MonitoringTagRulesInner.class); - Assertions.assertEquals(ProvisioningState.CANCELED, model.properties().provisioningState()); - Assertions.assertEquals(true, model.properties().logRules().sendAadLogs()); - Assertions.assertEquals(true, model.properties().logRules().sendSubscriptionLogs()); - Assertions.assertEquals(true, model.properties().logRules().sendActivityLogs()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesListResponseTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesListResponseTests.java deleted file mode 100644 index 79b2eca7bceda..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesListResponseTests.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.MonitoringTagRulesInner; -import com.azure.resourcemanager.elastic.models.MonitoringTagRulesListResponse; -import com.azure.resourcemanager.elastic.models.MonitoringTagRulesProperties; -import com.azure.resourcemanager.elastic.models.ProvisioningState; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MonitoringTagRulesListResponseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonitoringTagRulesListResponse model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\"},\"id\":\"jcmmxdcufufsrp\",\"name\":\"mzidnsezcxtb\",\"type\":\"sgfyccsnew\"},{\"properties\":{\"provisioningState\":\"Deleted\"},\"id\":\"iachbo\",\"name\":\"sflnrosfqp\",\"type\":\"eeh\"},{\"properties\":{\"provisioningState\":\"Updating\"},\"id\":\"qrimzinpv\",\"name\":\"wjdk\",\"type\":\"rsoodqxhcrmnoh\"}],\"nextLink\":\"ckwhds\"}") - .toObject(MonitoringTagRulesListResponse.class); - Assertions.assertEquals(ProvisioningState.CANCELED, model.value().get(0).properties().provisioningState()); - Assertions.assertEquals("ckwhds", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonitoringTagRulesListResponse model = - new MonitoringTagRulesListResponse() - .withValue( - Arrays - .asList( - new MonitoringTagRulesInner() - .withProperties( - new MonitoringTagRulesProperties() - .withProvisioningState(ProvisioningState.CANCELED)), - new MonitoringTagRulesInner() - .withProperties( - new MonitoringTagRulesProperties() - .withProvisioningState(ProvisioningState.DELETED)), - new MonitoringTagRulesInner() - .withProperties( - new MonitoringTagRulesProperties() - .withProvisioningState(ProvisioningState.UPDATING)))) - .withNextLink("ckwhds"); - model = BinaryData.fromObject(model).toObject(MonitoringTagRulesListResponse.class); - Assertions.assertEquals(ProvisioningState.CANCELED, model.value().get(0).properties().provisioningState()); - Assertions.assertEquals("ckwhds", model.nextLink()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesPropertiesTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesPropertiesTests.java deleted file mode 100644 index 7f51b367e492b..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitoringTagRulesPropertiesTests.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.FilteringTag; -import com.azure.resourcemanager.elastic.models.LogRules; -import com.azure.resourcemanager.elastic.models.MonitoringTagRulesProperties; -import com.azure.resourcemanager.elastic.models.ProvisioningState; -import com.azure.resourcemanager.elastic.models.TagAction; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class MonitoringTagRulesPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MonitoringTagRulesProperties model = - BinaryData - .fromString( - "{\"provisioningState\":\"Failed\",\"logRules\":{\"sendAadLogs\":false,\"sendSubscriptionLogs\":false,\"sendActivityLogs\":true,\"filteringTags\":[{\"name\":\"pbtoqcjmkl\",\"value\":\"vbqid\",\"action\":\"Include\"}]}}") - .toObject(MonitoringTagRulesProperties.class); - Assertions.assertEquals(ProvisioningState.FAILED, model.provisioningState()); - Assertions.assertEquals(false, model.logRules().sendAadLogs()); - Assertions.assertEquals(false, model.logRules().sendSubscriptionLogs()); - Assertions.assertEquals(true, model.logRules().sendActivityLogs()); - Assertions.assertEquals("pbtoqcjmkl", model.logRules().filteringTags().get(0).name()); - Assertions.assertEquals("vbqid", model.logRules().filteringTags().get(0).value()); - Assertions.assertEquals(TagAction.INCLUDE, model.logRules().filteringTags().get(0).action()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MonitoringTagRulesProperties model = - new MonitoringTagRulesProperties() - .withProvisioningState(ProvisioningState.FAILED) - .withLogRules( - new LogRules() - .withSendAadLogs(false) - .withSendSubscriptionLogs(false) - .withSendActivityLogs(true) - .withFilteringTags( - Arrays - .asList( - new FilteringTag() - .withName("pbtoqcjmkl") - .withValue("vbqid") - .withAction(TagAction.INCLUDE)))); - model = BinaryData.fromObject(model).toObject(MonitoringTagRulesProperties.class); - Assertions.assertEquals(ProvisioningState.FAILED, model.provisioningState()); - Assertions.assertEquals(false, model.logRules().sendAadLogs()); - Assertions.assertEquals(false, model.logRules().sendSubscriptionLogs()); - Assertions.assertEquals(true, model.logRules().sendActivityLogs()); - Assertions.assertEquals("pbtoqcjmkl", model.logRules().filteringTags().get(0).name()); - Assertions.assertEquals("vbqid", model.logRules().filteringTags().get(0).value()); - Assertions.assertEquals(TagAction.INCLUDE, model.logRules().filteringTags().get(0).action()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitorsDeleteMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitorsDeleteMockTests.java deleted file mode 100644 index 02c3965271061..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/MonitorsDeleteMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class MonitorsDeleteMockTests { - @Test - public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.monitors().delete("rdxwzywqsm", "surex", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationDisplayTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationDisplayTests.java deleted file mode 100644 index f5416a7ac635b..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationDisplayTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = - BinaryData - .fromString( - "{\"provider\":\"cryuan\",\"resource\":\"uxzdxtay\",\"operation\":\"hmwhfpmrqo\",\"description\":\"tu\"}") - .toObject(OperationDisplay.class); - Assertions.assertEquals("cryuan", model.provider()); - Assertions.assertEquals("uxzdxtay", model.resource()); - Assertions.assertEquals("hmwhfpmrqo", model.operation()); - Assertions.assertEquals("tu", model.description()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = - new OperationDisplay() - .withProvider("cryuan") - .withResource("uxzdxtay") - .withOperation("hmwhfpmrqo") - .withDescription("tu"); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - Assertions.assertEquals("cryuan", model.provider()); - Assertions.assertEquals("uxzdxtay", model.resource()); - Assertions.assertEquals("hmwhfpmrqo", model.operation()); - Assertions.assertEquals("tu", model.description()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationListResultTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationListResultTests.java deleted file mode 100644 index fbeeda9a2bf41..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationListResultTests.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.OperationResultInner; -import com.azure.resourcemanager.elastic.models.OperationDisplay; -import com.azure.resourcemanager.elastic.models.OperationListResult; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class OperationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationListResult model = - BinaryData - .fromString( - "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"ownoizhw\"},{\"name\":\"xybqsoqij\",\"isDataAction\":true,\"display\":{\"provider\":\"pazlobcufpdz\",\"resource\":\"btcqq\",\"operation\":\"qglhq\",\"description\":\"ufo\"},\"origin\":\"jywif\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"o\"}],\"nextLink\":\"dkfo\"}") - .toObject(OperationListResult.class); - Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); - Assertions.assertEquals(true, model.value().get(0).isDataAction()); - Assertions.assertEquals("pbsphrupidgs", model.value().get(0).display().provider()); - Assertions.assertEquals("bejhphoycmsxa", model.value().get(0).display().resource()); - Assertions.assertEquals("hdxbmtqio", model.value().get(0).display().operation()); - Assertions.assertEquals("zehtbmu", model.value().get(0).display().description()); - Assertions.assertEquals("ownoizhw", model.value().get(0).origin()); - Assertions.assertEquals("dkfo", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResult model = - new OperationListResult() - .withValue( - Arrays - .asList( - new OperationResultInner() - .withName("quvgjxpybczme") - .withIsDataAction(true) - .withDisplay( - new OperationDisplay() - .withProvider("pbsphrupidgs") - .withResource("bejhphoycmsxa") - .withOperation("hdxbmtqio") - .withDescription("zehtbmu")) - .withOrigin("ownoizhw"), - new OperationResultInner() - .withName("xybqsoqij") - .withIsDataAction(true) - .withDisplay( - new OperationDisplay() - .withProvider("pazlobcufpdz") - .withResource("btcqq") - .withOperation("qglhq") - .withDescription("ufo")) - .withOrigin("jywif"), - new OperationResultInner() - .withName("esaagdfm") - .withIsDataAction(true) - .withDisplay( - new OperationDisplay() - .withProvider("j") - .withResource("ifkwmrvktsizntoc") - .withOperation("a") - .withDescription("ajpsquc")) - .withOrigin("o"))) - .withNextLink("dkfo"); - model = BinaryData.fromObject(model).toObject(OperationListResult.class); - Assertions.assertEquals("quvgjxpybczme", model.value().get(0).name()); - Assertions.assertEquals(true, model.value().get(0).isDataAction()); - Assertions.assertEquals("pbsphrupidgs", model.value().get(0).display().provider()); - Assertions.assertEquals("bejhphoycmsxa", model.value().get(0).display().resource()); - Assertions.assertEquals("hdxbmtqio", model.value().get(0).display().operation()); - Assertions.assertEquals("zehtbmu", model.value().get(0).display().description()); - Assertions.assertEquals("ownoizhw", model.value().get(0).origin()); - Assertions.assertEquals("dkfo", model.nextLink()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationResultInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationResultInnerTests.java deleted file mode 100644 index 49a15086609d9..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationResultInnerTests.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.OperationResultInner; -import com.azure.resourcemanager.elastic.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; - -public final class OperationResultInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationResultInner model = - BinaryData - .fromString( - "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"txukcdmp\"}") - .toObject(OperationResultInner.class); - Assertions.assertEquals("nygj", model.name()); - Assertions.assertEquals(true, model.isDataAction()); - Assertions.assertEquals("eqsrdeupewnwreit", model.display().provider()); - Assertions.assertEquals("yflusarhmofc", model.display().resource()); - Assertions.assertEquals("smy", model.display().operation()); - Assertions.assertEquals("kdtmlxhekuk", model.display().description()); - Assertions.assertEquals("txukcdmp", model.origin()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationResultInner model = - new OperationResultInner() - .withName("nygj") - .withIsDataAction(true) - .withDisplay( - new OperationDisplay() - .withProvider("eqsrdeupewnwreit") - .withResource("yflusarhmofc") - .withOperation("smy") - .withDescription("kdtmlxhekuk")) - .withOrigin("txukcdmp"); - model = BinaryData.fromObject(model).toObject(OperationResultInner.class); - Assertions.assertEquals("nygj", model.name()); - Assertions.assertEquals(true, model.isDataAction()); - Assertions.assertEquals("eqsrdeupewnwreit", model.display().provider()); - Assertions.assertEquals("yflusarhmofc", model.display().resource()); - Assertions.assertEquals("smy", model.display().operation()); - Assertions.assertEquals("kdtmlxhekuk", model.display().description()); - Assertions.assertEquals("txukcdmp", model.origin()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationsListMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationsListMockTests.java deleted file mode 100644 index c6764a483257d..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/OperationsListMockTests.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.OperationResult; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class OperationsListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"name\":\"ienjbdlwtgr\",\"isDataAction\":true,\"display\":{\"provider\":\"jumasx\",\"resource\":\"jpqyegu\",\"operation\":\"hb\",\"description\":\"hejjz\"},\"origin\":\"dudgwdslfhot\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ienjbdlwtgr", response.iterator().next().name()); - Assertions.assertEquals(true, response.iterator().next().isDataAction()); - Assertions.assertEquals("jumasx", response.iterator().next().display().provider()); - Assertions.assertEquals("jpqyegu", response.iterator().next().display().resource()); - Assertions.assertEquals("hb", response.iterator().next().display().operation()); - Assertions.assertEquals("hejjz", response.iterator().next().display().description()); - Assertions.assertEquals("dudgwdslfhot", response.iterator().next().origin()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ResourceSkuTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ResourceSkuTests.java deleted file mode 100644 index 74f41f11c101d..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/ResourceSkuTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.ResourceSku; -import org.junit.jupiter.api.Assertions; - -public final class ResourceSkuTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ResourceSku model = BinaryData.fromString("{\"name\":\"joxzjnchgejspodm\"}").toObject(ResourceSku.class); - Assertions.assertEquals("joxzjnchgejspodm", model.name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceSku model = new ResourceSku().withName("joxzjnchgejspodm"); - model = BinaryData.fromObject(model).toObject(ResourceSku.class); - Assertions.assertEquals("joxzjnchgejspodm", model.name()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesCreateOrUpdateWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesCreateOrUpdateWithResponseMockTests.java deleted file mode 100644 index 882fd2ef75bd0..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesCreateOrUpdateWithResponseMockTests.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.LogRules; -import com.azure.resourcemanager.elastic.models.MonitoringTagRules; -import com.azure.resourcemanager.elastic.models.MonitoringTagRulesProperties; -import com.azure.resourcemanager.elastic.models.ProvisioningState; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TagRulesCreateOrUpdateWithResponseMockTests { - @Test - public void testCreateOrUpdateWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"provisioningState\":\"Creating\",\"logRules\":{\"sendAadLogs\":true,\"sendSubscriptionLogs\":true,\"sendActivityLogs\":false,\"filteringTags\":[]}},\"id\":\"fvjrbirphxepcy\",\"name\":\"ahfn\",\"type\":\"jky\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - MonitoringTagRules response = - manager - .tagRules() - .define("senhwlrs") - .withExistingMonitor("uconuqszfkbey", "ewrmjmwvvjektc") - .withProperties( - new MonitoringTagRulesProperties() - .withProvisioningState(ProvisioningState.ACCEPTED) - .withLogRules( - new LogRules() - .withSendAadLogs(false) - .withSendSubscriptionLogs(false) - .withSendActivityLogs(false) - .withFilteringTags(Arrays.asList()))) - .create(); - - Assertions.assertEquals(ProvisioningState.CREATING, response.properties().provisioningState()); - Assertions.assertEquals(true, response.properties().logRules().sendAadLogs()); - Assertions.assertEquals(true, response.properties().logRules().sendSubscriptionLogs()); - Assertions.assertEquals(false, response.properties().logRules().sendActivityLogs()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesDeleteMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesDeleteMockTests.java deleted file mode 100644 index 551742b4cfc33..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesDeleteMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TagRulesDeleteMockTests { - @Test - public void testDelete() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.tagRules().delete("yxzk", "noc", "koklya", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesGetWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesGetWithResponseMockTests.java deleted file mode 100644 index ba2782fb2dac5..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesGetWithResponseMockTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.MonitoringTagRules; -import com.azure.resourcemanager.elastic.models.ProvisioningState; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TagRulesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"logRules\":{\"sendAadLogs\":false,\"sendSubscriptionLogs\":true,\"sendActivityLogs\":true,\"filteringTags\":[]}},\"id\":\"lwh\",\"name\":\"lsicohoqqnwv\",\"type\":\"ryavwhheunmmqh\"}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - MonitoringTagRules response = - manager - .tagRules() - .getWithResponse("kix", "bin", "eputtmrywnuzoqf", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(ProvisioningState.SUCCEEDED, response.properties().provisioningState()); - Assertions.assertEquals(false, response.properties().logRules().sendAadLogs()); - Assertions.assertEquals(true, response.properties().logRules().sendSubscriptionLogs()); - Assertions.assertEquals(true, response.properties().logRules().sendActivityLogs()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesListMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesListMockTests.java deleted file mode 100644 index 2afd5272f04f4..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TagRulesListMockTests.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.MonitoringTagRules; -import com.azure.resourcemanager.elastic.models.ProvisioningState; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TagRulesListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"logRules\":{\"sendAadLogs\":false,\"sendSubscriptionLogs\":true,\"sendActivityLogs\":false,\"filteringTags\":[]}},\"id\":\"ajdeyeamdphaga\",\"name\":\"pbuxwgipwhon\",\"type\":\"wkgshwa\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.tagRules().list("w", "fsj", com.azure.core.util.Context.NONE); - - Assertions - .assertEquals(ProvisioningState.CANCELED, response.iterator().next().properties().provisioningState()); - Assertions.assertEquals(false, response.iterator().next().properties().logRules().sendAadLogs()); - Assertions.assertEquals(true, response.iterator().next().properties().logRules().sendSubscriptionLogs()); - Assertions.assertEquals(false, response.iterator().next().properties().logRules().sendActivityLogs()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TrafficFiltersDeleteWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TrafficFiltersDeleteWithResponseMockTests.java deleted file mode 100644 index 54a7e0dea984b..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/TrafficFiltersDeleteWithResponseMockTests.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class TrafficFiltersDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager - .trafficFilters() - .deleteWithResponse("cwsvlxotog", "wrupqsxvnmicykvc", "o", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsDetailsWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsDetailsWithResponseMockTests.java deleted file mode 100644 index f7d15620e1a07..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsDetailsWithResponseMockTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.UpgradableVersionsList; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class UpgradableVersionsDetailsWithResponseMockTests { - @Test - public void testDetailsWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{\"currentVersion\":\"gvtqagnbuynh\",\"upgradableVersions\":[\"gmebfsiarbutrcv\"]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - UpgradableVersionsList response = - manager - .upgradableVersions() - .detailsWithResponse("y", "hibnuqqkpika", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("gvtqagnbuynh", response.currentVersion()); - Assertions.assertEquals("gmebfsiarbutrcv", response.upgradableVersions().get(0)); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsListInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsListInnerTests.java deleted file mode 100644 index c4a2b2ecf5073..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UpgradableVersionsListInnerTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.UpgradableVersionsListInner; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class UpgradableVersionsListInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UpgradableVersionsListInner model = - BinaryData - .fromString("{\"currentVersion\":\"pg\",\"upgradableVersions\":[\"ocjjxhvpmouexh\"]}") - .toObject(UpgradableVersionsListInner.class); - Assertions.assertEquals("pg", model.currentVersion()); - Assertions.assertEquals("ocjjxhvpmouexh", model.upgradableVersions().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UpgradableVersionsListInner model = - new UpgradableVersionsListInner() - .withCurrentVersion("pg") - .withUpgradableVersions(Arrays.asList("ocjjxhvpmouexh")); - model = BinaryData.fromObject(model).toObject(UpgradableVersionsListInner.class); - Assertions.assertEquals("pg", model.currentVersion()); - Assertions.assertEquals("ocjjxhvpmouexh", model.upgradableVersions().get(0)); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UserEmailIdTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UserEmailIdTests.java deleted file mode 100644 index 29ce948f0ec63..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UserEmailIdTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.UserEmailId; -import org.junit.jupiter.api.Assertions; - -public final class UserEmailIdTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UserEmailId model = BinaryData.fromString("{\"emailId\":\"ochcbonqvpkvl\"}").toObject(UserEmailId.class); - Assertions.assertEquals("ochcbonqvpkvl", model.emailId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UserEmailId model = new UserEmailId().withEmailId("ochcbonqvpkvl"); - model = BinaryData.fromObject(model).toObject(UserEmailId.class); - Assertions.assertEquals("ochcbonqvpkvl", model.emailId()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UserInfoTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UserInfoTests.java deleted file mode 100644 index ba4a3f5e57708..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/UserInfoTests.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.CompanyInfo; -import com.azure.resourcemanager.elastic.models.UserInfo; -import org.junit.jupiter.api.Assertions; - -public final class UserInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UserInfo model = - BinaryData - .fromString( - "{\"firstName\":\"fmppe\",\"lastName\":\"vmgxsab\",\"companyName\":\"qduujitcjczdz\",\"emailAddress\":\"ndhkrw\",\"companyInfo\":{\"domain\":\"ppdsbdkvwrwj\",\"business\":\"usnhutje\",\"employeesNumber\":\"mrldhu\",\"state\":\"zzd\",\"country\":\"qxhocdgeablgphut\"}}") - .toObject(UserInfo.class); - Assertions.assertEquals("fmppe", model.firstName()); - Assertions.assertEquals("vmgxsab", model.lastName()); - Assertions.assertEquals("qduujitcjczdz", model.companyName()); - Assertions.assertEquals("ndhkrw", model.emailAddress()); - Assertions.assertEquals("ppdsbdkvwrwj", model.companyInfo().domain()); - Assertions.assertEquals("usnhutje", model.companyInfo().business()); - Assertions.assertEquals("mrldhu", model.companyInfo().employeesNumber()); - Assertions.assertEquals("zzd", model.companyInfo().state()); - Assertions.assertEquals("qxhocdgeablgphut", model.companyInfo().country()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UserInfo model = - new UserInfo() - .withFirstName("fmppe") - .withLastName("vmgxsab") - .withCompanyName("qduujitcjczdz") - .withEmailAddress("ndhkrw") - .withCompanyInfo( - new CompanyInfo() - .withDomain("ppdsbdkvwrwj") - .withBusiness("usnhutje") - .withEmployeesNumber("mrldhu") - .withState("zzd") - .withCountry("qxhocdgeablgphut")); - model = BinaryData.fromObject(model).toObject(UserInfo.class); - Assertions.assertEquals("fmppe", model.firstName()); - Assertions.assertEquals("vmgxsab", model.lastName()); - Assertions.assertEquals("qduujitcjczdz", model.companyName()); - Assertions.assertEquals("ndhkrw", model.emailAddress()); - Assertions.assertEquals("ppdsbdkvwrwj", model.companyInfo().domain()); - Assertions.assertEquals("usnhutje", model.companyInfo().business()); - Assertions.assertEquals("mrldhu", model.companyInfo().employeesNumber()); - Assertions.assertEquals("zzd", model.companyInfo().state()); - Assertions.assertEquals("qxhocdgeablgphut", model.companyInfo().country()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMCollectionUpdateTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMCollectionUpdateTests.java deleted file mode 100644 index 8d315f6de5b78..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMCollectionUpdateTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.models.OperationName; -import com.azure.resourcemanager.elastic.models.VMCollectionUpdate; -import org.junit.jupiter.api.Assertions; - -public final class VMCollectionUpdateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VMCollectionUpdate model = - BinaryData - .fromString("{\"vmResourceId\":\"fmxa\",\"operationName\":\"Delete\"}") - .toObject(VMCollectionUpdate.class); - Assertions.assertEquals("fmxa", model.vmResourceId()); - Assertions.assertEquals(OperationName.DELETE, model.operationName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VMCollectionUpdate model = - new VMCollectionUpdate().withVmResourceId("fmxa").withOperationName(OperationName.DELETE); - model = BinaryData.fromObject(model).toObject(VMCollectionUpdate.class); - Assertions.assertEquals("fmxa", model.vmResourceId()); - Assertions.assertEquals(OperationName.DELETE, model.operationName()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMCollectionsUpdateWithResponseMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMCollectionsUpdateWithResponseMockTests.java deleted file mode 100644 index fd9f8e5903e84..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMCollectionsUpdateWithResponseMockTests.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.OperationName; -import com.azure.resourcemanager.elastic.models.VMCollectionUpdate; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class VMCollectionsUpdateWithResponseMockTests { - @Test - public void testUpdateWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager - .vMCollections() - .updateWithResponse( - "gr", - "wflzlfbxzpuzy", - new VMCollectionUpdate().withVmResourceId("spnqzahmgkb").withOperationName(OperationName.DELETE), - com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMHostListResponseTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMHostListResponseTests.java deleted file mode 100644 index 71fb881ca9515..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMHostListResponseTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.VMResourcesInner; -import com.azure.resourcemanager.elastic.models.VMHostListResponse; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class VMHostListResponseTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VMHostListResponse model = - BinaryData - .fromString( - "{\"value\":[{\"vmResourceId\":\"j\"},{\"vmResourceId\":\"dxob\"},{\"vmResourceId\":\"dxkqpx\"},{\"vmResourceId\":\"ajionpimexgstxg\"}],\"nextLink\":\"odgmaajrmvdjwz\"}") - .toObject(VMHostListResponse.class); - Assertions.assertEquals("j", model.value().get(0).vmResourceId()); - Assertions.assertEquals("odgmaajrmvdjwz", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VMHostListResponse model = - new VMHostListResponse() - .withValue( - Arrays - .asList( - new VMResourcesInner().withVmResourceId("j"), - new VMResourcesInner().withVmResourceId("dxob"), - new VMResourcesInner().withVmResourceId("dxkqpx"), - new VMResourcesInner().withVmResourceId("ajionpimexgstxg"))) - .withNextLink("odgmaajrmvdjwz"); - model = BinaryData.fromObject(model).toObject(VMHostListResponse.class); - Assertions.assertEquals("j", model.value().get(0).vmResourceId()); - Assertions.assertEquals("odgmaajrmvdjwz", model.nextLink()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMHostsListMockTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMHostsListMockTests.java deleted file mode 100644 index 1093dc0be876c..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMHostsListMockTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.elastic.ElasticManager; -import com.azure.resourcemanager.elastic.models.VMResources; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class VMHostsListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = "{\"value\":[{\"vmResourceId\":\"ncghkje\"}]}"; - - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito - .when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito - .when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito - .when(httpClient.send(httpRequest.capture(), Mockito.any())) - .thenReturn( - Mono - .defer( - () -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - - ElasticManager manager = - ElasticManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.vMHosts().list("xjvuujqgidokg", "ljyoxgvcltb", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ncghkje", response.iterator().next().vmResourceId()); - } -} diff --git a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMResourcesInnerTests.java b/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMResourcesInnerTests.java deleted file mode 100644 index 0cec0278bc3cf..0000000000000 --- a/sdk/elastic/azure-resourcemanager-elastic/src/test/java/com/azure/resourcemanager/elastic/generated/VMResourcesInnerTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.elastic.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.elastic.fluent.models.VMResourcesInner; -import org.junit.jupiter.api.Assertions; - -public final class VMResourcesInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - VMResourcesInner model = - BinaryData.fromString("{\"vmResourceId\":\"ovmclwhijcoejct\"}").toObject(VMResourcesInner.class); - Assertions.assertEquals("ovmclwhijcoejct", model.vmResourceId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - VMResourcesInner model = new VMResourcesInner().withVmResourceId("ovmclwhijcoejct"); - model = BinaryData.fromObject(model).toObject(VMResourcesInner.class); - Assertions.assertEquals("ovmclwhijcoejct", model.vmResourceId()); - } -}