diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/CHANGELOG.md b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/CHANGELOG.md index df93f57b5e5e..bbf296b604c8 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/CHANGELOG.md +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2023-06-15) + +- Azure Resource Manager CosmosDBForPostgreSql client library for Java. This package contains Microsoft Azure SDK for CosmosDBForPostgreSql Management SDK. Azure Cosmos DB for PostgreSQL database service resource provider REST APIs. Package tag package-2022-11-08. 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/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/README.md b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/README.md index 405ed6a3bfa2..7954166a2f93 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/README.md +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-cosmosdbforpostgresql - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/SAMPLE.md b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/SAMPLE.md index 07a517791230..a14380f1ca86 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/SAMPLE.md +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/SAMPLE.md @@ -94,61 +94,108 @@ import java.util.Map; /** Samples for Clusters Create. */ public final class ClustersCreateSamples { /* - * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateReadReplica.json + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateSingleNode.json */ /** - * Sample code: Create a new cluster as a read replica. + * Sample code: Create a new single node cluster. * * @param manager Entry point to CosmosDBForPostgreSqlManager. */ - public static void createANewClusterAsAReadReplica( + public static void createANewSingleNodeCluster( com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { manager .clusters() - .define("testcluster") + .define("testcluster-singlenode") .withRegion("westus") .withExistingResourceGroup("TestGroup") - .withSourceResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster") - .withSourceLocation("westus") + .withTags(mapOf("owner", "JohnDoe")) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.3") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(true) + .withEnableHa(true) + .withCoordinatorServerEdition("GeneralPurpose") + .withCoordinatorStorageQuotaInMb(131072) + .withCoordinatorVCores(8) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeCount(0) .create(); } /* - * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreatePITR.json + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateBurstablev1.json */ /** - * Sample code: Create a new cluster as a point in time restore. + * Sample code: Create a new single node Burstable 1 vCore cluster. * * @param manager Entry point to CosmosDBForPostgreSqlManager. */ - public static void createANewClusterAsAPointInTimeRestore( + public static void createANewSingleNodeBurstable1VCoreCluster( com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { manager .clusters() - .define("testcluster") + .define("testcluster-burstablev1") .withRegion("westus") .withExistingResourceGroup("TestGroup") - .withSourceResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster") - .withSourceLocation("westus") - .withPointInTimeUtc(OffsetDateTime.parse("2017-12-14T00:00:37.467Z")) + .withTags(mapOf("owner", "JohnDoe")) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.3") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(true) + .withEnableHa(false) + .withCoordinatorServerEdition("BurstableMemoryOptimized") + .withCoordinatorStorageQuotaInMb(131072) + .withCoordinatorVCores(1) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeCount(0) .create(); } /* - * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreate.json + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateBurstablev2.json */ /** - * Sample code: Create a new cluster. + * Sample code: Create a new single node Burstable 2 vCores cluster. * * @param manager Entry point to CosmosDBForPostgreSqlManager. */ - public static void createANewCluster( + public static void createANewSingleNodeBurstable2VCoresCluster( com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { manager .clusters() - .define("testcluster") + .define("testcluster-burstablev2") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withTags(mapOf("owner", "JohnDoe")) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.3") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(true) + .withEnableHa(false) + .withCoordinatorServerEdition("BurstableGeneralPurpose") + .withCoordinatorStorageQuotaInMb(131072) + .withCoordinatorVCores(2) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeCount(0) + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateMultiNode.json + */ + /** + * Sample code: Create a new multi-node cluster. + * + * @param manager Entry point to CosmosDBForPostgreSqlManager. + */ + public static void createANewMultiNodeCluster( + com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { + manager + .clusters() + .define("testcluster-multinode") .withRegion("westus") .withExistingResourceGroup("TestGroup") .withTags(mapOf()) @@ -170,6 +217,49 @@ public final class ClustersCreateSamples { .create(); } + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateReadReplica.json + */ + /** + * Sample code: Create a new cluster as a read replica. + * + * @param manager Entry point to CosmosDBForPostgreSqlManager. + */ + public static void createANewClusterAsAReadReplica( + com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { + manager + .clusters() + .define("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster") + .withSourceLocation("westus") + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreatePITR.json + */ + /** + * Sample code: Create a new cluster as a point in time restore. + * + * @param manager Entry point to CosmosDBForPostgreSqlManager. + */ + public static void createANewClusterAsAPointInTimeRestore( + com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { + manager + .clusters() + .define("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster") + .withSourceLocation("westus") + .withPointInTimeUtc(OffsetDateTime.parse("2017-12-14T00:00:37.467Z")) + .create(); + } + @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterInner.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterInner.java index 2a03c4c805f0..798a7869f1cd 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterInner.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterInner.java @@ -209,7 +209,8 @@ public ClusterInner withPreferredPrimaryZone(String preferredPrimaryZone) { } /** - * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Get the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @return the enableShardsOnCoordinator value. */ @@ -218,7 +219,8 @@ public Boolean enableShardsOnCoordinator() { } /** - * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Set the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. * @return the ClusterInner object itself. diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterProperties.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterProperties.java index 6f24c9787152..22d77a68f0f4 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterProperties.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterProperties.java @@ -64,7 +64,8 @@ public final class ClusterProperties { private String preferredPrimaryZone; /* - * If shards on coordinator is enabled or not for the cluster. + * If distributed tables are placed on coordinator or not. Should be set to 'true' on single node clusters. + * Requires shard rebalancing after value is changed. */ @JsonProperty(value = "enableShardsOnCoordinator") private Boolean enableShardsOnCoordinator; @@ -309,7 +310,8 @@ public ClusterProperties withPreferredPrimaryZone(String preferredPrimaryZone) { } /** - * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Get the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @return the enableShardsOnCoordinator value. */ @@ -318,7 +320,8 @@ public Boolean enableShardsOnCoordinator() { } /** - * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Set the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. * @return the ClusterProperties object itself. diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterPropertiesForUpdate.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterPropertiesForUpdate.java index eaae41d743d2..82ee433f3368 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterPropertiesForUpdate.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/fluent/models/ClusterPropertiesForUpdate.java @@ -31,7 +31,8 @@ public final class ClusterPropertiesForUpdate { private String citusVersion; /* - * If shards on coordinator is enabled or not for the cluster. + * If distributed tables are placed on coordinator or not. Should be set to 'true' on single node clusters. + * Requires shard rebalancing after value is changed. */ @JsonProperty(value = "enableShardsOnCoordinator") private Boolean enableShardsOnCoordinator; @@ -177,7 +178,8 @@ public ClusterPropertiesForUpdate withCitusVersion(String citusVersion) { } /** - * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Get the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @return the enableShardsOnCoordinator value. */ @@ -186,7 +188,8 @@ public Boolean enableShardsOnCoordinator() { } /** - * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Set the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. * @return the ClusterPropertiesForUpdate object itself. diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/Cluster.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/Cluster.java index 8536be225f70..9f494ab3b1b8 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/Cluster.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/Cluster.java @@ -113,7 +113,8 @@ public interface Cluster { String preferredPrimaryZone(); /** - * Gets the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Gets the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be + * set to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @return the enableShardsOnCoordinator value. */ @@ -418,10 +419,11 @@ interface WithPreferredPrimaryZone { /** The stage of the Cluster definition allowing to specify enableShardsOnCoordinator. */ interface WithEnableShardsOnCoordinator { /** - * Specifies the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the - * cluster.. + * Specifies the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. + * Should be set to 'true' on single node clusters. Requires shard rebalancing after value is changed.. * - * @param enableShardsOnCoordinator If shards on coordinator is enabled or not for the cluster. + * @param enableShardsOnCoordinator If distributed tables are placed on coordinator or not. Should be set to + * 'true' on single node clusters. Requires shard rebalancing after value is changed. * @return the next definition stage. */ WithCreate withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator); @@ -658,10 +660,11 @@ interface WithCitusVersion { /** The stage of the Cluster update allowing to specify enableShardsOnCoordinator. */ interface WithEnableShardsOnCoordinator { /** - * Specifies the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the - * cluster.. + * Specifies the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. + * Should be set to 'true' on single node clusters. Requires shard rebalancing after value is changed.. * - * @param enableShardsOnCoordinator If shards on coordinator is enabled or not for the cluster. + * @param enableShardsOnCoordinator If distributed tables are placed on coordinator or not. Should be set to + * 'true' on single node clusters. Requires shard rebalancing after value is changed. * @return the next definition stage. */ Update withEnableShardsOnCoordinator(Boolean enableShardsOnCoordinator); diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/ClusterForUpdate.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/ClusterForUpdate.java index c4e36b7097dc..c2735b25a05e 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/ClusterForUpdate.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/main/java/com/azure/resourcemanager/cosmosdbforpostgresql/models/ClusterForUpdate.java @@ -131,7 +131,8 @@ public ClusterForUpdate withCitusVersion(String citusVersion) { } /** - * Get the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Get the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @return the enableShardsOnCoordinator value. */ @@ -140,7 +141,8 @@ public Boolean enableShardsOnCoordinator() { } /** - * Set the enableShardsOnCoordinator property: If shards on coordinator is enabled or not for the cluster. + * Set the enableShardsOnCoordinator property: If distributed tables are placed on coordinator or not. Should be set + * to 'true' on single node clusters. Requires shard rebalancing after value is changed. * * @param enableShardsOnCoordinator the enableShardsOnCoordinator value to set. * @return the ClusterForUpdate object itself. diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/samples/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCreateSamples.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/samples/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCreateSamples.java index e9e2118b4110..bc587314c4b4 100644 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/samples/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCreateSamples.java +++ b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/samples/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCreateSamples.java @@ -11,61 +11,108 @@ /** Samples for Clusters Create. */ public final class ClustersCreateSamples { /* - * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateReadReplica.json + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateSingleNode.json */ /** - * Sample code: Create a new cluster as a read replica. + * Sample code: Create a new single node cluster. * * @param manager Entry point to CosmosDBForPostgreSqlManager. */ - public static void createANewClusterAsAReadReplica( + public static void createANewSingleNodeCluster( com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { manager .clusters() - .define("testcluster") + .define("testcluster-singlenode") .withRegion("westus") .withExistingResourceGroup("TestGroup") - .withSourceResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster") - .withSourceLocation("westus") + .withTags(mapOf("owner", "JohnDoe")) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.3") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(true) + .withEnableHa(true) + .withCoordinatorServerEdition("GeneralPurpose") + .withCoordinatorStorageQuotaInMb(131072) + .withCoordinatorVCores(8) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeCount(0) .create(); } /* - * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreatePITR.json + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateBurstablev1.json */ /** - * Sample code: Create a new cluster as a point in time restore. + * Sample code: Create a new single node Burstable 1 vCore cluster. * * @param manager Entry point to CosmosDBForPostgreSqlManager. */ - public static void createANewClusterAsAPointInTimeRestore( + public static void createANewSingleNodeBurstable1VCoreCluster( com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { manager .clusters() - .define("testcluster") + .define("testcluster-burstablev1") .withRegion("westus") .withExistingResourceGroup("TestGroup") - .withSourceResourceId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster") - .withSourceLocation("westus") - .withPointInTimeUtc(OffsetDateTime.parse("2017-12-14T00:00:37.467Z")) + .withTags(mapOf("owner", "JohnDoe")) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.3") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(true) + .withEnableHa(false) + .withCoordinatorServerEdition("BurstableMemoryOptimized") + .withCoordinatorStorageQuotaInMb(131072) + .withCoordinatorVCores(1) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeCount(0) .create(); } /* - * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreate.json + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateBurstablev2.json */ /** - * Sample code: Create a new cluster. + * Sample code: Create a new single node Burstable 2 vCores cluster. * * @param manager Entry point to CosmosDBForPostgreSqlManager. */ - public static void createANewCluster( + public static void createANewSingleNodeBurstable2VCoresCluster( com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { manager .clusters() - .define("testcluster") + .define("testcluster-burstablev2") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withTags(mapOf("owner", "JohnDoe")) + .withAdministratorLoginPassword("password") + .withPostgresqlVersion("15") + .withCitusVersion("11.3") + .withPreferredPrimaryZone("1") + .withEnableShardsOnCoordinator(true) + .withEnableHa(false) + .withCoordinatorServerEdition("BurstableGeneralPurpose") + .withCoordinatorStorageQuotaInMb(131072) + .withCoordinatorVCores(2) + .withCoordinatorEnablePublicIpAccess(true) + .withNodeCount(0) + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateMultiNode.json + */ + /** + * Sample code: Create a new multi-node cluster. + * + * @param manager Entry point to CosmosDBForPostgreSqlManager. + */ + public static void createANewMultiNodeCluster( + com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { + manager + .clusters() + .define("testcluster-multinode") .withRegion("westus") .withExistingResourceGroup("TestGroup") .withTags(mapOf()) @@ -87,6 +134,49 @@ public static void createANewCluster( .create(); } + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreateReadReplica.json + */ + /** + * Sample code: Create a new cluster as a read replica. + * + * @param manager Entry point to CosmosDBForPostgreSqlManager. + */ + public static void createANewClusterAsAReadReplica( + com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { + manager + .clusters() + .define("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/sourcecluster") + .withSourceLocation("westus") + .create(); + } + + /* + * x-ms-original-file: specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/stable/2022-11-08/examples/ClusterCreatePITR.json + */ + /** + * Sample code: Create a new cluster as a point in time restore. + * + * @param manager Entry point to CosmosDBForPostgreSqlManager. + */ + public static void createANewClusterAsAPointInTimeRestore( + com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager manager) { + manager + .clusters() + .define("testcluster") + .withRegion("westus") + .withExistingResourceGroup("TestGroup") + .withSourceResourceId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/source-cluster") + .withSourceLocation("westus") + .withPointInTimeUtc(OffsetDateTime.parse("2017-12-14T00:00:37.467Z")) + .create(); + } + @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterConfigurationListResultTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterConfigurationListResultTests.java deleted file mode 100644 index f2ee19f9bb74..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterConfigurationListResultTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.ConfigurationInner; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ClusterConfigurationListResult; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ClusterConfigurationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ClusterConfigurationListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"description\":\"tnwu\",\"dataType\":\"Numeric\",\"allowedValues\":\"zxufiz\",\"requiresRestart\":false,\"serverRoleGroupConfigurations\":[],\"provisioningState\":\"Canceled\"},\"id\":\"hr\",\"name\":\"idf\",\"type\":\"zwdzuh\"}],\"nextLink\":\"mwisdkfthwxmnt\"}") - .toObject(ClusterConfigurationListResult.class); - Assertions.assertEquals(false, model.value().get(0).requiresRestart()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ClusterConfigurationListResult model = - new ClusterConfigurationListResult() - .withValue( - Arrays - .asList( - new ConfigurationInner() - .withRequiresRestart(false) - .withServerRoleGroupConfigurations(Arrays.asList()))); - model = BinaryData.fromObject(model).toObject(ClusterConfigurationListResult.class); - Assertions.assertEquals(false, model.value().get(0).requiresRestart()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterServerInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterServerInnerTests.java deleted file mode 100644 index b0d4e7d2bea3..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterServerInnerTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.ClusterServerInner; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRole; -import org.junit.jupiter.api.Assertions; - -public final class ClusterServerInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ClusterServerInner model = - BinaryData - .fromString( - "{\"properties\":{\"fullyQualifiedDomainName\":\"atscmd\",\"role\":\"Worker\",\"state\":\"u\",\"haState\":\"uuvmkjozkrwfnd\",\"availabilityZone\":\"djpslw\",\"postgresqlVersion\":\"dpvwryoqpsoaccta\",\"citusVersion\":\"kljla\",\"serverEdition\":\"cr\",\"storageQuotaInMb\":1060950423,\"vCores\":1389039399,\"enableHa\":false,\"enablePublicIpAccess\":true,\"isReadOnly\":false,\"administratorLogin\":\"paojakhmsbzjh\"},\"id\":\"zevdphlx\",\"name\":\"olthqtrgqjbp\",\"type\":\"zfsinzgvf\"}") - .toObject(ClusterServerInner.class); - Assertions.assertEquals(ServerRole.WORKER, model.role()); - Assertions.assertEquals("djpslw", model.availabilityZone()); - Assertions.assertEquals("dpvwryoqpsoaccta", model.postgresqlVersion()); - Assertions.assertEquals("kljla", model.citusVersion()); - Assertions.assertEquals("cr", model.serverEdition()); - Assertions.assertEquals(1060950423, model.storageQuotaInMb()); - Assertions.assertEquals(1389039399, model.vCores()); - Assertions.assertEquals(false, model.enableHa()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ClusterServerInner model = - new ClusterServerInner() - .withRole(ServerRole.WORKER) - .withAvailabilityZone("djpslw") - .withPostgresqlVersion("dpvwryoqpsoaccta") - .withCitusVersion("kljla") - .withServerEdition("cr") - .withStorageQuotaInMb(1060950423) - .withVCores(1389039399) - .withEnableHa(false); - model = BinaryData.fromObject(model).toObject(ClusterServerInner.class); - Assertions.assertEquals(ServerRole.WORKER, model.role()); - Assertions.assertEquals("djpslw", model.availabilityZone()); - Assertions.assertEquals("dpvwryoqpsoaccta", model.postgresqlVersion()); - Assertions.assertEquals("kljla", model.citusVersion()); - Assertions.assertEquals("cr", model.serverEdition()); - Assertions.assertEquals(1060950423, model.storageQuotaInMb()); - Assertions.assertEquals(1389039399, model.vCores()); - Assertions.assertEquals(false, model.enableHa()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterServerListResultTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterServerListResultTests.java deleted file mode 100644 index 0d44345015e1..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterServerListResultTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.ClusterServerInner; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ClusterServerListResult; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRole; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ClusterServerListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ClusterServerListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"fullyQualifiedDomainName\":\"mt\",\"role\":\"Worker\",\"state\":\"ryrtihfxtijbpzv\",\"haState\":\"wzsymglzufcy\",\"availabilityZone\":\"ohdbihanufh\",\"postgresqlVersion\":\"bj\",\"citusVersion\":\"a\",\"serverEdition\":\"th\",\"storageQuotaInMb\":731883185,\"vCores\":676674728,\"enableHa\":true,\"enablePublicIpAccess\":false,\"isReadOnly\":true,\"administratorLogin\":\"czbysc\"},\"id\":\"q\",\"name\":\"uhivyqniw\",\"type\":\"ybrk\"},{\"properties\":{\"fullyQualifiedDomainName\":\"umjgrtfwvuk\",\"role\":\"Worker\",\"state\":\"dcc\",\"haState\":\"h\",\"availabilityZone\":\"cnyejhkryhtnapcz\",\"postgresqlVersion\":\"okjye\",\"citusVersion\":\"kvnipjoxz\",\"serverEdition\":\"chgejspodm\",\"storageQuotaInMb\":1543997460,\"vCores\":1345546955,\"enableHa\":false,\"enablePublicIpAccess\":false,\"isReadOnly\":true,\"administratorLogin\":\"ahuxinpm\"},\"id\":\"jaqwixjsp\",\"name\":\"ozvcput\",\"type\":\"gjvw\"}]}") - .toObject(ClusterServerListResult.class); - Assertions.assertEquals(ServerRole.WORKER, model.value().get(0).role()); - Assertions.assertEquals("ohdbihanufh", model.value().get(0).availabilityZone()); - Assertions.assertEquals("bj", model.value().get(0).postgresqlVersion()); - Assertions.assertEquals("a", model.value().get(0).citusVersion()); - Assertions.assertEquals("th", model.value().get(0).serverEdition()); - Assertions.assertEquals(731883185, model.value().get(0).storageQuotaInMb()); - Assertions.assertEquals(676674728, model.value().get(0).vCores()); - Assertions.assertEquals(true, model.value().get(0).enableHa()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ClusterServerListResult model = - new ClusterServerListResult() - .withValue( - Arrays - .asList( - new ClusterServerInner() - .withRole(ServerRole.WORKER) - .withAvailabilityZone("ohdbihanufh") - .withPostgresqlVersion("bj") - .withCitusVersion("a") - .withServerEdition("th") - .withStorageQuotaInMb(731883185) - .withVCores(676674728) - .withEnableHa(true), - new ClusterServerInner() - .withRole(ServerRole.WORKER) - .withAvailabilityZone("cnyejhkryhtnapcz") - .withPostgresqlVersion("okjye") - .withCitusVersion("kvnipjoxz") - .withServerEdition("chgejspodm") - .withStorageQuotaInMb(1543997460) - .withVCores(1345546955) - .withEnableHa(false))); - model = BinaryData.fromObject(model).toObject(ClusterServerListResult.class); - Assertions.assertEquals(ServerRole.WORKER, model.value().get(0).role()); - Assertions.assertEquals("ohdbihanufh", model.value().get(0).availabilityZone()); - Assertions.assertEquals("bj", model.value().get(0).postgresqlVersion()); - Assertions.assertEquals("a", model.value().get(0).citusVersion()); - Assertions.assertEquals("th", model.value().get(0).serverEdition()); - Assertions.assertEquals(731883185, model.value().get(0).storageQuotaInMb()); - Assertions.assertEquals(676674728, model.value().get(0).vCores()); - Assertions.assertEquals(true, model.value().get(0).enableHa()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterServerPropertiesTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterServerPropertiesTests.java deleted file mode 100644 index b8065e9f2e33..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClusterServerPropertiesTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.ClusterServerProperties; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRole; -import org.junit.jupiter.api.Assertions; - -public final class ClusterServerPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ClusterServerProperties model = - BinaryData - .fromString( - "{\"fullyQualifiedDomainName\":\"rwzoxxjtfelluwf\",\"role\":\"Coordinator\",\"state\":\"np\",\"haState\":\"fpjkjlxofp\",\"availabilityZone\":\"hpf\",\"postgresqlVersion\":\"ypininm\",\"citusVersion\":\"huyb\",\"serverEdition\":\"podepoo\",\"storageQuotaInMb\":895630833,\"vCores\":1290742637,\"enableHa\":false,\"enablePublicIpAccess\":true,\"isReadOnly\":true,\"administratorLogin\":\"narxzxtheotus\"}") - .toObject(ClusterServerProperties.class); - Assertions.assertEquals("podepoo", model.serverEdition()); - Assertions.assertEquals(895630833, model.storageQuotaInMb()); - Assertions.assertEquals(1290742637, model.vCores()); - Assertions.assertEquals(false, model.enableHa()); - Assertions.assertEquals(ServerRole.COORDINATOR, model.role()); - Assertions.assertEquals("hpf", model.availabilityZone()); - Assertions.assertEquals("ypininm", model.postgresqlVersion()); - Assertions.assertEquals("huyb", model.citusVersion()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ClusterServerProperties model = - new ClusterServerProperties() - .withServerEdition("podepoo") - .withStorageQuotaInMb(895630833) - .withVCores(1290742637) - .withEnableHa(false) - .withRole(ServerRole.COORDINATOR) - .withAvailabilityZone("hpf") - .withPostgresqlVersion("ypininm") - .withCitusVersion("huyb"); - model = BinaryData.fromObject(model).toObject(ClusterServerProperties.class); - Assertions.assertEquals("podepoo", model.serverEdition()); - Assertions.assertEquals(895630833, model.storageQuotaInMb()); - Assertions.assertEquals(1290742637, model.vCores()); - Assertions.assertEquals(false, model.enableHa()); - Assertions.assertEquals(ServerRole.COORDINATOR, model.role()); - Assertions.assertEquals("hpf", model.availabilityZone()); - Assertions.assertEquals("ypininm", model.postgresqlVersion()); - Assertions.assertEquals("huyb", model.citusVersion()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCheckNameAvailabilityWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCheckNameAvailabilityWithResponseMockTests.java deleted file mode 100644 index 83102b9782b0..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersCheckNameAvailabilityWithResponseMockTests.java +++ /dev/null @@ -1,75 +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.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.NameAvailability; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.NameAvailabilityRequest; -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 ClustersCheckNameAvailabilityWithResponseMockTests { - @Test - public void testCheckNameAvailabilityWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"message\":\"bxzpuzycisp\",\"nameAvailable\":true,\"name\":\"hmgkbrpyy\",\"type\":\"ibnuqqkpik\"}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - NameAvailability response = - manager - .clusters() - .checkNameAvailabilityWithResponse( - new NameAvailabilityRequest().withName("flz"), com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("bxzpuzycisp", response.message()); - Assertions.assertEquals(true, response.nameAvailable()); - Assertions.assertEquals("hmgkbrpyy", response.name()); - Assertions.assertEquals("ibnuqqkpik", response.type()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersDeleteMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersDeleteMockTests.java deleted file mode 100644 index 3ccc9c216e90..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersDeleteMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -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 ClustersDeleteMockTests { - @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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.clusters().delete("uujqgidokgjljyo", "gvcl", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStartMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStartMockTests.java deleted file mode 100644 index b0a197c7de24..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStartMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -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 ClustersStartMockTests { - @Test - public void testStart() 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.clusters().start("bgsncghkjeszzhb", "jhtxfvgxbfsmxne", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStopMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStopMockTests.java deleted file mode 100644 index 4bfe1e36ed9c..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ClustersStopMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -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 ClustersStopMockTests { - @Test - public void testStop() 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.clusters().stop("mpvecxgodebfqk", "rbmpukgri", com.azure.core.util.Context.NONE); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationInnerTests.java deleted file mode 100644 index c109b211766c..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationInnerTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.ConfigurationInner; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRole; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRoleGroupConfiguration; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ConfigurationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ConfigurationInner model = - BinaryData - .fromString( - "{\"properties\":{\"description\":\"aop\",\"dataType\":\"Enumeration\",\"allowedValues\":\"jcmmxdcufufsrp\",\"requiresRestart\":true,\"serverRoleGroupConfigurations\":[{\"role\":\"Worker\",\"value\":\"nsez\",\"defaultValue\":\"tbzsgfyccs\",\"source\":\"wmdwzjeiachboo\"},{\"role\":\"Worker\",\"value\":\"lnrosfqp\",\"defaultValue\":\"ehzzvypyqrim\",\"source\":\"npvswjdkirso\"},{\"role\":\"Worker\",\"value\":\"qxhcrmn\",\"defaultValue\":\"jtckwhdso\",\"source\":\"iy\"}],\"provisioningState\":\"InProgress\"},\"id\":\"sqwpgrjb\",\"name\":\"norcjxvsnbyxqab\",\"type\":\"mocpc\"}") - .toObject(ConfigurationInner.class); - Assertions.assertEquals(true, model.requiresRestart()); - Assertions.assertEquals(ServerRole.WORKER, model.serverRoleGroupConfigurations().get(0).role()); - Assertions.assertEquals("nsez", model.serverRoleGroupConfigurations().get(0).value()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ConfigurationInner model = - new ConfigurationInner() - .withRequiresRestart(true) - .withServerRoleGroupConfigurations( - Arrays - .asList( - new ServerRoleGroupConfiguration().withRole(ServerRole.WORKER).withValue("nsez"), - new ServerRoleGroupConfiguration().withRole(ServerRole.WORKER).withValue("lnrosfqp"), - new ServerRoleGroupConfiguration().withRole(ServerRole.WORKER).withValue("qxhcrmn"))); - model = BinaryData.fromObject(model).toObject(ConfigurationInner.class); - Assertions.assertEquals(true, model.requiresRestart()); - Assertions.assertEquals(ServerRole.WORKER, model.serverRoleGroupConfigurations().get(0).role()); - Assertions.assertEquals("nsez", model.serverRoleGroupConfigurations().get(0).value()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationPropertiesTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationPropertiesTests.java deleted file mode 100644 index b511385a229a..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationPropertiesTests.java +++ /dev/null @@ -1,47 +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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.ConfigurationProperties; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRole; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRoleGroupConfiguration; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ConfigurationPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ConfigurationProperties model = - BinaryData - .fromString( - "{\"description\":\"hurzafblj\",\"dataType\":\"Integer\",\"allowedValues\":\"toqcjmklja\",\"requiresRestart\":true,\"serverRoleGroupConfigurations\":[{\"role\":\"Worker\",\"value\":\"tqajzyulpkudjkrl\",\"defaultValue\":\"bzhfepgzgqexz\",\"source\":\"c\"},{\"role\":\"Coordinator\",\"value\":\"c\",\"defaultValue\":\"ierhhbcsglummaj\",\"source\":\"aodxo\"},{\"role\":\"Coordinator\",\"value\":\"bdxkqpxokaj\",\"defaultValue\":\"npime\",\"source\":\"stxgc\"}],\"provisioningState\":\"Succeeded\"}") - .toObject(ConfigurationProperties.class); - Assertions.assertEquals(true, model.requiresRestart()); - Assertions.assertEquals(ServerRole.WORKER, model.serverRoleGroupConfigurations().get(0).role()); - Assertions.assertEquals("tqajzyulpkudjkrl", model.serverRoleGroupConfigurations().get(0).value()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ConfigurationProperties model = - new ConfigurationProperties() - .withRequiresRestart(true) - .withServerRoleGroupConfigurations( - Arrays - .asList( - new ServerRoleGroupConfiguration() - .withRole(ServerRole.WORKER) - .withValue("tqajzyulpkudjkrl"), - new ServerRoleGroupConfiguration().withRole(ServerRole.COORDINATOR).withValue("c"), - new ServerRoleGroupConfiguration() - .withRole(ServerRole.COORDINATOR) - .withValue("bdxkqpxokaj"))); - model = BinaryData.fromObject(model).toObject(ConfigurationProperties.class); - Assertions.assertEquals(true, model.requiresRestart()); - Assertions.assertEquals(ServerRole.WORKER, model.serverRoleGroupConfigurations().get(0).role()); - Assertions.assertEquals("tqajzyulpkudjkrl", model.serverRoleGroupConfigurations().get(0).value()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetCoordinatorWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetCoordinatorWithResponseMockTests.java deleted file mode 100644 index 5d93eda2f75c..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetCoordinatorWithResponseMockTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerConfiguration; -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 ConfigurationsGetCoordinatorWithResponseMockTests { - @Test - public void testGetCoordinatorWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"value\":\"rqhakauha\",\"source\":\"sfwxosowzxc\",\"description\":\"i\",\"defaultValue\":\"ooxdjebwpuc\",\"dataType\":\"Enumeration\",\"allowedValues\":\"ovbvmeueciv\",\"requiresRestart\":true,\"provisioningState\":\"InProgress\"},\"id\":\"ojgjrwjueiotwmc\",\"name\":\"ytdxwit\",\"type\":\"nrjawgqwg\"}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ServerConfiguration response = - manager - .configurations() - .getCoordinatorWithResponse("b", "e", "dawkzbali", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("rqhakauha", response.value()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetNodeWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetNodeWithResponseMockTests.java deleted file mode 100644 index 419ae33f5098..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetNodeWithResponseMockTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerConfiguration; -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 ConfigurationsGetNodeWithResponseMockTests { - @Test - public void testGetNodeWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"value\":\"hpvgqz\",\"source\":\"rvxdjzlmw\",\"description\":\"kvugfhzovawjvzun\",\"defaultValue\":\"thnnpr\",\"dataType\":\"Boolean\",\"allowedValues\":\"eilpjzuaejxdu\",\"requiresRestart\":false,\"provisioningState\":\"InProgress\"},\"id\":\"btdzumveekg\",\"name\":\"wozuhkf\",\"type\":\"bsjyofdx\"}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ServerConfiguration response = - manager - .configurations() - .getNodeWithResponse("ibycno", "v", "nmefqsgzvahapj", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("hpvgqz", response.value()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetWithResponseMockTests.java deleted file mode 100644 index d3f79ae9842b..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsGetWithResponseMockTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.Configuration; -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 ConfigurationsGetWithResponseMockTests { - @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\":{\"description\":\"c\",\"dataType\":\"Boolean\",\"allowedValues\":\"ualaexqpvfadmw\",\"requiresRestart\":true,\"serverRoleGroupConfigurations\":[],\"provisioningState\":\"Canceled\"},\"id\":\"pv\",\"name\":\"omzlfmi\",\"type\":\"gwb\"}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Configuration response = - manager - .configurations() - .getWithResponse("tslhspkdeem", "ofmxagkvtmelmqkr", "ahvljuaha", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(true, response.requiresRestart()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByClusterMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByClusterMockTests.java deleted file mode 100644 index 9c85bba3a21f..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByClusterMockTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.Configuration; -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 ConfigurationsListByClusterMockTests { - @Test - public void testListByCluster() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"description\":\"bh\",\"dataType\":\"Boolean\",\"allowedValues\":\"lhrxsbkyvpyc\",\"requiresRestart\":true,\"serverRoleGroupConfigurations\":[],\"provisioningState\":\"Succeeded\"},\"id\":\"kafkuwbcrnwbm\",\"name\":\"hhseyv\",\"type\":\"us\"}]}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.configurations().listByCluster("udxytlmoyrx", "wfudwpzntxhdzhl", com.azure.core.util.Context.NONE); - - Assertions.assertEquals(true, response.iterator().next().requiresRestart()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByServerMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByServerMockTests.java deleted file mode 100644 index c7e52e169a6e..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsListByServerMockTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerConfiguration; -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 ConfigurationsListByServerMockTests { - @Test - public void testListByServer() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"value\":\"notyfjfcnjbkcn\",\"source\":\"hbttkphyw\",\"description\":\"vjtoqnermclfp\",\"defaultValue\":\"hoxus\",\"dataType\":\"Numeric\",\"allowedValues\":\"bgyepsbj\",\"requiresRestart\":false,\"provisioningState\":\"InProgress\"},\"id\":\"xywpmueefjzwfqkq\",\"name\":\"jidsuyonobglaoc\",\"type\":\"xtccmg\"}]}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.configurations().listByServer("wrupqsxvnmicykvc", "o", "eil", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("notyfjfcnjbkcn", response.iterator().next().value()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnCoordinatorMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnCoordinatorMockTests.java deleted file mode 100644 index 111a075548d0..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnCoordinatorMockTests.java +++ /dev/null @@ -1,75 +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.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.ServerConfigurationInner; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerConfiguration; -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 ConfigurationsUpdateOnCoordinatorMockTests { - @Test - public void testUpdateOnCoordinator() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"value\":\"loayqcgw\",\"source\":\"zjuzgwyz\",\"description\":\"txon\",\"defaultValue\":\"ts\",\"dataType\":\"Enumeration\",\"allowedValues\":\"bp\",\"requiresRestart\":true,\"provisioningState\":\"Succeeded\"},\"id\":\"knftguvriuh\",\"name\":\"rwmdyvxqtay\",\"type\":\"iwwroyqbexrmc\"}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ServerConfiguration response = - manager - .configurations() - .updateOnCoordinator( - "hniskxfbkpyc", - "klwndnhjdauwhv", - "l", - new ServerConfigurationInner().withValue("btdhxujznbm"), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("loayqcgw", response.value()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnNodeMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnNodeMockTests.java deleted file mode 100644 index 215852209600..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ConfigurationsUpdateOnNodeMockTests.java +++ /dev/null @@ -1,75 +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.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.ServerConfigurationInner; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerConfiguration; -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 ConfigurationsUpdateOnNodeMockTests { - @Test - public void testUpdateOnNode() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"value\":\"qwwncw\",\"source\":\"hxg\",\"description\":\"rmgucnap\",\"defaultValue\":\"eoellwptfdygp\",\"dataType\":\"Boolean\",\"allowedValues\":\"ac\",\"requiresRestart\":true,\"provisioningState\":\"Succeeded\"},\"id\":\"rhhuaopppcqeqx\",\"name\":\"lzdahzxctobgbkdm\",\"type\":\"izpost\"}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ServerConfiguration response = - manager - .configurations() - .updateOnNode( - "uusdttouwa", - "oekqvk", - "lns", - new ServerConfigurationInner().withValue("bxwyjsflhhcaa"), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("qwwncw", response.value()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleInnerTests.java deleted file mode 100644 index 0262339ca3e9..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleInnerTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.FirewallRuleInner; -import org.junit.jupiter.api.Assertions; - -public final class FirewallRuleInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FirewallRuleInner model = - BinaryData - .fromString( - "{\"properties\":{\"startIpAddress\":\"sycbkbfk\",\"endIpAddress\":\"ukdkexxppofmxa\",\"provisioningState\":\"Failed\"},\"id\":\"pg\",\"name\":\"dtocj\",\"type\":\"xhvpmoue\"}") - .toObject(FirewallRuleInner.class); - Assertions.assertEquals("sycbkbfk", model.startIpAddress()); - Assertions.assertEquals("ukdkexxppofmxa", model.endIpAddress()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FirewallRuleInner model = - new FirewallRuleInner().withStartIpAddress("sycbkbfk").withEndIpAddress("ukdkexxppofmxa"); - model = BinaryData.fromObject(model).toObject(FirewallRuleInner.class); - Assertions.assertEquals("sycbkbfk", model.startIpAddress()); - Assertions.assertEquals("ukdkexxppofmxa", model.endIpAddress()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleListResultTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleListResultTests.java deleted file mode 100644 index 933a5fe1d842..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRuleListResultTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.FirewallRuleInner; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.FirewallRuleListResult; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class FirewallRuleListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FirewallRuleListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"startIpAddress\":\"dntwndeicbtw\",\"endIpAddress\":\"pzaoqvuhr\",\"provisioningState\":\"Succeeded\"},\"id\":\"cyddglmjthjqk\",\"name\":\"pyeicxm\",\"type\":\"ciwqvhk\"},{\"properties\":{\"startIpAddress\":\"ixuigdtopbobj\",\"endIpAddress\":\"ghmewuam\",\"provisioningState\":\"Failed\"},\"id\":\"z\",\"name\":\"yvvtpgvdfgio\",\"type\":\"kftutqxlngxlefg\"},{\"properties\":{\"startIpAddress\":\"gnxkrxdqmidtth\",\"endIpAddress\":\"rvqdra\",\"provisioningState\":\"Canceled\"},\"id\":\"big\",\"name\":\"h\",\"type\":\"qfbow\"}]}") - .toObject(FirewallRuleListResult.class); - Assertions.assertEquals("dntwndeicbtw", model.value().get(0).startIpAddress()); - Assertions.assertEquals("pzaoqvuhr", model.value().get(0).endIpAddress()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FirewallRuleListResult model = - new FirewallRuleListResult() - .withValue( - Arrays - .asList( - new FirewallRuleInner().withStartIpAddress("dntwndeicbtw").withEndIpAddress("pzaoqvuhr"), - new FirewallRuleInner().withStartIpAddress("ixuigdtopbobj").withEndIpAddress("ghmewuam"), - new FirewallRuleInner().withStartIpAddress("gnxkrxdqmidtth").withEndIpAddress("rvqdra"))); - model = BinaryData.fromObject(model).toObject(FirewallRuleListResult.class); - Assertions.assertEquals("dntwndeicbtw", model.value().get(0).startIpAddress()); - Assertions.assertEquals("pzaoqvuhr", model.value().get(0).endIpAddress()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulePropertiesTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulePropertiesTests.java deleted file mode 100644 index 2f87e696ab71..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulePropertiesTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.FirewallRuleProperties; -import org.junit.jupiter.api.Assertions; - -public final class FirewallRulePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FirewallRuleProperties model = - BinaryData - .fromString( - "{\"startIpAddress\":\"hd\",\"endIpAddress\":\"xibqeojnx\",\"provisioningState\":\"Failed\"}") - .toObject(FirewallRuleProperties.class); - Assertions.assertEquals("hd", model.startIpAddress()); - Assertions.assertEquals("xibqeojnx", model.endIpAddress()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FirewallRuleProperties model = - new FirewallRuleProperties().withStartIpAddress("hd").withEndIpAddress("xibqeojnx"); - model = BinaryData.fromObject(model).toObject(FirewallRuleProperties.class); - Assertions.assertEquals("hd", model.startIpAddress()); - Assertions.assertEquals("xibqeojnx", model.endIpAddress()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesCreateOrUpdateMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesCreateOrUpdateMockTests.java deleted file mode 100644 index bdafb04b5dc9..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesCreateOrUpdateMockTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.FirewallRule; -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 FirewallRulesCreateOrUpdateMockTests { - @Test - public void testCreateOrUpdate() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"startIpAddress\":\"ujmkcjhwqy\",\"endIpAddress\":\"jrybnwjewgdrjer\",\"provisioningState\":\"Succeeded\"},\"id\":\"nqpeh\",\"name\":\"ndoygmifthnzdnd\",\"type\":\"l\"}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - FirewallRule response = - manager - .firewallRules() - .define("gjb") - .withExistingServerGroupsv2("bfovasrruvwbhsq", "sub") - .withStartIpAddress("rxbpyb") - .withEndIpAddress("rfbjf") - .create(); - - Assertions.assertEquals("ujmkcjhwqy", response.startIpAddress()); - Assertions.assertEquals("jrybnwjewgdrjer", response.endIpAddress()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesGetWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesGetWithResponseMockTests.java deleted file mode 100644 index 4d11ed835a89..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesGetWithResponseMockTests.java +++ /dev/null @@ -1,71 +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.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.FirewallRule; -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 FirewallRulesGetWithResponseMockTests { - @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\":{\"startIpAddress\":\"j\",\"endIpAddress\":\"n\",\"provisioningState\":\"Canceled\"},\"id\":\"vkr\",\"name\":\"swbxqz\",\"type\":\"szjfauvjfdxxivet\"}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - FirewallRule response = - manager - .firewallRules() - .getWithResponse("grcfb", "nrmfqjhhk", "bpvjymjhx", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("j", response.startIpAddress()); - Assertions.assertEquals("n", response.endIpAddress()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesListByClusterMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesListByClusterMockTests.java deleted file mode 100644 index e7a61831fed9..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/FirewallRulesListByClusterMockTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.FirewallRule; -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 FirewallRulesListByClusterMockTests { - @Test - public void testListByCluster() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"startIpAddress\":\"lqbhsf\",\"endIpAddress\":\"obl\",\"provisioningState\":\"Succeeded\"},\"id\":\"lmpewwwfbkr\",\"name\":\"rn\",\"type\":\"vshqjohxcr\"}]}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.firewallRules().listByCluster("t", "qaqtdoqmcbxvwvxy", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("lqbhsf", response.iterator().next().startIpAddress()); - Assertions.assertEquals("obl", response.iterator().next().endIpAddress()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/MaintenanceWindowTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/MaintenanceWindowTests.java deleted file mode 100644 index 1c0a24d2d7cf..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/MaintenanceWindowTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.MaintenanceWindow; -import org.junit.jupiter.api.Assertions; - -public final class MaintenanceWindowTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MaintenanceWindow model = - BinaryData - .fromString( - "{\"customWindow\":\"dxbmtqioq\",\"startHour\":1116722151,\"startMinute\":1801213143,\"dayOfWeek\":538577990}") - .toObject(MaintenanceWindow.class); - Assertions.assertEquals("dxbmtqioq", model.customWindow()); - Assertions.assertEquals(1116722151, model.startHour()); - Assertions.assertEquals(1801213143, model.startMinute()); - Assertions.assertEquals(538577990, model.dayOfWeek()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MaintenanceWindow model = - new MaintenanceWindow() - .withCustomWindow("dxbmtqioq") - .withStartHour(1116722151) - .withStartMinute(1801213143) - .withDayOfWeek(538577990); - model = BinaryData.fromObject(model).toObject(MaintenanceWindow.class); - Assertions.assertEquals("dxbmtqioq", model.customWindow()); - Assertions.assertEquals(1116722151, model.startHour()); - Assertions.assertEquals(1801213143, model.startMinute()); - Assertions.assertEquals(538577990, model.dayOfWeek()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityInnerTests.java deleted file mode 100644 index d6e9791a1eba..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityInnerTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.NameAvailabilityInner; -import org.junit.jupiter.api.Assertions; - -public final class NameAvailabilityInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NameAvailabilityInner model = - BinaryData - .fromString( - "{\"message\":\"oo\",\"nameAvailable\":true,\"name\":\"zevgb\",\"type\":\"jqabcypmivkwlzuv\"}") - .toObject(NameAvailabilityInner.class); - Assertions.assertEquals("oo", model.message()); - Assertions.assertEquals(true, model.nameAvailable()); - Assertions.assertEquals("zevgb", model.name()); - Assertions.assertEquals("jqabcypmivkwlzuv", model.type()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NameAvailabilityInner model = - new NameAvailabilityInner() - .withMessage("oo") - .withNameAvailable(true) - .withName("zevgb") - .withType("jqabcypmivkwlzuv"); - model = BinaryData.fromObject(model).toObject(NameAvailabilityInner.class); - Assertions.assertEquals("oo", model.message()); - Assertions.assertEquals(true, model.nameAvailable()); - Assertions.assertEquals("zevgb", model.name()); - Assertions.assertEquals("jqabcypmivkwlzuv", model.type()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityRequestTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityRequestTests.java deleted file mode 100644 index 12d6aa12e648..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/NameAvailabilityRequestTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.NameAvailabilityRequest; -import org.junit.jupiter.api.Assertions; - -public final class NameAvailabilityRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NameAvailabilityRequest model = - BinaryData.fromString("{\"name\":\"fvm\"}").toObject(NameAvailabilityRequest.class); - Assertions.assertEquals("fvm", model.name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NameAvailabilityRequest model = new NameAvailabilityRequest().withName("fvm"); - model = BinaryData.fromObject(model).toObject(NameAvailabilityRequest.class); - Assertions.assertEquals("fvm", model.name()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationDisplayTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationDisplayTests.java deleted file mode 100644 index 9ab5d709595c..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationDisplayTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.OperationDisplay; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = - BinaryData - .fromString( - "{\"provider\":\"hvmdajvnysounq\",\"resource\":\"a\",\"operation\":\"ae\",\"description\":\"fhyhltrpmopjmcma\"}") - .toObject(OperationDisplay.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = new OperationDisplay(); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationInnerTests.java deleted file mode 100644 index 951ddb4b4b46..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationInnerTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.OperationInner; -import org.junit.jupiter.api.Assertions; - -public final class OperationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationInner model = - BinaryData - .fromString( - "{\"name\":\"ixhbkuofqweykhm\",\"display\":{\"provider\":\"vfyexfw\",\"resource\":\"bcibvyvdcsitynn\",\"operation\":\"mdectehfiqscjey\",\"description\":\"hezrkgq\"},\"isDataAction\":true,\"origin\":\"user\",\"properties\":{\"cattpngjcrcczsq\":\"datavgmkqsleyyvxyqjp\"}}") - .toObject(OperationInner.class); - Assertions.assertEquals(true, model.isDataAction()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationInner model = new OperationInner().withIsDataAction(true); - model = BinaryData.fromObject(model).toObject(OperationInner.class); - Assertions.assertEquals(true, model.isDataAction()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationListResultTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationListResultTests.java deleted file mode 100644 index 68fa6b368aab..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationListResultTests.java +++ /dev/null @@ -1,35 +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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.OperationInner; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.OperationListResult; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class OperationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationListResult model = - BinaryData - .fromString( - "{\"value\":[{\"name\":\"nfnbacfionlebxe\",\"display\":{\"provider\":\"tzxdpnqbqqwx\",\"resource\":\"feallnwsu\",\"operation\":\"snjampmng\",\"description\":\"scxaq\"},\"isDataAction\":true,\"origin\":\"NotSpecified\",\"properties\":{\"pkvlrxn\":\"dataonq\",\"eipheoflokeyy\":\"dataea\",\"jp\":\"dataenjbdlwtgrhp\",\"e\":\"dataumasxazjpq\"}},{\"name\":\"alhbx\",\"display\":{\"provider\":\"jj\",\"resource\":\"v\",\"operation\":\"dgwdslfhot\",\"description\":\"cynpwlbjnp\"},\"isDataAction\":false,\"origin\":\"user\",\"properties\":{\"usue\":\"dataehxnltyfsop\",\"orxzdmohctbqvud\":\"datanzwdejba\",\"nvowgujju\":\"dataxdn\",\"zj\":\"datawdkcglhsl\"}}],\"nextLink\":\"ggd\"}") - .toObject(OperationListResult.class); - Assertions.assertEquals(true, model.value().get(0).isDataAction()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResult model = - new OperationListResult() - .withValue( - Arrays - .asList( - new OperationInner().withIsDataAction(true), new OperationInner().withIsDataAction(false))); - model = BinaryData.fromObject(model).toObject(OperationListResult.class); - Assertions.assertEquals(true, model.value().get(0).isDataAction()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationsListMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationsListMockTests.java deleted file mode 100644 index b4bf49057ac6..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/OperationsListMockTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.Operation; -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public final class OperationsListMockTests { - @Test - public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"name\":\"blylpstdbh\",\"display\":{\"provider\":\"rzdzucerscdnt\",\"resource\":\"vfiwjmygtdss\",\"operation\":\"wtmwerio\",\"description\":\"pyqs\"},\"isDataAction\":false,\"origin\":\"NotSpecified\",\"properties\":{\"vwiwubmwmbesld\":\"datatshhszhedp\"}}]}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - - Assertions.assertEquals(false, response.iterator().next().isDataAction()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionInnerTests.java deleted file mode 100644 index adf976b024fd..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionInnerTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.PrivateEndpointConnectionInner; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpoint; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointServiceConnectionStatus; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateLinkServiceConnectionState; -import org.junit.jupiter.api.Assertions; - -public final class PrivateEndpointConnectionInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpointConnectionInner model = - BinaryData - .fromString( - "{\"properties\":{\"groupIds\":[\"zywqsmbsu\"],\"privateEndpoint\":{\"id\":\"imoryocfsfksym\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"tki\",\"actionsRequired\":\"xhqyudxorrqnb\"},\"provisioningState\":\"Creating\"},\"id\":\"vyifqrvkdvjsl\",\"name\":\"rm\",\"type\":\"vdfwatkpn\"}") - .toObject(PrivateEndpointConnectionInner.class); - Assertions - .assertEquals( - PrivateEndpointServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("tki", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("xhqyudxorrqnb", model.privateLinkServiceConnectionState().actionsRequired()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateEndpointConnectionInner model = - new PrivateEndpointConnectionInner() - .withPrivateEndpoint(new PrivateEndpoint()) - .withPrivateLinkServiceConnectionState( - new PrivateLinkServiceConnectionState() - .withStatus(PrivateEndpointServiceConnectionStatus.REJECTED) - .withDescription("tki") - .withActionsRequired("xhqyudxorrqnb")); - model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionInner.class); - Assertions - .assertEquals( - PrivateEndpointServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("tki", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("xhqyudxorrqnb", model.privateLinkServiceConnectionState().actionsRequired()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionListResultTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionListResultTests.java deleted file mode 100644 index e665d1fa358f..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionListResultTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.PrivateEndpointConnectionInner; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointConnectionListResult; -import java.util.Arrays; - -public final class PrivateEndpointConnectionListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpointConnectionListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Failed\"},\"id\":\"uaodsfcpk\",\"name\":\"xodpuozmyzydagfu\",\"type\":\"xbezyiuokktwh\"}]}") - .toObject(PrivateEndpointConnectionListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateEndpointConnectionListResult model = - new PrivateEndpointConnectionListResult().withValue(Arrays.asList(new PrivateEndpointConnectionInner())); - model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionListResult.class); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionPropertiesTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionPropertiesTests.java deleted file mode 100644 index a27fef2cff07..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionPropertiesTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.PrivateEndpointConnectionProperties; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpoint; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointServiceConnectionStatus; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateLinkServiceConnectionState; -import org.junit.jupiter.api.Assertions; - -public final class PrivateEndpointConnectionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpointConnectionProperties model = - BinaryData - .fromString( - "{\"groupIds\":[\"exxbczwtr\",\"wiqzbqjvsovmyo\",\"acspkwl\"],\"privateEndpoint\":{\"id\":\"obpxjmflbvvn\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"cciw\",\"actionsRequired\":\"juqk\"},\"provisioningState\":\"Succeeded\"}") - .toObject(PrivateEndpointConnectionProperties.class); - Assertions - .assertEquals( - PrivateEndpointServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("cciw", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("juqk", model.privateLinkServiceConnectionState().actionsRequired()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateEndpointConnectionProperties model = - new PrivateEndpointConnectionProperties() - .withPrivateEndpoint(new PrivateEndpoint()) - .withPrivateLinkServiceConnectionState( - new PrivateLinkServiceConnectionState() - .withStatus(PrivateEndpointServiceConnectionStatus.REJECTED) - .withDescription("cciw") - .withActionsRequired("juqk")); - model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionProperties.class); - Assertions - .assertEquals( - PrivateEndpointServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("cciw", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("juqk", model.privateLinkServiceConnectionState().actionsRequired()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionSimplePropertiesTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionSimplePropertiesTests.java deleted file mode 100644 index e873cfdea1d9..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionSimplePropertiesTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.PrivateEndpointConnectionSimpleProperties; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointProperty; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointServiceConnectionStatus; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateLinkServiceConnectionState; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class PrivateEndpointConnectionSimplePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpointConnectionSimpleProperties model = - BinaryData - .fromString( - "{\"privateEndpoint\":{\"id\":\"jpsq\"},\"groupIds\":[\"poyfdkfogkn\",\"gjofjd\"],\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"deupewnwrei\",\"actionsRequired\":\"zyf\"}}") - .toObject(PrivateEndpointConnectionSimpleProperties.class); - Assertions.assertEquals("jpsq", model.privateEndpoint().id()); - Assertions.assertEquals("poyfdkfogkn", model.groupIds().get(0)); - Assertions - .assertEquals( - PrivateEndpointServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("deupewnwrei", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("zyf", model.privateLinkServiceConnectionState().actionsRequired()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateEndpointConnectionSimpleProperties model = - new PrivateEndpointConnectionSimpleProperties() - .withPrivateEndpoint(new PrivateEndpointProperty().withId("jpsq")) - .withGroupIds(Arrays.asList("poyfdkfogkn", "gjofjd")) - .withPrivateLinkServiceConnectionState( - new PrivateLinkServiceConnectionState() - .withStatus(PrivateEndpointServiceConnectionStatus.REJECTED) - .withDescription("deupewnwrei") - .withActionsRequired("zyf")); - model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionSimpleProperties.class); - Assertions.assertEquals("jpsq", model.privateEndpoint().id()); - Assertions.assertEquals("poyfdkfogkn", model.groupIds().get(0)); - Assertions - .assertEquals( - PrivateEndpointServiceConnectionStatus.REJECTED, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("deupewnwrei", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("zyf", model.privateLinkServiceConnectionState().actionsRequired()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsCreateOrUpdateMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsCreateOrUpdateMockTests.java deleted file mode 100644 index 11bc423b357d..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsCreateOrUpdateMockTests.java +++ /dev/null @@ -1,84 +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.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpoint; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointConnection; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointServiceConnectionStatus; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateLinkServiceConnectionState; -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 PrivateEndpointConnectionsCreateOrUpdateMockTests { - @Test - public void testCreateOrUpdate() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"properties\":{\"groupIds\":[\"fv\",\"efyw\"],\"privateEndpoint\":{\"id\":\"fvmwy\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"uyfta\",\"actionsRequired\":\"cpwi\"},\"provisioningState\":\"Succeeded\"},\"id\":\"tmnubexkpzksmon\",\"name\":\"jmquxvypomgk\",\"type\":\"pkwhojvpa\"}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PrivateEndpointConnection response = - manager - .privateEndpointConnections() - .define("sag") - .withExistingServerGroupsv2("mh", "lxyjr") - .withPrivateEndpoint(new PrivateEndpoint()) - .withPrivateLinkServiceConnectionState( - new PrivateLinkServiceConnectionState() - .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) - .withDescription("xcxrsl") - .withActionsRequired("utwu")) - .create(); - - Assertions - .assertEquals( - PrivateEndpointServiceConnectionStatus.PENDING, response.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("uyfta", response.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("cpwi", response.privateLinkServiceConnectionState().actionsRequired()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java deleted file mode 100644 index a85e04439c1b..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java +++ /dev/null @@ -1,75 +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.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointConnection; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointServiceConnectionStatus; -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 PrivateEndpointConnectionsGetWithResponseMockTests { - @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\":{\"groupIds\":[\"ozfikdowwq\"],\"privateEndpoint\":{\"id\":\"xzxcl\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"hqzonosggbhcoh\",\"actionsRequired\":\"dsjnka\"},\"provisioningState\":\"Deleting\"},\"id\":\"iiswacffgdkzze\",\"name\":\"kfvhqcrailvpn\",\"type\":\"pfuflrw\"}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PrivateEndpointConnection response = - manager - .privateEndpointConnections() - .getWithResponse("zmuvpbttdumorppx", "bmnzbtbhjpgl", "fgohdneuelfphs", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions - .assertEquals( - PrivateEndpointServiceConnectionStatus.REJECTED, response.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("hqzonosggbhcoh", response.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("dsjnka", response.privateLinkServiceConnectionState().actionsRequired()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsListByClusterMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsListByClusterMockTests.java deleted file mode 100644 index 7fd5afbf9498..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointConnectionsListByClusterMockTests.java +++ /dev/null @@ -1,78 +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.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointConnection; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointServiceConnectionStatus; -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 PrivateEndpointConnectionsListByClusterMockTests { - @Test - public void testListByCluster() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"groupIds\":[\"sikvmkqzeqqkdlt\",\"zxmhhvhgu\",\"eodkwobda\",\"xtibqdxbxwakbog\"],\"privateEndpoint\":{\"id\":\"dlkzgxhuri\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"odxun\",\"actionsRequired\":\"ebxmubyynt\"},\"provisioningState\":\"Creating\"},\"id\":\"qtkoievs\",\"name\":\"otgqrlltmu\",\"type\":\"lauwzizxbmpgcjef\"}]}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager - .privateEndpointConnections() - .listByCluster("k", "wtppjflcxogaoko", com.azure.core.util.Context.NONE); - - Assertions - .assertEquals( - PrivateEndpointServiceConnectionStatus.APPROVED, - response.iterator().next().privateLinkServiceConnectionState().status()); - Assertions.assertEquals("odxun", response.iterator().next().privateLinkServiceConnectionState().description()); - Assertions - .assertEquals( - "ebxmubyynt", response.iterator().next().privateLinkServiceConnectionState().actionsRequired()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointPropertyTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointPropertyTests.java deleted file mode 100644 index a7d0971439f8..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointPropertyTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointProperty; -import org.junit.jupiter.api.Assertions; - -public final class PrivateEndpointPropertyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpointProperty model = - BinaryData.fromString("{\"id\":\"sarhmofc\"}").toObject(PrivateEndpointProperty.class); - Assertions.assertEquals("sarhmofc", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateEndpointProperty model = new PrivateEndpointProperty().withId("sarhmofc"); - model = BinaryData.fromObject(model).toObject(PrivateEndpointProperty.class); - Assertions.assertEquals("sarhmofc", model.id()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointTests.java deleted file mode 100644 index 6c5c1233ce7a..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateEndpointTests.java +++ /dev/null @@ -1,21 +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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpoint; - -public final class PrivateEndpointTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateEndpoint model = BinaryData.fromString("{\"id\":\"jiwkuofoskghsau\"}").toObject(PrivateEndpoint.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateEndpoint model = new PrivateEndpoint(); - model = BinaryData.fromObject(model).toObject(PrivateEndpoint.class); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceInnerTests.java deleted file mode 100644 index e8c17a389461..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceInnerTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.PrivateLinkResourceInner; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class PrivateLinkResourceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateLinkResourceInner model = - BinaryData - .fromString( - "{\"properties\":{\"groupId\":\"dpydn\",\"requiredMembers\":[\"xdeoejzic\",\"ifsjttgzfbishcb\"],\"requiredZoneNames\":[\"jdeyeamdpha\",\"alpbuxwgipwhon\",\"wkgshwa\",\"kix\"]},\"id\":\"injep\",\"name\":\"ttmrywnuzoqf\",\"type\":\"iyqzrnk\"}") - .toObject(PrivateLinkResourceInner.class); - Assertions.assertEquals("jdeyeamdpha", model.requiredZoneNames().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateLinkResourceInner model = - new PrivateLinkResourceInner() - .withRequiredZoneNames(Arrays.asList("jdeyeamdpha", "alpbuxwgipwhon", "wkgshwa", "kix")); - model = BinaryData.fromObject(model).toObject(PrivateLinkResourceInner.class); - Assertions.assertEquals("jdeyeamdpha", model.requiredZoneNames().get(0)); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceListResultTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceListResultTests.java deleted file mode 100644 index 20f08e775106..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourceListResultTests.java +++ /dev/null @@ -1,35 +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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.PrivateLinkResourceInner; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateLinkResourceListResult; -import java.util.Arrays; - -public final class PrivateLinkResourceListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateLinkResourceListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"groupId\":\"vxieduugidyj\",\"requiredMembers\":[],\"requiredZoneNames\":[]},\"id\":\"y\",\"name\":\"osvexcsonpclhoc\",\"type\":\"hslkevleggzf\"},{\"properties\":{\"groupId\":\"fmvfaxkffeiit\",\"requiredMembers\":[],\"requiredZoneNames\":[]},\"id\":\"ez\",\"name\":\"v\",\"type\":\"hxmzsbbzoggig\"},{\"properties\":{\"groupId\":\"burvjxxjnspy\",\"requiredMembers\":[],\"requiredZoneNames\":[]},\"id\":\"oenkouknvudwti\",\"name\":\"kbldngkpocipa\",\"type\":\"yxoegukgjnp\"},{\"properties\":{\"groupId\":\"gygev\",\"requiredMembers\":[],\"requiredZoneNames\":[]},\"id\":\"yp\",\"name\":\"rbpizc\",\"type\":\"r\"}]}") - .toObject(PrivateLinkResourceListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateLinkResourceListResult model = - new PrivateLinkResourceListResult() - .withValue( - Arrays - .asList( - new PrivateLinkResourceInner().withRequiredZoneNames(Arrays.asList()), - new PrivateLinkResourceInner().withRequiredZoneNames(Arrays.asList()), - new PrivateLinkResourceInner().withRequiredZoneNames(Arrays.asList()), - new PrivateLinkResourceInner().withRequiredZoneNames(Arrays.asList()))); - model = BinaryData.fromObject(model).toObject(PrivateLinkResourceListResult.class); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcePropertiesTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcePropertiesTests.java deleted file mode 100644 index 217267a973f7..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcePropertiesTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.PrivateLinkResourceProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class PrivateLinkResourcePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateLinkResourceProperties model = - BinaryData - .fromString( - "{\"groupId\":\"vyxlwhzlsicohoqq\",\"requiredMembers\":[\"lryav\",\"hheunmmqhgyx\",\"konocu\",\"oklyaxuconuq\"],\"requiredZoneNames\":[\"kbeype\",\"rmjmwvvjektc\"]}") - .toObject(PrivateLinkResourceProperties.class); - Assertions.assertEquals("kbeype", model.requiredZoneNames().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateLinkResourceProperties model = - new PrivateLinkResourceProperties().withRequiredZoneNames(Arrays.asList("kbeype", "rmjmwvvjektc")); - model = BinaryData.fromObject(model).toObject(PrivateLinkResourceProperties.class); - Assertions.assertEquals("kbeype", model.requiredZoneNames().get(0)); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesGetWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesGetWithResponseMockTests.java deleted file mode 100644 index 16d683b2841f..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesGetWithResponseMockTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateLinkResource; -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 PrivateLinkResourcesGetWithResponseMockTests { - @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\":{\"groupId\":\"dtkcnqxwbpokulp\",\"requiredMembers\":[\"waasip\"],\"requiredZoneNames\":[\"obyu\",\"erpqlpqwcciuqg\"]},\"id\":\"butauvfb\",\"name\":\"kuwhh\",\"type\":\"hykojoxafnndlpic\"}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PrivateLinkResource response = - manager - .privateLinkResources() - .getWithResponse("yyv", "qacpiex", "btgiwbwoenwas", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("obyu", response.requiredZoneNames().get(0)); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesListByClusterMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesListByClusterMockTests.java deleted file mode 100644 index a0180c498e19..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkResourcesListByClusterMockTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateLinkResource; -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 PrivateLinkResourcesListByClusterMockTests { - @Test - public void testListByCluster() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"groupId\":\"zapvhelx\",\"requiredMembers\":[\"lya\",\"dd\",\"kcbcue\",\"rjxgciqib\"],\"requiredZoneNames\":[\"sxsdqrhzoymibm\"]},\"id\":\"yiba\",\"name\":\"wfluszdt\",\"type\":\"hrkwo\"}]}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.privateLinkResources().listByCluster("qgxy", "mocmbqfqvmk", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("sxsdqrhzoymibm", response.iterator().next().requiredZoneNames().get(0)); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkServiceConnectionStateTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkServiceConnectionStateTests.java deleted file mode 100644 index ce419c04369b..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/PrivateLinkServiceConnectionStateTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointServiceConnectionStatus; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateLinkServiceConnectionState; -import org.junit.jupiter.api.Assertions; - -public final class PrivateLinkServiceConnectionStateTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PrivateLinkServiceConnectionState model = - BinaryData - .fromString( - "{\"status\":\"Approved\",\"description\":\"yurkdtmlxhekuksj\",\"actionsRequired\":\"ukcdmparcryuanzw\"}") - .toObject(PrivateLinkServiceConnectionState.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, model.status()); - Assertions.assertEquals("yurkdtmlxhekuksj", model.description()); - Assertions.assertEquals("ukcdmparcryuanzw", model.actionsRequired()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PrivateLinkServiceConnectionState model = - new PrivateLinkServiceConnectionState() - .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) - .withDescription("yurkdtmlxhekuksj") - .withActionsRequired("ukcdmparcryuanzw"); - model = BinaryData.fromObject(model).toObject(PrivateLinkServiceConnectionState.class); - Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, model.status()); - Assertions.assertEquals("yurkdtmlxhekuksj", model.description()); - Assertions.assertEquals("ukcdmparcryuanzw", model.actionsRequired()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerConfigurationInnerTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerConfigurationInnerTests.java deleted file mode 100644 index 4e03d99e1921..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerConfigurationInnerTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.ServerConfigurationInner; -import org.junit.jupiter.api.Assertions; - -public final class ServerConfigurationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServerConfigurationInner model = - BinaryData - .fromString( - "{\"properties\":{\"value\":\"umkdosvqwhbmd\",\"source\":\"bjf\",\"description\":\"gmbmbexppbh\",\"defaultValue\":\"qrolfpf\",\"dataType\":\"Enumeration\",\"allowedValues\":\"gbquxigj\",\"requiresRestart\":true,\"provisioningState\":\"InProgress\"},\"id\":\"o\",\"name\":\"fhrtxilnerkujysv\",\"type\":\"eju\"}") - .toObject(ServerConfigurationInner.class); - Assertions.assertEquals("umkdosvqwhbmd", model.value()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServerConfigurationInner model = new ServerConfigurationInner().withValue("umkdosvqwhbmd"); - model = BinaryData.fromObject(model).toObject(ServerConfigurationInner.class); - Assertions.assertEquals("umkdosvqwhbmd", model.value()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerConfigurationListResultTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerConfigurationListResultTests.java deleted file mode 100644 index 6142a9f7cd22..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerConfigurationListResultTests.java +++ /dev/null @@ -1,38 +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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.ServerConfigurationInner; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerConfigurationListResult; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ServerConfigurationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServerConfigurationListResult model = - BinaryData - .fromString( - "{\"value\":[{\"properties\":{\"value\":\"ispe\",\"source\":\"tzfkufubl\",\"description\":\"fxqeof\",\"defaultValue\":\"e\",\"dataType\":\"Integer\",\"allowedValues\":\"jbasvmsmjqulngs\",\"requiresRestart\":true,\"provisioningState\":\"Canceled\"},\"id\":\"kzgcwrwcl\",\"name\":\"xwrljdouskcqvkoc\",\"type\":\"cjdkwtnhxbnjbi\"},{\"properties\":{\"value\":\"qrglssainqpjwn\",\"source\":\"ljfmppee\",\"description\":\"mgxsab\",\"defaultValue\":\"qduujitcjczdz\",\"dataType\":\"Numeric\",\"allowedValues\":\"hkr\",\"requiresRestart\":false,\"provisioningState\":\"InProgress\"},\"id\":\"dsbdkvwrwjf\",\"name\":\"usnhutje\",\"type\":\"tmrldhugjzzdatq\"},{\"properties\":{\"value\":\"oc\",\"source\":\"eablg\",\"description\":\"uticndvkaozwyif\",\"defaultValue\":\"hxh\",\"dataType\":\"Enumeration\",\"allowedValues\":\"ftyxolniw\",\"requiresRestart\":false,\"provisioningState\":\"Canceled\"},\"id\":\"fkgiawxk\",\"name\":\"ryplwckbasyypn\",\"type\":\"dhsgcba\"},{\"properties\":{\"value\":\"hejkotynqgou\",\"source\":\"ndlik\",\"description\":\"qkgfgibma\",\"defaultValue\":\"akeqs\",\"dataType\":\"Boolean\",\"allowedValues\":\"zqqedq\",\"requiresRestart\":true,\"provisioningState\":\"InProgress\"},\"id\":\"fouflmmnkzsmo\",\"name\":\"mglougpbkw\",\"type\":\"mutduqktaps\"}],\"nextLink\":\"gcue\"}") - .toObject(ServerConfigurationListResult.class); - Assertions.assertEquals("ispe", model.value().get(0).value()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServerConfigurationListResult model = - new ServerConfigurationListResult() - .withValue( - Arrays - .asList( - new ServerConfigurationInner().withValue("ispe"), - new ServerConfigurationInner().withValue("qrglssainqpjwn"), - new ServerConfigurationInner().withValue("oc"), - new ServerConfigurationInner().withValue("hejkotynqgou"))); - model = BinaryData.fromObject(model).toObject(ServerConfigurationListResult.class); - Assertions.assertEquals("ispe", model.value().get(0).value()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerConfigurationPropertiesTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerConfigurationPropertiesTests.java deleted file mode 100644 index 2f22cf45cd9c..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerConfigurationPropertiesTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.fluent.models.ServerConfigurationProperties; -import org.junit.jupiter.api.Assertions; - -public final class ServerConfigurationPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServerConfigurationProperties model = - BinaryData - .fromString( - "{\"value\":\"fqawrlyxw\",\"source\":\"cpr\",\"description\":\"wbxgjvt\",\"defaultValue\":\"p\",\"dataType\":\"Numeric\",\"allowedValues\":\"dnrujqguhmuouqfp\",\"requiresRestart\":false,\"provisioningState\":\"Canceled\"}") - .toObject(ServerConfigurationProperties.class); - Assertions.assertEquals("fqawrlyxw", model.value()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServerConfigurationProperties model = new ServerConfigurationProperties().withValue("fqawrlyxw"); - model = BinaryData.fromObject(model).toObject(ServerConfigurationProperties.class); - Assertions.assertEquals("fqawrlyxw", model.value()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerNameItemTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerNameItemTests.java deleted file mode 100644 index fcc94da87c39..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerNameItemTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerNameItem; -import org.junit.jupiter.api.Assertions; - -public final class ServerNameItemTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServerNameItem model = - BinaryData - .fromString("{\"name\":\"fpownoizhwlr\",\"fullyQualifiedDomainName\":\"bqsoqijg\"}") - .toObject(ServerNameItem.class); - Assertions.assertEquals("fpownoizhwlr", model.name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServerNameItem model = new ServerNameItem().withName("fpownoizhwlr"); - model = BinaryData.fromObject(model).toObject(ServerNameItem.class); - Assertions.assertEquals("fpownoizhwlr", model.name()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerPropertiesTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerPropertiesTests.java deleted file mode 100644 index f3627203cde0..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerPropertiesTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerProperties; -import org.junit.jupiter.api.Assertions; - -public final class ServerPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServerProperties model = - BinaryData - .fromString( - "{\"serverEdition\":\"yevc\",\"storageQuotaInMb\":308422624,\"vCores\":284710625,\"enableHa\":true,\"enablePublicIpAccess\":false,\"isReadOnly\":false,\"administratorLogin\":\"jzrnf\"}") - .toObject(ServerProperties.class); - Assertions.assertEquals("yevc", model.serverEdition()); - Assertions.assertEquals(308422624, model.storageQuotaInMb()); - Assertions.assertEquals(284710625, model.vCores()); - Assertions.assertEquals(true, model.enableHa()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServerProperties model = - new ServerProperties() - .withServerEdition("yevc") - .withStorageQuotaInMb(308422624) - .withVCores(284710625) - .withEnableHa(true); - model = BinaryData.fromObject(model).toObject(ServerProperties.class); - Assertions.assertEquals("yevc", model.serverEdition()); - Assertions.assertEquals(308422624, model.storageQuotaInMb()); - Assertions.assertEquals(284710625, model.vCores()); - Assertions.assertEquals(true, model.enableHa()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerRoleGroupConfigurationTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerRoleGroupConfigurationTests.java deleted file mode 100644 index 17fe4ec4a385..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServerRoleGroupConfigurationTests.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.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRole; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRoleGroupConfiguration; -import org.junit.jupiter.api.Assertions; - -public final class ServerRoleGroupConfigurationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ServerRoleGroupConfiguration model = - BinaryData - .fromString( - "{\"role\":\"Coordinator\",\"value\":\"maajrmvdjwzrlo\",\"defaultValue\":\"clwhijcoejctbz\",\"source\":\"s\"}") - .toObject(ServerRoleGroupConfiguration.class); - Assertions.assertEquals(ServerRole.COORDINATOR, model.role()); - Assertions.assertEquals("maajrmvdjwzrlo", model.value()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ServerRoleGroupConfiguration model = - new ServerRoleGroupConfiguration().withRole(ServerRole.COORDINATOR).withValue("maajrmvdjwzrlo"); - model = BinaryData.fromObject(model).toObject(ServerRoleGroupConfiguration.class); - Assertions.assertEquals(ServerRole.COORDINATOR, model.role()); - Assertions.assertEquals("maajrmvdjwzrlo", model.value()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersGetWithResponseMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersGetWithResponseMockTests.java deleted file mode 100644 index 8455a39690d1..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersGetWithResponseMockTests.java +++ /dev/null @@ -1,78 +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.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ClusterServer; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRole; -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 ServersGetWithResponseMockTests { - @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\":{\"fullyQualifiedDomainName\":\"plwzbhvgyugu\",\"role\":\"Worker\",\"state\":\"kfssxqukkf\",\"haState\":\"gmgsxnkjzkde\",\"availabilityZone\":\"pvlopwiyighxpkd\",\"postgresqlVersion\":\"baiuebbaumny\",\"citusVersion\":\"ped\",\"serverEdition\":\"jn\",\"storageQuotaInMb\":949740199,\"vCores\":1650881541,\"enableHa\":true,\"enablePublicIpAccess\":true,\"isReadOnly\":true,\"administratorLogin\":\"ebtfhvpesap\"},\"id\":\"rdqmhjjdhtldwkyz\",\"name\":\"uutkncw\",\"type\":\"cwsvlxotog\"}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ClusterServer response = - manager - .servers() - .getWithResponse("xytxhpzxbz", "fzab", "lcuhxwtctyqiklb", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(ServerRole.WORKER, response.role()); - Assertions.assertEquals("pvlopwiyighxpkd", response.availabilityZone()); - Assertions.assertEquals("baiuebbaumny", response.postgresqlVersion()); - Assertions.assertEquals("ped", response.citusVersion()); - Assertions.assertEquals("jn", response.serverEdition()); - Assertions.assertEquals(949740199, response.storageQuotaInMb()); - Assertions.assertEquals(1650881541, response.vCores()); - Assertions.assertEquals(true, response.enableHa()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersListByClusterMockTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersListByClusterMockTests.java deleted file mode 100644 index b2e6bdaba72a..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/ServersListByClusterMockTests.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.resourcemanager.cosmosdbforpostgresql.CosmosDBForPostgreSqlManager; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ClusterServer; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.ServerRole; -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 ServersListByClusterMockTests { - @Test - public void testListByCluster() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - - String responseStr = - "{\"value\":[{\"properties\":{\"fullyQualifiedDomainName\":\"xmyskp\",\"role\":\"Worker\",\"state\":\"btkcxywnytnrsyn\",\"haState\":\"idybyxczf\",\"availabilityZone\":\"haaxdbabphl\",\"postgresqlVersion\":\"qlfktsths\",\"citusVersion\":\"ocmnyyazttbtwwrq\",\"serverEdition\":\"edckzywbiexzfey\",\"storageQuotaInMb\":2061798656,\"vCores\":537783371,\"enableHa\":true,\"enablePublicIpAccess\":true,\"isReadOnly\":true,\"administratorLogin\":\"qwalmuzyoxaepd\"},\"id\":\"jancu\",\"name\":\"rhdwbavxbniw\",\"type\":\"jswztsdbpg\"}]}"; - - 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); - })); - - CosmosDBForPostgreSqlManager manager = - CosmosDBForPostgreSqlManager - .configure() - .withHttpClient(httpClient) - .authenticate( - tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = - manager.servers().listByCluster("rcvpnazzmhjrunmp", "ttdbhrbnl", com.azure.core.util.Context.NONE); - - Assertions.assertEquals(ServerRole.WORKER, response.iterator().next().role()); - Assertions.assertEquals("haaxdbabphl", response.iterator().next().availabilityZone()); - Assertions.assertEquals("qlfktsths", response.iterator().next().postgresqlVersion()); - Assertions.assertEquals("ocmnyyazttbtwwrq", response.iterator().next().citusVersion()); - Assertions.assertEquals("edckzywbiexzfey", response.iterator().next().serverEdition()); - Assertions.assertEquals(2061798656, response.iterator().next().storageQuotaInMb()); - Assertions.assertEquals(537783371, response.iterator().next().vCores()); - Assertions.assertEquals(true, response.iterator().next().enableHa()); - } -} diff --git a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/SimplePrivateEndpointConnectionTests.java b/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/SimplePrivateEndpointConnectionTests.java deleted file mode 100644 index 49a5955c5d3c..000000000000 --- a/sdk/cosmosdbforpostgresql/azure-resourcemanager-cosmosdbforpostgresql/src/test/java/com/azure/resourcemanager/cosmosdbforpostgresql/generated/SimplePrivateEndpointConnectionTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.cosmosdbforpostgresql.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointProperty; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateEndpointServiceConnectionStatus; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.PrivateLinkServiceConnectionState; -import com.azure.resourcemanager.cosmosdbforpostgresql.models.SimplePrivateEndpointConnection; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class SimplePrivateEndpointConnectionTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SimplePrivateEndpointConnection model = - BinaryData - .fromString( - "{\"properties\":{\"privateEndpoint\":{\"id\":\"pazlobcufpdz\"},\"groupIds\":[\"t\",\"qqjnqgl\"],\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"foooj\",\"actionsRequired\":\"ifsqesaagdfmg\"}},\"id\":\"lhjxr\",\"name\":\"f\",\"type\":\"wmrvktsizntocipa\"}") - .toObject(SimplePrivateEndpointConnection.class); - Assertions.assertEquals("pazlobcufpdz", model.privateEndpoint().id()); - Assertions.assertEquals("t", model.groupIds().get(0)); - Assertions - .assertEquals( - PrivateEndpointServiceConnectionStatus.PENDING, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("foooj", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("ifsqesaagdfmg", model.privateLinkServiceConnectionState().actionsRequired()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SimplePrivateEndpointConnection model = - new SimplePrivateEndpointConnection() - .withPrivateEndpoint(new PrivateEndpointProperty().withId("pazlobcufpdz")) - .withGroupIds(Arrays.asList("t", "qqjnqgl")) - .withPrivateLinkServiceConnectionState( - new PrivateLinkServiceConnectionState() - .withStatus(PrivateEndpointServiceConnectionStatus.PENDING) - .withDescription("foooj") - .withActionsRequired("ifsqesaagdfmg")); - model = BinaryData.fromObject(model).toObject(SimplePrivateEndpointConnection.class); - Assertions.assertEquals("pazlobcufpdz", model.privateEndpoint().id()); - Assertions.assertEquals("t", model.groupIds().get(0)); - Assertions - .assertEquals( - PrivateEndpointServiceConnectionStatus.PENDING, model.privateLinkServiceConnectionState().status()); - Assertions.assertEquals("foooj", model.privateLinkServiceConnectionState().description()); - Assertions.assertEquals("ifsqesaagdfmg", model.privateLinkServiceConnectionState().actionsRequired()); - } -}