diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/CHANGELOG.md b/sdk/loadtesting/azure-resourcemanager-loadtesting/CHANGELOG.md index ce958a783d9ea..3f3e2a4548d52 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/CHANGELOG.md +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2023-01-12) + +- Azure Resource Manager LoadTest client library for Java. This package contains Microsoft Azure SDK for LoadTest Management SDK. LoadTest client provides access to LoadTest Resource and it's status operations. Package tag package-2022-12-01. 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/loadtesting/azure-resourcemanager-loadtesting/README.md b/sdk/loadtesting/azure-resourcemanager-loadtesting/README.md index 6f213f17d18d3..74b36bb3efad2 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/README.md +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-loadtesting - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -55,7 +55,7 @@ In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` With above configuration, `azure` client can be authenticated using the following code: -```java readme-sample-authn +```java AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) @@ -74,163 +74,6 @@ See [API design][design] for general introduction on design and key concepts on ## Examples -### Create a new Azure Load Testing resource - -Create an Azure Load Testing resource. - -```java readme-sample-createloadtestresource-basic -LoadTestResource resource = manager - .loadTests() - .define("sample-loadtesting-resource") - .withRegion(Region.US_WEST2) - .withExistingResourceGroup("sample-rg") - .create(); -``` - -Create an Azure Load Testing resource configured with CMK encryption. - -```java readme-sample-createloadtestresource-encryption -// map of user-assigned managed identities to be assigned to the loadtest resource -Map map = new HashMap(); -map.put("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1", new UserAssignedIdentity()); - -// encryption identity must be assigned to the load test resource, before using it -LoadTestResource resource = manager - .loadTests() - .define("sample-loadtesting-resource") - .withRegion(Region.US_WEST2) - .withExistingResourceGroup("sample-rg") - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) - .withUserAssignedIdentities(map) - ) - .withEncryption( - new EncryptionProperties() - .withIdentity( - new EncryptionPropertiesIdentity() - .withResourceId("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1") - .withType(Type.USER_ASSIGNED) - ) - .withKeyUrl("https://sample-kv.vault.azure.net/keys/cmkkey/2d1ccd5c50234ea2a0858fe148b69cde") - ) - .create(); -``` - -### Get details of an Azure Load Testing resource - -```java readme-sample-getloadtestresource -LoadTestResource resource = manager - .loadTests() - .getByResourceGroup("sample-rg", "sample-loadtesting-resource"); -``` - -### Update an Azure Load Testing resource - -Update an Azure Load Testing resource to configure CMK encryption using system-assigned managed identity. - -```java readme-sample-updateloadtestresource-encryption -LoadTestResource resource = manager - .loadTests() - .getByResourceGroup("sample-rg", "sample-loadtesting-resource"); - -LoadTestResource resourcePostUpdate = resource - .update() - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) - ) - .withEncryption( - new EncryptionProperties() - .withIdentity( - new EncryptionPropertiesIdentity() - .withResourceId(null) - .withType(Type.SYSTEM_ASSIGNED) - // make sure that system-assigned managed identity is enabled on the resource and the identity has been granted required permissions to access the key. - ) - .withKeyUrl("https://sample-kv.vault.azure.net/keys/cmkkey/2d1ccd5c50234ea2a0858fe148b69cde") - ) - .apply(); -``` - -Update an Azure Load Testing resource to update user-assigned managed identities. - -```java readme-sample-updateloadtestresource-mi -Map map = new HashMap(); -// Note: the value of set to null, removes the previously assigned managed identity from the load test resource -map.put("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1", null); -map.put("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity2", new UserAssignedIdentity()); - -LoadTestResource resource = manager - .loadTests() - .getByResourceGroup("sample-rg", "sample-loadtesting-resource"); - -LoadTestResource resourcePostUpdate = resource - .update() - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities(map) - ) - .apply(); -``` - -### Delete an Azure Load Testing resource - -```java readme-sample-deleteloadtestresource -manager - .loadTests() - .deleteByResourceGroup("sample-rg", "sample-loadtesting-resource"); -``` - -### Quota Operations - -Get quota values for all quota buckets. - -```java readme-sample-list-all-quota-buckets -PagedIterable resource = manager - .quotas() - .list("westus2"); - -for (QuotaResource quotaResource : resource) { - // use the quotaResource - System.out.println(quotaResource.limit()); -} -``` - -Get quota values for a particular quota bucket. - -```java readme-sample-get-quota-bucket -QuotaResource resource = manager - .quotas() - .get("westus2", "maxConcurrentTestRuns"); -System.out.println(resource.limit()); -``` - -Check quota availability. - -```java readme-sample-check-quota-availability -QuotaResource resource = manager - .quotas() - .get("westus2", "maxConcurrentTestRuns"); - -QuotaBucketRequestPropertiesDimensions dimensions = new QuotaBucketRequestPropertiesDimensions() - .withLocation("westus2") - .withSubscriptionId(manager.serviceClient().getSubscriptionId()); - -QuotaBucketRequest request = new QuotaBucketRequest() - .withCurrentQuota(resource.limit()) - .withCurrentUsage(resource.usage()) - .withNewQuota(resource.limit()) - .withDimensions(dimensions); - -CheckQuotaAvailabilityResponse availability = manager - .quotas() - .checkAvailability("westus2", "maxConcurrentTestRuns", request); - -System.out.println(availability.isAvailable()); -``` - [Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/loadtesting/azure-resourcemanager-loadtesting/SAMPLE.md) diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/SAMPLE.md b/sdk/loadtesting/azure-resourcemanager-loadtesting/SAMPLE.md index ceaf1dd98ee51..6fcfb7cef4b83 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/SAMPLE.md +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/SAMPLE.md @@ -84,8 +84,6 @@ public final class LoadTestsCreateOrUpdateSamples { ### LoadTests_Delete ```java -import com.azure.core.util.Context; - /** Samples for LoadTests Delete. */ public final class LoadTestsDeleteSamples { /* @@ -97,7 +95,7 @@ public final class LoadTestsDeleteSamples { * @param manager Entry point to LoadTestManager. */ public static void loadTestsDelete(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.loadTests().delete("dummyrg", "myLoadTest", Context.NONE); + manager.loadTests().delete("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE); } } ``` @@ -105,8 +103,6 @@ public final class LoadTestsDeleteSamples { ### LoadTests_GetByResourceGroup ```java -import com.azure.core.util.Context; - /** Samples for LoadTests GetByResourceGroup. */ public final class LoadTestsGetByResourceGroupSamples { /* @@ -118,7 +114,7 @@ public final class LoadTestsGetByResourceGroupSamples { * @param manager Entry point to LoadTestManager. */ public static void loadTestsGet(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.loadTests().getByResourceGroupWithResponse("dummyrg", "myLoadTest", Context.NONE); + manager.loadTests().getByResourceGroupWithResponse("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE); } } ``` @@ -126,8 +122,6 @@ public final class LoadTestsGetByResourceGroupSamples { ### LoadTests_List ```java -import com.azure.core.util.Context; - /** Samples for LoadTests List. */ public final class LoadTestsListSamples { /* @@ -139,7 +133,7 @@ public final class LoadTestsListSamples { * @param manager Entry point to LoadTestManager. */ public static void loadTestsListBySubscription(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.loadTests().list(Context.NONE); + manager.loadTests().list(com.azure.core.util.Context.NONE); } } ``` @@ -147,8 +141,6 @@ public final class LoadTestsListSamples { ### LoadTests_ListByResourceGroup ```java -import com.azure.core.util.Context; - /** Samples for LoadTests ListByResourceGroup. */ public final class LoadTestsListByResourceGroupSamples { /* @@ -160,7 +152,7 @@ public final class LoadTestsListByResourceGroupSamples { * @param manager Entry point to LoadTestManager. */ public static void loadTestsListByResourceGroup(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.loadTests().listByResourceGroup("dummyrg", Context.NONE); + manager.loadTests().listByResourceGroup("dummyrg", com.azure.core.util.Context.NONE); } } ``` @@ -168,8 +160,6 @@ public final class LoadTestsListByResourceGroupSamples { ### LoadTests_ListOutboundNetworkDependenciesEndpoints ```java -import com.azure.core.util.Context; - /** Samples for LoadTests ListOutboundNetworkDependenciesEndpoints. */ public final class LoadTestsListOutboundNetworkDependenciesEndpointsSamples { /* @@ -184,7 +174,7 @@ public final class LoadTestsListOutboundNetworkDependenciesEndpointsSamples { manager .loadTests() .listOutboundNetworkDependenciesEndpoints( - "default-azureloadtest-japaneast", "sampleloadtest", Context.NONE); + "default-azureloadtest-japaneast", "sampleloadtest", com.azure.core.util.Context.NONE); } } ``` @@ -192,7 +182,6 @@ public final class LoadTestsListOutboundNetworkDependenciesEndpointsSamples { ### LoadTests_Update ```java -import com.azure.core.util.Context; import com.azure.resourcemanager.loadtesting.models.EncryptionProperties; import com.azure.resourcemanager.loadtesting.models.EncryptionPropertiesIdentity; import com.azure.resourcemanager.loadtesting.models.LoadTestResource; @@ -215,7 +204,10 @@ public final class LoadTestsUpdateSamples { */ public static void loadTestsUpdate(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { LoadTestResource resource = - manager.loadTests().getByResourceGroupWithResponse("dummyrg", "myLoadTest", Context.NONE).getValue(); + manager + .loadTests() + .getByResourceGroupWithResponse("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE) + .getValue(); resource .update() .withTags(mapOf("Division", "LT", "Team", "Dev Exp")) @@ -250,8 +242,6 @@ public final class LoadTestsUpdateSamples { ### Operations_List ```java -import com.azure.core.util.Context; - /** Samples for Operations List. */ public final class OperationsListSamples { /* @@ -263,7 +253,7 @@ public final class OperationsListSamples { * @param manager Entry point to LoadTestManager. */ public static void operationsList(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.operations().list(Context.NONE); + manager.operations().list(com.azure.core.util.Context.NONE); } } ``` @@ -271,7 +261,6 @@ public final class OperationsListSamples { ### Quotas_CheckAvailability ```java -import com.azure.core.util.Context; import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequest; import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequestPropertiesDimensions; @@ -299,7 +288,7 @@ public final class QuotasCheckAvailabilitySamples { new QuotaBucketRequestPropertiesDimensions() .withSubscriptionId("testsubscriptionId") .withLocation("westus")), - Context.NONE); + com.azure.core.util.Context.NONE); } } ``` @@ -307,8 +296,6 @@ public final class QuotasCheckAvailabilitySamples { ### Quotas_Get ```java -import com.azure.core.util.Context; - /** Samples for Quotas Get. */ public final class QuotasGetSamples { /* @@ -320,7 +307,7 @@ public final class QuotasGetSamples { * @param manager Entry point to LoadTestManager. */ public static void quotasGet(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.quotas().getWithResponse("westus", "testQuotaBucket", Context.NONE); + manager.quotas().getWithResponse("westus", "testQuotaBucket", com.azure.core.util.Context.NONE); } } ``` @@ -328,8 +315,6 @@ public final class QuotasGetSamples { ### Quotas_List ```java -import com.azure.core.util.Context; - /** Samples for Quotas List. */ public final class QuotasListSamples { /* @@ -341,7 +326,7 @@ public final class QuotasListSamples { * @param manager Entry point to LoadTestManager. */ public static void quotasList(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.quotas().list("westus", Context.NONE); + manager.quotas().list("westus", com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/implementation/LoadTestsClientImpl.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/implementation/LoadTestsClientImpl.java index d66fac1716aab..b5405d432f4b9 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/implementation/LoadTestsClientImpl.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/implementation/LoadTestsClientImpl.java @@ -821,7 +821,7 @@ private PollerFlux, LoadTestResourceInner> beg @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, LoadTestResourceInner> beginCreateOrUpdate( String resourceGroupName, String loadTestName, LoadTestResourceInner loadTestResource) { - return beginCreateOrUpdateAsync(resourceGroupName, loadTestName, loadTestResource).getSyncPoller(); + return this.beginCreateOrUpdateAsync(resourceGroupName, loadTestName, loadTestResource).getSyncPoller(); } /** @@ -839,7 +839,9 @@ public SyncPoller, LoadTestResourceInner> begi @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, LoadTestResourceInner> beginCreateOrUpdate( String resourceGroupName, String loadTestName, LoadTestResourceInner loadTestResource, Context context) { - return beginCreateOrUpdateAsync(resourceGroupName, loadTestName, loadTestResource, context).getSyncPoller(); + return this + .beginCreateOrUpdateAsync(resourceGroupName, loadTestName, loadTestResource, context) + .getSyncPoller(); } /** @@ -1106,7 +1108,7 @@ public SyncPoller, LoadTestResourceInner> begi String resourceGroupName, String loadTestName, LoadTestResourcePatchRequestBody loadTestResourcePatchRequestBody) { - return beginUpdateAsync(resourceGroupName, loadTestName, loadTestResourcePatchRequestBody).getSyncPoller(); + return this.beginUpdateAsync(resourceGroupName, loadTestName, loadTestResourcePatchRequestBody).getSyncPoller(); } /** @@ -1127,7 +1129,8 @@ public SyncPoller, LoadTestResourceInner> begi String loadTestName, LoadTestResourcePatchRequestBody loadTestResourcePatchRequestBody, Context context) { - return beginUpdateAsync(resourceGroupName, loadTestName, loadTestResourcePatchRequestBody, context) + return this + .beginUpdateAsync(resourceGroupName, loadTestName, loadTestResourcePatchRequestBody, context) .getSyncPoller(); } @@ -1360,7 +1363,7 @@ private PollerFlux, Void> beginDeleteAsync( */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String loadTestName) { - return beginDeleteAsync(resourceGroupName, loadTestName).getSyncPoller(); + return this.beginDeleteAsync(resourceGroupName, loadTestName).getSyncPoller(); } /** @@ -1377,7 +1380,7 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( String resourceGroupName, String loadTestName, Context context) { - return beginDeleteAsync(resourceGroupName, loadTestName, context).getSyncPoller(); + return this.beginDeleteAsync(resourceGroupName, loadTestName, context).getSyncPoller(); } /** diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/ActionType.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/ActionType.java index 30f543a56aea4..b84a17f77a4b5 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/ActionType.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/ActionType.java @@ -13,6 +13,15 @@ public final class ActionType extends ExpandableStringEnum { /** Static value Internal for ActionType. */ public static final ActionType INTERNAL = fromString("Internal"); + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + /** * Creates or finds a ActionType from its string representation. * diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/ManagedServiceIdentityType.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/ManagedServiceIdentityType.java index 2d169c89a4ee2..40088e51679fc 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/ManagedServiceIdentityType.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/ManagedServiceIdentityType.java @@ -23,6 +23,15 @@ public final class ManagedServiceIdentityType extends ExpandableStringEnum { /** Static value user,system for Origin. */ public static final Origin USER_SYSTEM = fromString("user,system"); + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + /** * Creates or finds a Origin from its string representation. * diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/ResourceState.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/ResourceState.java index 069bb5949ca35..66fb0d276a804 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/ResourceState.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/ResourceState.java @@ -22,6 +22,15 @@ public final class ResourceState extends ExpandableStringEnum { /** Static value Deleted for ResourceState. */ public static final ResourceState DELETED = fromString("Deleted"); + /** + * Creates a new instance of ResourceState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceState() { + } + /** * Creates or finds a ResourceState from its string representation. * diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/Type.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/Type.java index a2801467dd2c7..94bad68850994 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/Type.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/main/java/com/azure/resourcemanager/loadtesting/models/Type.java @@ -16,6 +16,15 @@ public final class Type extends ExpandableStringEnum { /** Static value UserAssigned for Type. */ public static final Type USER_ASSIGNED = fromString("UserAssigned"); + /** + * Creates a new instance of Type value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Type() { + } + /** * Creates or finds a Type from its string representation. * diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/ReadmeSamples.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/ReadmeSamples.java deleted file mode 100644 index 9e96026d677e2..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/ReadmeSamples.java +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.resourcemanager.loadtesting; - -import com.azure.resourcemanager.loadtesting.models.LoadTestResource; -import com.azure.core.credential.TokenCredential; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.Region; -import com.azure.core.management.profile.AzureProfile; -import com.azure.identity.DefaultAzureCredentialBuilder; -import com.azure.resourcemanager.loadtesting.models.CheckQuotaAvailabilityResponse; -import com.azure.resourcemanager.loadtesting.models.EncryptionProperties; -import com.azure.resourcemanager.loadtesting.models.EncryptionPropertiesIdentity; -import com.azure.resourcemanager.loadtesting.models.ManagedServiceIdentity; -import com.azure.resourcemanager.loadtesting.models.ManagedServiceIdentityType; -import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequest; -import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequestPropertiesDimensions; -import com.azure.resourcemanager.loadtesting.models.QuotaResource; -import com.azure.resourcemanager.loadtesting.models.Type; -import com.azure.resourcemanager.loadtesting.models.UserAssignedIdentity; -import java.util.HashMap; -import java.util.Map; - -/** Samples for LoadTests CreateOrUpdate. */ -public final class ReadmeSamples { - - public static void authenticateClient() { - // BEGIN: readme-sample-authn - AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); - TokenCredential credential = new DefaultAzureCredentialBuilder() - .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) - .build(); - LoadTestManager manager = LoadTestManager - .authenticate(credential, profile); - // END: readme-sample-authn - } - - public static void createLoadTestResourceBasic(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - // BEGIN: readme-sample-createloadtestresource-basic - LoadTestResource resource = manager - .loadTests() - .define("sample-loadtesting-resource") - .withRegion(Region.US_WEST2) - .withExistingResourceGroup("sample-rg") - .create(); - // END: readme-sample-createloadtestresource-basic - } - - - public static void createLoadTestResourceEncryption(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - // BEGIN: readme-sample-createloadtestresource-encryption - // map of user-assigned managed identities to be assigned to the loadtest resource - Map map = new HashMap(); - map.put("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1", new UserAssignedIdentity()); - - // encryption identity must be assigned to the load test resource, before using it - LoadTestResource resource = manager - .loadTests() - .define("sample-loadtesting-resource") - .withRegion(Region.US_WEST2) - .withExistingResourceGroup("sample-rg") - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) - .withUserAssignedIdentities(map) - ) - .withEncryption( - new EncryptionProperties() - .withIdentity( - new EncryptionPropertiesIdentity() - .withResourceId("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1") - .withType(Type.USER_ASSIGNED) - ) - .withKeyUrl("https://sample-kv.vault.azure.net/keys/cmkkey/2d1ccd5c50234ea2a0858fe148b69cde") - ) - .create(); - // END: readme-sample-createloadtestresource-encryption - } - - public static void getLoadTestResource(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - // BEGIN: readme-sample-getloadtestresource - LoadTestResource resource = manager - .loadTests() - .getByResourceGroup("sample-rg", "sample-loadtesting-resource"); - // END: readme-sample-getloadtestresource - } - - public static void updateLoadTestResourceEncryption(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - // BEGIN: readme-sample-updateloadtestresource-encryption - LoadTestResource resource = manager - .loadTests() - .getByResourceGroup("sample-rg", "sample-loadtesting-resource"); - - LoadTestResource resourcePostUpdate = resource - .update() - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) - ) - .withEncryption( - new EncryptionProperties() - .withIdentity( - new EncryptionPropertiesIdentity() - .withResourceId(null) - .withType(Type.SYSTEM_ASSIGNED) - // make sure that system-assigned managed identity is enabled on the resource and the identity has been granted required permissions to access the key. - ) - .withKeyUrl("https://sample-kv.vault.azure.net/keys/cmkkey/2d1ccd5c50234ea2a0858fe148b69cde") - ) - .apply(); - // END: readme-sample-updateloadtestresource-encryption - } - - public static void updateLoadTestResourceManagedIdentity(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - // BEGIN: readme-sample-updateloadtestresource-mi - Map map = new HashMap(); - // Note: the value of set to null, removes the previously assigned managed identity from the load test resource - map.put("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity1", null); - map.put("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/sample-rg/providers/microsoft.managedidentity/userassignedidentities/identity2", new UserAssignedIdentity()); - - LoadTestResource resource = manager - .loadTests() - .getByResourceGroup("sample-rg", "sample-loadtesting-resource"); - - LoadTestResource resourcePostUpdate = resource - .update() - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities(map) - ) - .apply(); - // END: readme-sample-updateloadtestresource-mi - } - - public static void deleteLoadTestResource(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - // BEGIN: readme-sample-deleteloadtestresource - manager - .loadTests() - .deleteByResourceGroup("sample-rg", "sample-loadtesting-resource"); - // END: readme-sample-deleteloadtestresource - } - - public static void listAllQuotaBuckets(LoadTestManager manager) { - // BEGIN: readme-sample-list-all-quota-buckets - PagedIterable resource = manager - .quotas() - .list("westus2"); - - for (QuotaResource quotaResource : resource) { - // use the quotaResource - System.out.println(quotaResource.limit()); - } - // END: readme-sample-list-all-quota-buckets - } - - public static void getQuotaBucket(LoadTestManager manager) { - // BEGIN: readme-sample-get-quota-bucket - QuotaResource resource = manager - .quotas() - .get("westus2", "maxConcurrentTestRuns"); - System.out.println(resource.limit()); - // END: readme-sample-get-quota-bucket - } - - public static void checkQuotaAvailability(LoadTestManager manager) { - // BEGIN: readme-sample-check-quota-availability - QuotaResource resource = manager - .quotas() - .get("westus2", "maxConcurrentTestRuns"); - - QuotaBucketRequestPropertiesDimensions dimensions = new QuotaBucketRequestPropertiesDimensions() - .withLocation("westus2") - .withSubscriptionId(manager.serviceClient().getSubscriptionId()); - - QuotaBucketRequest request = new QuotaBucketRequest() - .withCurrentQuota(resource.limit()) - .withCurrentUsage(resource.usage()) - .withNewQuota(resource.limit()) - .withDimensions(dimensions); - - CheckQuotaAvailabilityResponse availability = manager - .quotas() - .checkAvailability("westus2", "maxConcurrentTestRuns", request); - - System.out.println(availability.isAvailable()); - // END: readme-sample-check-quota-availability - } - -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsDeleteSamples.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsDeleteSamples.java index e4e7265a5033c..36aeb562e53a6 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsDeleteSamples.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsDeleteSamples.java @@ -4,8 +4,6 @@ package com.azure.resourcemanager.loadtesting.generated; -import com.azure.core.util.Context; - /** Samples for LoadTests Delete. */ public final class LoadTestsDeleteSamples { /* @@ -17,6 +15,6 @@ public final class LoadTestsDeleteSamples { * @param manager Entry point to LoadTestManager. */ public static void loadTestsDelete(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.loadTests().delete("dummyrg", "myLoadTest", Context.NONE); + manager.loadTests().delete("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE); } } diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsGetByResourceGroupSamples.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsGetByResourceGroupSamples.java index fa62c4a507b72..5b3b29d8431cc 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsGetByResourceGroupSamples.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsGetByResourceGroupSamples.java @@ -4,8 +4,6 @@ package com.azure.resourcemanager.loadtesting.generated; -import com.azure.core.util.Context; - /** Samples for LoadTests GetByResourceGroup. */ public final class LoadTestsGetByResourceGroupSamples { /* @@ -17,6 +15,6 @@ public final class LoadTestsGetByResourceGroupSamples { * @param manager Entry point to LoadTestManager. */ public static void loadTestsGet(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.loadTests().getByResourceGroupWithResponse("dummyrg", "myLoadTest", Context.NONE); + manager.loadTests().getByResourceGroupWithResponse("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE); } } diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListByResourceGroupSamples.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListByResourceGroupSamples.java index bbde215a3403b..f1469fa5dd19d 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListByResourceGroupSamples.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListByResourceGroupSamples.java @@ -4,8 +4,6 @@ package com.azure.resourcemanager.loadtesting.generated; -import com.azure.core.util.Context; - /** Samples for LoadTests ListByResourceGroup. */ public final class LoadTestsListByResourceGroupSamples { /* @@ -17,6 +15,6 @@ public final class LoadTestsListByResourceGroupSamples { * @param manager Entry point to LoadTestManager. */ public static void loadTestsListByResourceGroup(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.loadTests().listByResourceGroup("dummyrg", Context.NONE); + manager.loadTests().listByResourceGroup("dummyrg", com.azure.core.util.Context.NONE); } } diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListOutboundNetworkDependenciesEndpointsSamples.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListOutboundNetworkDependenciesEndpointsSamples.java index 9d96a67fa99ba..562584bb5a307 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListOutboundNetworkDependenciesEndpointsSamples.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListOutboundNetworkDependenciesEndpointsSamples.java @@ -4,8 +4,6 @@ package com.azure.resourcemanager.loadtesting.generated; -import com.azure.core.util.Context; - /** Samples for LoadTests ListOutboundNetworkDependenciesEndpoints. */ public final class LoadTestsListOutboundNetworkDependenciesEndpointsSamples { /* @@ -20,6 +18,6 @@ public static void listOutboundNetworkDependencies(com.azure.resourcemanager.loa manager .loadTests() .listOutboundNetworkDependenciesEndpoints( - "default-azureloadtest-japaneast", "sampleloadtest", Context.NONE); + "default-azureloadtest-japaneast", "sampleloadtest", com.azure.core.util.Context.NONE); } } diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListSamples.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListSamples.java index 9432f802ebbd2..7ac987841d8b5 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListSamples.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListSamples.java @@ -4,8 +4,6 @@ package com.azure.resourcemanager.loadtesting.generated; -import com.azure.core.util.Context; - /** Samples for LoadTests List. */ public final class LoadTestsListSamples { /* @@ -17,6 +15,6 @@ public final class LoadTestsListSamples { * @param manager Entry point to LoadTestManager. */ public static void loadTestsListBySubscription(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.loadTests().list(Context.NONE); + manager.loadTests().list(com.azure.core.util.Context.NONE); } } diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsUpdateSamples.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsUpdateSamples.java index 24fec202d53dd..f99359b532743 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsUpdateSamples.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsUpdateSamples.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.loadtesting.generated; -import com.azure.core.util.Context; import com.azure.resourcemanager.loadtesting.models.EncryptionProperties; import com.azure.resourcemanager.loadtesting.models.EncryptionPropertiesIdentity; import com.azure.resourcemanager.loadtesting.models.LoadTestResource; @@ -27,7 +26,10 @@ public final class LoadTestsUpdateSamples { */ public static void loadTestsUpdate(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { LoadTestResource resource = - manager.loadTests().getByResourceGroupWithResponse("dummyrg", "myLoadTest", Context.NONE).getValue(); + manager + .loadTests() + .getByResourceGroupWithResponse("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE) + .getValue(); resource .update() .withTags(mapOf("Division", "LT", "Team", "Dev Exp")) diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/OperationsListSamples.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/OperationsListSamples.java index 37cd7be98049e..d9b5c4b153852 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/OperationsListSamples.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/OperationsListSamples.java @@ -4,8 +4,6 @@ package com.azure.resourcemanager.loadtesting.generated; -import com.azure.core.util.Context; - /** Samples for Operations List. */ public final class OperationsListSamples { /* @@ -17,6 +15,6 @@ public final class OperationsListSamples { * @param manager Entry point to LoadTestManager. */ public static void operationsList(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.operations().list(Context.NONE); + manager.operations().list(com.azure.core.util.Context.NONE); } } diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/QuotasCheckAvailabilitySamples.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/QuotasCheckAvailabilitySamples.java index f4a78444ad3d0..858f4e7171aab 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/QuotasCheckAvailabilitySamples.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/QuotasCheckAvailabilitySamples.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.loadtesting.generated; -import com.azure.core.util.Context; import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequest; import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequestPropertiesDimensions; @@ -32,6 +31,6 @@ public static void quotasCheckAvailability(com.azure.resourcemanager.loadtesting new QuotaBucketRequestPropertiesDimensions() .withSubscriptionId("testsubscriptionId") .withLocation("westus")), - Context.NONE); + com.azure.core.util.Context.NONE); } } diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/QuotasGetSamples.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/QuotasGetSamples.java index fbc5592d94c5d..353d075adb6b9 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/QuotasGetSamples.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/QuotasGetSamples.java @@ -4,8 +4,6 @@ package com.azure.resourcemanager.loadtesting.generated; -import com.azure.core.util.Context; - /** Samples for Quotas Get. */ public final class QuotasGetSamples { /* @@ -17,6 +15,6 @@ public final class QuotasGetSamples { * @param manager Entry point to LoadTestManager. */ public static void quotasGet(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.quotas().getWithResponse("westus", "testQuotaBucket", Context.NONE); + manager.quotas().getWithResponse("westus", "testQuotaBucket", com.azure.core.util.Context.NONE); } } diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/QuotasListSamples.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/QuotasListSamples.java index d77e003e5fd15..1d78aab21ab46 100644 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/QuotasListSamples.java +++ b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/samples/java/com/azure/resourcemanager/loadtesting/generated/QuotasListSamples.java @@ -4,8 +4,6 @@ package com.azure.resourcemanager.loadtesting.generated; -import com.azure.core.util.Context; - /** Samples for Quotas List. */ public final class QuotasListSamples { /* @@ -17,6 +15,6 @@ public final class QuotasListSamples { * @param manager Entry point to LoadTestManager. */ public static void quotasList(com.azure.resourcemanager.loadtesting.LoadTestManager manager) { - manager.quotas().list("westus", Context.NONE); + manager.quotas().list("westus", com.azure.core.util.Context.NONE); } } diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/CheckQuotaAvailabilityResponseInnerTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/CheckQuotaAvailabilityResponseInnerTests.java deleted file mode 100644 index 38400daa911fc..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/CheckQuotaAvailabilityResponseInnerTests.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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.fluent.models.CheckQuotaAvailabilityResponseInner; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class CheckQuotaAvailabilityResponseInnerTests { - @Test - public void testDeserialize() throws Exception { - CheckQuotaAvailabilityResponseInner model = - BinaryData - .fromString( - "{\"properties\":{\"isAvailable\":true,\"availabilityStatus\":\"jpslwejd\"},\"id\":\"wryoqpsoacc\",\"name\":\"azakl\",\"type\":\"lahbcryff\"}") - .toObject(CheckQuotaAvailabilityResponseInner.class); - Assertions.assertEquals(true, model.isAvailable()); - Assertions.assertEquals("jpslwejd", model.availabilityStatus()); - } - - @Test - public void testSerialize() throws Exception { - CheckQuotaAvailabilityResponseInner model = - new CheckQuotaAvailabilityResponseInner().withIsAvailable(true).withAvailabilityStatus("jpslwejd"); - model = BinaryData.fromObject(model).toObject(CheckQuotaAvailabilityResponseInner.class); - Assertions.assertEquals(true, model.isAvailable()); - Assertions.assertEquals("jpslwejd", model.availabilityStatus()); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/CheckQuotaAvailabilityResponsePropertiesTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/CheckQuotaAvailabilityResponsePropertiesTests.java deleted file mode 100644 index 80ad528689247..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/CheckQuotaAvailabilityResponsePropertiesTests.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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.fluent.models.CheckQuotaAvailabilityResponseProperties; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class CheckQuotaAvailabilityResponsePropertiesTests { - @Test - public void testDeserialize() throws Exception { - CheckQuotaAvailabilityResponseProperties model = - BinaryData - .fromString("{\"isAvailable\":false,\"availabilityStatus\":\"sy\"}") - .toObject(CheckQuotaAvailabilityResponseProperties.class); - Assertions.assertEquals(false, model.isAvailable()); - Assertions.assertEquals("sy", model.availabilityStatus()); - } - - @Test - public void testSerialize() throws Exception { - CheckQuotaAvailabilityResponseProperties model = - new CheckQuotaAvailabilityResponseProperties().withIsAvailable(false).withAvailabilityStatus("sy"); - model = BinaryData.fromObject(model).toObject(CheckQuotaAvailabilityResponseProperties.class); - Assertions.assertEquals(false, model.isAvailable()); - Assertions.assertEquals("sy", model.availabilityStatus()); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/EncryptionPropertiesIdentityTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/EncryptionPropertiesIdentityTests.java deleted file mode 100644 index 5fb09077fcec4..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/EncryptionPropertiesIdentityTests.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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.models.EncryptionPropertiesIdentity; -import com.azure.resourcemanager.loadtesting.models.Type; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class EncryptionPropertiesIdentityTests { - @Test - public void testDeserialize() throws Exception { - EncryptionPropertiesIdentity model = - BinaryData - .fromString("{\"type\":\"SystemAssigned\",\"resourceId\":\"qytbciq\"}") - .toObject(EncryptionPropertiesIdentity.class); - Assertions.assertEquals(Type.SYSTEM_ASSIGNED, model.type()); - Assertions.assertEquals("qytbciq", model.resourceId()); - } - - @Test - public void testSerialize() throws Exception { - EncryptionPropertiesIdentity model = - new EncryptionPropertiesIdentity().withType(Type.SYSTEM_ASSIGNED).withResourceId("qytbciq"); - model = BinaryData.fromObject(model).toObject(EncryptionPropertiesIdentity.class); - Assertions.assertEquals(Type.SYSTEM_ASSIGNED, model.type()); - Assertions.assertEquals("qytbciq", model.resourceId()); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/EndpointDependencyTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/EndpointDependencyTests.java deleted file mode 100644 index 984878b432708..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/EndpointDependencyTests.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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.models.EndpointDependency; -import org.junit.jupiter.api.Test; - -public final class EndpointDependencyTests { - @Test - public void testDeserialize() throws Exception { - EndpointDependency model = - BinaryData - .fromString( - "{\"domainName\":\"swjdkirso\",\"description\":\"qxhcrmn\",\"endpointDetails\":[{\"port\":1543175438},{\"port\":683362936},{\"port\":442113246}]}") - .toObject(EndpointDependency.class); - } - - @Test - public void testSerialize() throws Exception { - EndpointDependency model = new EndpointDependency(); - model = BinaryData.fromObject(model).toObject(EndpointDependency.class); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/EndpointDetailTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/EndpointDetailTests.java deleted file mode 100644 index c43457b5a61f0..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/EndpointDetailTests.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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.models.EndpointDetail; -import org.junit.jupiter.api.Test; - -public final class EndpointDetailTests { - @Test - public void testDeserialize() throws Exception { - EndpointDetail model = BinaryData.fromString("{\"port\":1629637737}").toObject(EndpointDetail.class); - } - - @Test - public void testSerialize() throws Exception { - EndpointDetail model = new EndpointDetail(); - model = BinaryData.fromObject(model).toObject(EndpointDetail.class); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/LoadTestResourcePageListTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/LoadTestResourcePageListTests.java deleted file mode 100644 index 70fc76bc49786..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/LoadTestResourcePageListTests.java +++ /dev/null @@ -1,92 +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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.fluent.models.LoadTestResourceInner; -import com.azure.resourcemanager.loadtesting.models.LoadTestResourcePageList; -import com.azure.resourcemanager.loadtesting.models.ManagedServiceIdentity; -import com.azure.resourcemanager.loadtesting.models.ManagedServiceIdentityType; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class LoadTestResourcePageListTests { - @Test - public void testDeserialize() throws Exception { - LoadTestResourcePageList model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"description\":\"ojakhmsbzjhcrze\",\"provisioningState\":\"Failed\",\"dataPlaneURI\":\"lxaolthqtrgqjbp\"},\"identity\":{\"principalId\":\"d8355447-72f1-44d8-b9d9-424330cd5118\",\"tenantId\":\"4544623b-f738-43d8-9988-aa3a9561b4c4\",\"type\":\"None\",\"userAssignedIdentities\":{}},\"location\":\"v\",\"tags\":{\"it\":\"rwzoxxjtfelluwf\",\"qfpjk\":\"np\"},\"id\":\"lxofpdvhpfxxypin\",\"name\":\"nmayhuybb\",\"type\":\"podepoo\"},{\"properties\":{\"description\":\"uvamiheognarxzxt\",\"provisioningState\":\"Succeeded\",\"dataPlaneURI\":\"usivye\"},\"identity\":{\"principalId\":\"e70183de-d8ad-4b0a-af38-1fb93774b6cc\",\"tenantId\":\"6e455a2c-2c73-4178-b928-137b9fa6b1c0\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{}},\"location\":\"hungbwjzrnf\",\"tags\":{\"ofx\":\"gispemvtzfkufubl\",\"jbasvmsmjqulngs\":\"eofjaeqjh\",\"bkzgcwrwclx\":\"tnb\",\"vkocrcjdkwtn\":\"wrljdouskc\"},\"id\":\"xbnjbiksq\",\"name\":\"gls\",\"type\":\"ainqpjwnzlljfm\"},{\"properties\":{\"description\":\"ebvmgxsabkyqd\",\"provisioningState\":\"Canceled\",\"dataPlaneURI\":\"tcj\"},\"identity\":{\"principalId\":\"61d43b42-c9e8-4183-b0cd-98df81e99923\",\"tenantId\":\"69ff926e-648b-425a-a414-9462a20a386f\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{}},\"location\":\"hkr\",\"tags\":{\"bdkvwrwjf\":\"appd\"},\"id\":\"usnhutje\",\"name\":\"tmrldhugjzzdatq\",\"type\":\"hocdgeab\"}],\"nextLink\":\"phut\"}") - .toObject(LoadTestResourcePageList.class); - Assertions.assertEquals("v", model.value().get(0).location()); - Assertions.assertEquals("rwzoxxjtfelluwf", model.value().get(0).tags().get("it")); - Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.value().get(0).identity().type()); - Assertions.assertEquals("ojakhmsbzjhcrze", model.value().get(0).description()); - Assertions.assertEquals("phut", model.nextLink()); - } - - @Test - public void testSerialize() throws Exception { - LoadTestResourcePageList model = - new LoadTestResourcePageList() - .withValue( - Arrays - .asList( - new LoadTestResourceInner() - .withLocation("v") - .withTags(mapOf("it", "rwzoxxjtfelluwf", "qfpjk", "np")) - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.NONE) - .withUserAssignedIdentities(mapOf())) - .withDescription("ojakhmsbzjhcrze"), - new LoadTestResourceInner() - .withLocation("hungbwjzrnf") - .withTags( - mapOf( - "ofx", - "gispemvtzfkufubl", - "jbasvmsmjqulngs", - "eofjaeqjh", - "bkzgcwrwclx", - "tnb", - "vkocrcjdkwtn", - "wrljdouskc")) - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) - .withUserAssignedIdentities(mapOf())) - .withDescription("uvamiheognarxzxt"), - new LoadTestResourceInner() - .withLocation("hkr") - .withTags(mapOf("bdkvwrwjf", "appd")) - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities(mapOf())) - .withDescription("ebvmgxsabkyqd"))) - .withNextLink("phut"); - model = BinaryData.fromObject(model).toObject(LoadTestResourcePageList.class); - Assertions.assertEquals("v", model.value().get(0).location()); - Assertions.assertEquals("rwzoxxjtfelluwf", model.value().get(0).tags().get("it")); - Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.value().get(0).identity().type()); - Assertions.assertEquals("ojakhmsbzjhcrze", model.value().get(0).description()); - Assertions.assertEquals("phut", model.nextLink()); - } - - @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/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsDeleteMockTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsDeleteMockTests.java deleted file mode 100644 index b33c25a342b02..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsDeleteMockTests.java +++ /dev/null @@ -1,62 +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.loadtesting.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.core.util.Context; -import com.azure.resourcemanager.loadtesting.LoadTestManager; -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 LoadTestsDeleteMockTests { - @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); - })); - - LoadTestManager manager = - LoadTestManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.loadTests().delete("h", "qfbow", Context.NONE); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListOutboundNetworkDependenciesEndpointsMockTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListOutboundNetworkDependenciesEndpointsMockTests.java deleted file mode 100644 index b6c675f8e1555..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/LoadTestsListOutboundNetworkDependenciesEndpointsMockTests.java +++ /dev/null @@ -1,66 +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.loadtesting.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.core.util.Context; -import com.azure.resourcemanager.loadtesting.LoadTestManager; -import com.azure.resourcemanager.loadtesting.models.OutboundEnvironmentEndpoint; -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 LoadTestsListOutboundNetworkDependenciesEndpointsMockTests { - @Test - public void testListOutboundNetworkDependenciesEndpoints() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"category\":\"hzgpphrcgyncocpe\",\"endpoints\":[{\"domainName\":\"mcoo\",\"description\":\"xlzevgbmqjqabcy\",\"endpointDetails\":[]},{\"domainName\":\"kwlzuvccfwnfn\",\"description\":\"cfionl\",\"endpointDetails\":[]}]}]}"; - - 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); - })); - - LoadTestManager manager = - LoadTestManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.loadTests().listOutboundNetworkDependenciesEndpoints("kanyktzlcuiywg", "ywgndrv", Context.NONE); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/ManagedServiceIdentityTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/ManagedServiceIdentityTests.java deleted file mode 100644 index 3c58d98146d61..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/ManagedServiceIdentityTests.java +++ /dev/null @@ -1,54 +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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.models.ManagedServiceIdentity; -import com.azure.resourcemanager.loadtesting.models.ManagedServiceIdentityType; -import com.azure.resourcemanager.loadtesting.models.UserAssignedIdentity; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class ManagedServiceIdentityTests { - @Test - public void testDeserialize() throws Exception { - ManagedServiceIdentity model = - BinaryData - .fromString( - "{\"principalId\":\"21bfc49c-93a9-4ce4-8e65-f3ad192fd0b7\",\"tenantId\":\"91a226df-aabc-40f2-8069-145b874ae426\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"kzsmodm\":{\"principalId\":\"a1e7264a-907c-437b-bef7-6a14d8bacdb1\",\"clientId\":\"1512b7ad-0c07-4ffb-a8ac-2e46fcebda38\"},\"ugpbkw\":{\"principalId\":\"7dd8800f-1a7c-4608-ab97-b68f9a2a988b\",\"clientId\":\"c116280a-4b22-4458-b9db-4fe9c2f8457e\"},\"tduqktapspwgcuer\":{\"principalId\":\"c33f551a-430c-4fa3-81c5-bced086e4780\",\"clientId\":\"01cfd135-6f98-48fc-812c-a7d705e99e1a\"}}}") - .toObject(ManagedServiceIdentity.class); - Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.type()); - } - - @Test - public void testSerialize() throws Exception { - ManagedServiceIdentity model = - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "kzsmodm", - new UserAssignedIdentity(), - "ugpbkw", - new UserAssignedIdentity(), - "tduqktapspwgcuer", - new UserAssignedIdentity())); - model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); - Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.type()); - } - - @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/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OperationDisplayTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OperationDisplayTests.java deleted file mode 100644 index 6d4b55347f041..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OperationDisplayTests.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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.models.OperationDisplay; -import org.junit.jupiter.api.Test; - -public final class OperationDisplayTests { - @Test - public void testDeserialize() throws Exception { - OperationDisplay model = - BinaryData - .fromString( - "{\"provider\":\"yrtih\",\"resource\":\"tijbpzvgnwzsymgl\",\"operation\":\"fcyzkohdbihanufh\",\"description\":\"bj\"}") - .toObject(OperationDisplay.class); - } - - @Test - public void testSerialize() throws Exception { - OperationDisplay model = new OperationDisplay(); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OperationInnerTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OperationInnerTests.java deleted file mode 100644 index f12276e7ea947..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OperationInnerTests.java +++ /dev/null @@ -1,27 +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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.fluent.models.OperationInner; -import com.azure.resourcemanager.loadtesting.models.OperationDisplay; -import org.junit.jupiter.api.Test; - -public final class OperationInnerTests { - @Test - public void testDeserialize() throws Exception { - OperationInner model = - BinaryData - .fromString( - "{\"name\":\"usarhmofc\",\"isDataAction\":false,\"display\":{\"provider\":\"urkdtmlx\",\"resource\":\"kuksjtxukcdm\",\"operation\":\"rcryuanzwuxzdxta\",\"description\":\"lhmwhfpmrqobm\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") - .toObject(OperationInner.class); - } - - @Test - public void testSerialize() throws Exception { - OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); - model = BinaryData.fromObject(model).toObject(OperationInner.class); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OperationListResultTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OperationListResultTests.java deleted file mode 100644 index d400d4a63fdd2..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OperationListResultTests.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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.models.OperationListResult; -import org.junit.jupiter.api.Test; - -public final class OperationListResultTests { - @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\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"izhwlrxy\",\"isDataAction\":false,\"display\":{\"provider\":\"ijgkdm\",\"resource\":\"azlobcufpdznrbt\",\"operation\":\"qjnqglhqgnufoooj\",\"description\":\"ifsqesaagdfmg\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"rifkwm\",\"isDataAction\":true,\"display\":{\"provider\":\"izntocipao\",\"resource\":\"jpsq\",\"operation\":\"mpoyfd\",\"description\":\"ogknygjofjdd\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"upewnwreitjzy\"}") - .toObject(OperationListResult.class); - } - - @Test - public void testSerialize() throws Exception { - OperationListResult model = new OperationListResult(); - model = BinaryData.fromObject(model).toObject(OperationListResult.class); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OperationsListMockTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OperationsListMockTests.java deleted file mode 100644 index 2e740edecff8a..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OperationsListMockTests.java +++ /dev/null @@ -1,65 +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.loadtesting.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.core.util.Context; -import com.azure.resourcemanager.loadtesting.LoadTestManager; -import com.azure.resourcemanager.loadtesting.models.Operation; -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 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\":\"fiyipjxsqwpgrj\",\"isDataAction\":true,\"display\":{\"provider\":\"cjxvsnbyxqab\",\"resource\":\"ocpcy\",\"operation\":\"urzafb\",\"description\":\"j\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; - - 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); - })); - - LoadTestManager manager = - LoadTestManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.operations().list(Context.NONE); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OutboundEnvironmentEndpointCollectionTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OutboundEnvironmentEndpointCollectionTests.java deleted file mode 100644 index 396493270089b..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OutboundEnvironmentEndpointCollectionTests.java +++ /dev/null @@ -1,28 +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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.models.OutboundEnvironmentEndpointCollection; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class OutboundEnvironmentEndpointCollectionTests { - @Test - public void testDeserialize() throws Exception { - OutboundEnvironmentEndpointCollection model = - BinaryData - .fromString("{\"value\":[{\"category\":\"pymzidnsezcxtbzs\",\"endpoints\":[]}],\"nextLink\":\"cs\"}") - .toObject(OutboundEnvironmentEndpointCollection.class); - Assertions.assertEquals("cs", model.nextLink()); - } - - @Test - public void testSerialize() throws Exception { - OutboundEnvironmentEndpointCollection model = new OutboundEnvironmentEndpointCollection().withNextLink("cs"); - model = BinaryData.fromObject(model).toObject(OutboundEnvironmentEndpointCollection.class); - Assertions.assertEquals("cs", model.nextLink()); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OutboundEnvironmentEndpointInnerTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OutboundEnvironmentEndpointInnerTests.java deleted file mode 100644 index 285b8d1b78cc1..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/OutboundEnvironmentEndpointInnerTests.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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.fluent.models.OutboundEnvironmentEndpointInner; -import org.junit.jupiter.api.Test; - -public final class OutboundEnvironmentEndpointInnerTests { - @Test - public void testDeserialize() throws Exception { - OutboundEnvironmentEndpointInner model = - BinaryData - .fromString( - "{\"category\":\"wmdwzjeiachboo\",\"endpoints\":[{\"domainName\":\"ro\",\"description\":\"qpteeh\",\"endpointDetails\":[]},{\"domainName\":\"pyqr\",\"description\":\"z\",\"endpointDetails\":[]}]}") - .toObject(OutboundEnvironmentEndpointInner.class); - } - - @Test - public void testSerialize() throws Exception { - OutboundEnvironmentEndpointInner model = new OutboundEnvironmentEndpointInner(); - model = BinaryData.fromObject(model).toObject(OutboundEnvironmentEndpointInner.class); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaBucketRequestPropertiesDimensionsTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaBucketRequestPropertiesDimensionsTests.java deleted file mode 100644 index 69646f3b5f233..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaBucketRequestPropertiesDimensionsTests.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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequestPropertiesDimensions; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class QuotaBucketRequestPropertiesDimensionsTests { - @Test - public void testDeserialize() throws Exception { - QuotaBucketRequestPropertiesDimensions model = - BinaryData - .fromString("{\"subscriptionId\":\"mdvpjhulsu\",\"location\":\"mkjozkrwf\"}") - .toObject(QuotaBucketRequestPropertiesDimensions.class); - Assertions.assertEquals("mdvpjhulsu", model.subscriptionId()); - Assertions.assertEquals("mkjozkrwf", model.location()); - } - - @Test - public void testSerialize() throws Exception { - QuotaBucketRequestPropertiesDimensions model = - new QuotaBucketRequestPropertiesDimensions().withSubscriptionId("mdvpjhulsu").withLocation("mkjozkrwf"); - model = BinaryData.fromObject(model).toObject(QuotaBucketRequestPropertiesDimensions.class); - Assertions.assertEquals("mdvpjhulsu", model.subscriptionId()); - Assertions.assertEquals("mkjozkrwf", model.location()); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaBucketRequestPropertiesTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaBucketRequestPropertiesTests.java deleted file mode 100644 index 4f5b40ee05f33..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaBucketRequestPropertiesTests.java +++ /dev/null @@ -1,44 +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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.fluent.models.QuotaBucketRequestProperties; -import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequestPropertiesDimensions; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class QuotaBucketRequestPropertiesTests { - @Test - public void testDeserialize() throws Exception { - QuotaBucketRequestProperties model = - BinaryData - .fromString( - "{\"currentUsage\":1708707643,\"currentQuota\":1146923499,\"newQuota\":409698731,\"dimensions\":{\"subscriptionId\":\"vwmf\",\"location\":\"t\"}}") - .toObject(QuotaBucketRequestProperties.class); - Assertions.assertEquals(1708707643, model.currentUsage()); - Assertions.assertEquals(1146923499, model.currentQuota()); - Assertions.assertEquals(409698731, model.newQuota()); - Assertions.assertEquals("vwmf", model.dimensions().subscriptionId()); - Assertions.assertEquals("t", model.dimensions().location()); - } - - @Test - public void testSerialize() throws Exception { - QuotaBucketRequestProperties model = - new QuotaBucketRequestProperties() - .withCurrentUsage(1708707643) - .withCurrentQuota(1146923499) - .withNewQuota(409698731) - .withDimensions( - new QuotaBucketRequestPropertiesDimensions().withSubscriptionId("vwmf").withLocation("t")); - model = BinaryData.fromObject(model).toObject(QuotaBucketRequestProperties.class); - Assertions.assertEquals(1708707643, model.currentUsage()); - Assertions.assertEquals(1146923499, model.currentQuota()); - Assertions.assertEquals(409698731, model.newQuota()); - Assertions.assertEquals("vwmf", model.dimensions().subscriptionId()); - Assertions.assertEquals("t", model.dimensions().location()); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaBucketRequestTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaBucketRequestTests.java deleted file mode 100644 index 7d8385320ffa4..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaBucketRequestTests.java +++ /dev/null @@ -1,46 +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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequest; -import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequestPropertiesDimensions; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class QuotaBucketRequestTests { - @Test - public void testDeserialize() throws Exception { - QuotaBucketRequest model = - BinaryData - .fromString( - "{\"properties\":{\"currentUsage\":367055683,\"currentQuota\":1978797807,\"newQuota\":1332341838,\"dimensions\":{\"subscriptionId\":\"yemkkvnip\",\"location\":\"xzjnchgejs\"}},\"id\":\"dmailzydehojw\",\"name\":\"ahuxinpm\",\"type\":\"njaqwixjspro\"}") - .toObject(QuotaBucketRequest.class); - Assertions.assertEquals(367055683, model.currentUsage()); - Assertions.assertEquals(1978797807, model.currentQuota()); - Assertions.assertEquals(1332341838, model.newQuota()); - Assertions.assertEquals("yemkkvnip", model.dimensions().subscriptionId()); - Assertions.assertEquals("xzjnchgejs", model.dimensions().location()); - } - - @Test - public void testSerialize() throws Exception { - QuotaBucketRequest model = - new QuotaBucketRequest() - .withCurrentUsage(367055683) - .withCurrentQuota(1978797807) - .withNewQuota(1332341838) - .withDimensions( - new QuotaBucketRequestPropertiesDimensions() - .withSubscriptionId("yemkkvnip") - .withLocation("xzjnchgejs")); - model = BinaryData.fromObject(model).toObject(QuotaBucketRequest.class); - Assertions.assertEquals(367055683, model.currentUsage()); - Assertions.assertEquals(1978797807, model.currentQuota()); - Assertions.assertEquals(1332341838, model.newQuota()); - Assertions.assertEquals("yemkkvnip", model.dimensions().subscriptionId()); - Assertions.assertEquals("xzjnchgejs", model.dimensions().location()); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaResourceInnerTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaResourceInnerTests.java deleted file mode 100644 index e6954193fff06..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaResourceInnerTests.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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.fluent.models.QuotaResourceInner; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class QuotaResourceInnerTests { - @Test - public void testDeserialize() throws Exception { - QuotaResourceInner model = - BinaryData - .fromString( - "{\"properties\":{\"limit\":143848779,\"usage\":519347031,\"provisioningState\":\"Canceled\"},\"id\":\"jgrtfwvukxga\",\"name\":\"dcc\",\"type\":\"nhsjcnyej\"}") - .toObject(QuotaResourceInner.class); - Assertions.assertEquals(143848779, model.limit()); - Assertions.assertEquals(519347031, model.usage()); - } - - @Test - public void testSerialize() throws Exception { - QuotaResourceInner model = new QuotaResourceInner().withLimit(143848779).withUsage(519347031); - model = BinaryData.fromObject(model).toObject(QuotaResourceInner.class); - Assertions.assertEquals(143848779, model.limit()); - Assertions.assertEquals(519347031, model.usage()); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaResourceListTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaResourceListTests.java deleted file mode 100644 index b1fda9ec68035..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaResourceListTests.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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.models.QuotaResourceList; -import org.junit.jupiter.api.Test; - -public final class QuotaResourceListTests { - @Test - public void testDeserialize() throws Exception { - QuotaResourceList model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"limit\":437058664,\"usage\":1438180551,\"provisioningState\":\"Succeeded\"},\"id\":\"bifpikxwczb\",\"name\":\"scnpqxuhivy\",\"type\":\"n\"}],\"nextLink\":\"b\"}") - .toObject(QuotaResourceList.class); - } - - @Test - public void testSerialize() throws Exception { - QuotaResourceList model = new QuotaResourceList(); - model = BinaryData.fromObject(model).toObject(QuotaResourceList.class); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaResourcePropertiesTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaResourcePropertiesTests.java deleted file mode 100644 index 07b6dc68973f9..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotaResourcePropertiesTests.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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.fluent.models.QuotaResourceProperties; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public final class QuotaResourcePropertiesTests { - @Test - public void testDeserialize() throws Exception { - QuotaResourceProperties model = - BinaryData - .fromString("{\"limit\":1833864756,\"usage\":1656493513,\"provisioningState\":\"Canceled\"}") - .toObject(QuotaResourceProperties.class); - Assertions.assertEquals(1833864756, model.limit()); - Assertions.assertEquals(1656493513, model.usage()); - } - - @Test - public void testSerialize() throws Exception { - QuotaResourceProperties model = new QuotaResourceProperties().withLimit(1833864756).withUsage(1656493513); - model = BinaryData.fromObject(model).toObject(QuotaResourceProperties.class); - Assertions.assertEquals(1833864756, model.limit()); - Assertions.assertEquals(1656493513, model.usage()); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotasCheckAvailabilityWithResponseMockTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotasCheckAvailabilityWithResponseMockTests.java deleted file mode 100644 index 1b415b6612028..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotasCheckAvailabilityWithResponseMockTests.java +++ /dev/null @@ -1,85 +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.loadtesting.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.core.util.Context; -import com.azure.resourcemanager.loadtesting.LoadTestManager; -import com.azure.resourcemanager.loadtesting.models.CheckQuotaAvailabilityResponse; -import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequest; -import com.azure.resourcemanager.loadtesting.models.QuotaBucketRequestPropertiesDimensions; -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 QuotasCheckAvailabilityWithResponseMockTests { - @Test - public void testCheckAvailabilityWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"isAvailable\":false,\"availabilityStatus\":\"xhvpmoue\"},\"id\":\"dzxibqeojnxqbzvd\",\"name\":\"ntwndeicbtwnpzao\",\"type\":\"vuhrhcffcyddgl\"}"; - - 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); - })); - - LoadTestManager manager = - LoadTestManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - CheckQuotaAvailabilityResponse response = - manager - .quotas() - .checkAvailabilityWithResponse( - "dg", - "aajrm", - new QuotaBucketRequest() - .withCurrentUsage(1261399302) - .withCurrentQuota(1674206223) - .withNewQuota(1705200326) - .withDimensions( - new QuotaBucketRequestPropertiesDimensions() - .withSubscriptionId("clwhijcoejctbz") - .withLocation("s")), - Context.NONE) - .getValue(); - - Assertions.assertEquals(false, response.isAvailable()); - Assertions.assertEquals("xhvpmoue", response.availabilityStatus()); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotasGetWithResponseMockTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotasGetWithResponseMockTests.java deleted file mode 100644 index 6d82264e7b413..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotasGetWithResponseMockTests.java +++ /dev/null @@ -1,68 +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.loadtesting.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.core.util.Context; -import com.azure.resourcemanager.loadtesting.LoadTestManager; -import com.azure.resourcemanager.loadtesting.models.QuotaResource; -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 QuotasGetWithResponseMockTests { - @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\":{\"limit\":1273206758,\"usage\":865429737,\"provisioningState\":\"Deleted\"},\"id\":\"nbdxk\",\"name\":\"pxokajionp\",\"type\":\"mexgstxgcp\"}"; - - 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); - })); - - LoadTestManager manager = - LoadTestManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - QuotaResource response = manager.quotas().getWithResponse("paierh", "bcsglumma", Context.NONE).getValue(); - - Assertions.assertEquals(1273206758, response.limit()); - Assertions.assertEquals(865429737, response.usage()); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotasListMockTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotasListMockTests.java deleted file mode 100644 index 49c2e013b14bb..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/QuotasListMockTests.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.loadtesting.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.core.util.Context; -import com.azure.resourcemanager.loadtesting.LoadTestManager; -import com.azure.resourcemanager.loadtesting.models.QuotaResource; -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 QuotasListMockTests { - @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\":{\"limit\":232928194,\"usage\":1963237214,\"provisioningState\":\"Canceled\"},\"id\":\"tqajzyulpkudjkrl\",\"name\":\"hbzhfepg\",\"type\":\"gqexzlocxs\"}]}"; - - 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); - })); - - LoadTestManager manager = - LoadTestManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.quotas().list("qcjm", Context.NONE); - - Assertions.assertEquals(232928194, response.iterator().next().limit()); - Assertions.assertEquals(1963237214, response.iterator().next().usage()); - } -} diff --git a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/UserAssignedIdentityTests.java b/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/UserAssignedIdentityTests.java deleted file mode 100644 index a279ad40e0619..0000000000000 --- a/sdk/loadtesting/azure-resourcemanager-loadtesting/src/test/java/com/azure/resourcemanager/loadtesting/generated/UserAssignedIdentityTests.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.loadtesting.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.loadtesting.models.UserAssignedIdentity; -import org.junit.jupiter.api.Test; - -public final class UserAssignedIdentityTests { - @Test - public void testDeserialize() throws Exception { - UserAssignedIdentity model = - BinaryData - .fromString( - "{\"principalId\":\"7f6b70cb-eae3-4ed3-8692-0bc4b2559fbc\",\"clientId\":\"5e9f85fd-01b0-4f54-a44b-0d25d9c5cd11\"}") - .toObject(UserAssignedIdentity.class); - } - - @Test - public void testSerialize() throws Exception { - UserAssignedIdentity model = new UserAssignedIdentity(); - model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); - } -}