From 2128ca58f267ae54ae1d64c45de3dd74cb253fe7 Mon Sep 17 00:00:00 2001 From: Anudeep Sharma Date: Mon, 7 Nov 2016 18:35:36 -0800 Subject: [PATCH] Corrected some of the flow for SqlDatabase and server --- .../management/sql/DatabaseEditions.java | 2 +- .../azure/management/sql/SqlDatabase.java | 153 +++++++++++++----- .../azure/management/sql/SqlServer.java | 51 ++++-- .../sql/implementation/DatabasesImpl.java | 2 +- .../sql/implementation/SqlDatabaseImpl.java | 54 ++----- .../sql/implementation/SqlDatabasesImpl.java | 2 +- .../sql/implementation/SqlServerImpl.java | 8 +- .../sql/SqlServerOperationsTests.java | 54 +++++-- .../management/sql/SqlServerTestBase.java | 2 +- 9 files changed, 215 insertions(+), 113 deletions(-) diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseEditions.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseEditions.java index a36b14233886..28ed3d41d51c 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseEditions.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseEditions.java @@ -13,7 +13,7 @@ /** * Defines values for DatabaseEditions. */ -public final class DatabaseEditions { +public class DatabaseEditions { /** Static value Web for DatabaseEditions. */ public static final DatabaseEditions WEB = new DatabaseEditions("Web"); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlDatabase.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlDatabase.java index 446823cb2c50..edb227532256 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlDatabase.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlDatabase.java @@ -151,7 +151,11 @@ interface Definition extends DefinitionStages.WithCreate, DefinitionStages.WithCollation, DefinitionStages.WithEdition, - DefinitionStages.WithElasticPoolName { + DefinitionStages.WithElasticPoolName, + DefinitionStages.WithSourceDatabaseId, + DefinitionStages.WithCreateMode, + DefinitionStages.WithCreateWithLessOptions, + DefinitionStages.WithExistingDatabase { } /** @@ -161,13 +165,95 @@ interface DefinitionStages { /** * The first stage of the SQL Server definition. */ - interface Blank extends WithCreate { + interface Blank extends WithElasticPoolName { + } + + /** + * The SQL Database definition to set the elastic pool for database. + */ + interface WithElasticPoolName { + /** + * Specifies database to be created without elastic pool. + * + * @return The next stage of definition. + */ + WithExistingDatabase withoutExistingElasticPool(); + + /** + * Sets the existing elastic pool for the SQLDatabase. + * + * @param elasticPoolName for the SQL Database + * @return The next stage of definition. + */ + WithExistingDatabase withExistingElasticPool(String elasticPoolName); + + /** + * Sets the existing elastic pool for the SQLDatabase. + * + * @param sqlElasticPool for the SQL Database + * @return The next stage of definition. + */ + WithExistingDatabase withExistingElasticPool(SqlElasticPool sqlElasticPool); + + /** + * Sets the new elastic pool for the SQLDatabase, this will create a new elastic pool while creating database. + * + * @param sqlElasticPool creatable definition for new elastic pool to be created for the SQL Database + * @return The next stage of definition. + */ + WithExistingDatabase withNewElasticPool(Creatable sqlElasticPool); + } + + /** + * The stage to decide whether using existing database or not. + */ + interface WithExistingDatabase extends WithSourceDatabaseId { + /** + * Sets the creation flow to ask relevant question when source database is not specified. + * + * @return The next stage of definition. + */ + WithCreate withoutSourceDatabaseId(); + } + + /** + * The SQL Database definition to set the source database id for database. + */ + interface WithSourceDatabaseId { + /** + * Sets the resource if of source database for the SQL Database. + * Collation, Edition, and MaxSizeBytes must remain the same while the link is + * active. Values specified for these parameters will be ignored. + * + * @param sourceDatabaseId id of the source database + * @return The next stage of definition. + */ + WithCreateMode withSourceDatabaseId(String sourceDatabaseId); + } + + /** + * The SQL Database definition to set the create mode for database. + */ + interface WithCreateMode { + /** + * Sets the create mode for the SQL Database. + * + * @param createMode create mode for the database, should not be default in this flow + * @return The next stage of definition. + */ + WithCreateWithLessOptions withCreateMode(CreateMode createMode); } /** * The SQL Database definition to set the collation for database. */ interface WithCollation { + /** + * Sets the collation for the SQL Database. + * + * @param collation collation to be set for database + * @return The next stage of definition + */ WithCreate withCollation(String collation); } @@ -177,8 +263,9 @@ interface WithCollation { interface WithEdition { /** * Sets the edition for the SQL Database. - * @param edition edition to be set for database. - * @return The next stage of definition. + * + * @param edition edition to be set for database + * @return The next stage of definition */ WithCreate withEdition(DatabaseEditions edition); } @@ -189,6 +276,7 @@ interface WithEdition { interface WithMaxSizeBytes { /** * Sets the max size in bytes for SQL Database. + * * @param maxSizeBytes max size of the Azure SQL Database expressed in bytes. Note: Only * the following sizes are supported (in addition to limitations being * placed on each edition): { 100 MB | 500 MB |1 GB | 5 GB | 10 GB | 20 @@ -204,6 +292,7 @@ interface WithMaxSizeBytes { interface WithServiceObjective { /** * Sets the service level objective for the SQL Database. + * * @param serviceLevelObjective service level objected for the SQL Database * @return The next stage of the definition. */ @@ -211,29 +300,16 @@ interface WithServiceObjective { } /** - * The SQL Database definition to set the elastic pool for database. + * A SQL Database definition with sufficient inputs to create a new + * SQL Server in the cloud, but exposing additional optional inputs to + * specify. */ - interface WithElasticPoolName { - /** - * Sets the existing elastic pool for the SQLDatabase. - * @param elasticPoolName for the SQL Database. - * @return The next stage of definition. - */ - WithCreate withExistingElasticPool(String elasticPoolName); - - /** - * Sets the existing elastic pool for the SQLDatabase. - * @param sqlElasticPool for the SQL Database. - * @return The next stage of definition. - */ - WithCreate withExistingElasticPool(SqlElasticPool sqlElasticPool); - - /** - * Sets the new elastic pool for the SQLDatabase, this will create a new elastic pool while creating database. - * @param sqlElasticPool creatable definition for new elastic pool to be created for the SQL Database. - * @return The next stage of definition. - */ - WithCreate withNewElasticPool(Creatable sqlElasticPool); + interface WithCreate extends + WithMaxSizeBytes, + WithServiceObjective, + WithCollation, + WithEdition, + WithCreateWithLessOptions { } /** @@ -241,14 +317,9 @@ interface WithElasticPoolName { * SQL Server in the cloud, but exposing additional optional inputs to * specify. */ - interface WithCreate extends + interface WithCreateWithLessOptions extends Creatable, - DefinitionWithTags, - WithMaxSizeBytes, - WithServiceObjective, - WithElasticPoolName, - WithCollation, - WithEdition { + DefinitionWithTags { } } @@ -273,10 +344,11 @@ interface UpdateStages { interface WithEdition { /** * Sets the edition for the SQL Database. - * @param edition edition to be set for database. + * + * @param edition edition to be set for database * @return The next stage of definition. */ - WithServiceObjective withEdition(DatabaseEditions edition); + Update withEdition(DatabaseEditions edition); } /** @@ -300,6 +372,7 @@ interface WithMaxSizeBytes { interface WithServiceObjective { /** * Sets the service level objective for the SQL Database. + * * @param serviceLevelObjective service level objected for the SQL Database * @return The next stage of the definition. */ @@ -312,27 +385,31 @@ interface WithServiceObjective { interface WithElasticPoolName { /** * Removes database from it's elastic pool. + * * @return The next stage of definition. */ WithEdition withoutExistingElasticPool(); /** * Sets the existing elastic pool for the SQLDatabase. - * @param elasticPoolName for the SQL Database. + * + * @param elasticPoolName for the SQL Database * @return The next stage of definition. */ Update withExistingElasticPool(String elasticPoolName); /** * Sets the existing elastic pool for the SQLDatabase. - * @param sqlElasticPool for the SQL Database. + * + * @param sqlElasticPool for the SQL Database * @return The next stage of definition. */ Update withExistingElasticPool(SqlElasticPool sqlElasticPool); /** * Sets the new elastic pool for the SQLDatabase, this will create a new elastic pool while creating database. - * @param sqlElasticPool creatable definition for new elastic pool to be created for the SQL Database. + * + * @param sqlElasticPool creatable definition for new elastic pool to be created for the SQL Database * @return The next stage of definition. */ Update withNewElasticPool(Creatable sqlElasticPool); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlServer.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlServer.java index e547b9a02bb8..8533c220532e 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlServer.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/SqlServer.java @@ -38,10 +38,9 @@ public interface SqlServer extends ServerVersion version(); /** - * * @return the administrator login user name for the SQL Server */ - String adminLogin(); + String administratorLogin(); /** * @return returns entry point to manage FirewallRules in SqlServer. @@ -173,8 +172,8 @@ interface Databases { interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, - DefinitionStages.WithAdminUserName, - DefinitionStages.WithPassword, + DefinitionStages.WithAdministratorLogin, + DefinitionStages.WithAdministratorPassword, DefinitionStages.WithVersion, DefinitionStages.WithCreate { } @@ -192,27 +191,45 @@ interface Blank extends DefinitionWithRegion { /** * A SQL Server definition allowing resource group to be set. */ - interface WithGroup extends GroupableResource.DefinitionStages.WithGroup { + interface WithGroup extends GroupableResource.DefinitionStages.WithGroup { } /** - * A SQL Server definition setting admin user name. + * A SQL Server definition setting administrator user name. */ - interface WithAdminUserName { - WithPassword withAdminUserName(String adminUserName); + interface WithAdministratorLogin { + /** + * Sets the administrator login user name. + * + * @param administratorLogin administrator login user name + * @return Next stage of the SQL Server creation + */ + WithAdministratorPassword withAdministratorLogin(String administratorLogin); } /** * A SQL Server definition setting admin user password. */ - interface WithPassword { - WithCreate withPassword(String password); + interface WithAdministratorPassword { + /** + * Sets the administrator login password. + * + * @param administratorLoginPassword password for administrator login + * @return Next stage of the SQL Server creation + */ + WithCreate withAdministratorPassword(String administratorLoginPassword); } /** * A SQL Server definition setting version. */ interface WithVersion { + /** + * Sets the version of SQL Server to be created. + * + * @param version Version of SQL server to be created + * @return Next stage of the SQL Server creation + */ WithCreate withVersion(ServerVersion version); } @@ -232,7 +249,7 @@ interface WithCreate extends */ interface Update extends Appliable, - UpdateStages.WithAdminPassword { + UpdateStages.WithAdministratorPassword { } /** @@ -241,10 +258,16 @@ interface Update extends interface UpdateStages { /** - * A SQL Server definition setting administrator user password. + * A SQL Server definition setting admin user password. */ - interface WithAdminPassword { - Update withPassword(String administratorPassword); + interface WithAdministratorPassword { + /** + * Sets the administrator login password. + * + * @param administratorLoginPassword password for administrator login + * @return Next stage of the SQL Server creation. + */ + Update withAdministratorPassword(String administratorLoginPassword); } } } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesImpl.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesImpl.java index 55cffd47df8e..fe6d17475e98 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesImpl.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesImpl.java @@ -32,7 +32,7 @@ public class DatabasesImpl implements SqlServer.Databases { @Override public SqlDatabase get(String databaseName) { return this.databases.getBySqlServer(this.resourceGroupName, this.sqlServerName, databaseName); - } +} @Override public SqlDatabase.DefinitionStages.Blank define(String databaseName) { diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlDatabaseImpl.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlDatabaseImpl.java index 7a456e340211..01547429f477 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlDatabaseImpl.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlDatabaseImpl.java @@ -9,6 +9,7 @@ import com.microsoft.azure.management.resources.fluentcore.arm.models.IndependentChild; import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.IndependentChildResourceImpl; import com.microsoft.azure.management.resources.fluentcore.model.Creatable; +import com.microsoft.azure.management.sql.CreateMode; import com.microsoft.azure.management.sql.DatabaseEditions; import com.microsoft.azure.management.sql.ServiceObjectiveName; import com.microsoft.azure.management.sql.SqlDatabase; @@ -219,42 +220,21 @@ public SqlDatabaseImpl withServiceObjective(ServiceObjectiveName serviceLevelObj this.inner().withRequestedServiceObjectiveId(null); return this; } -/* - private UUID getServiceLevelObjectiveId(ServiceObjectiveName serviceObjectiveName) - { - if (serviceObjectiveName.toString().equalsIgnoreCase(ServiceObjectiveName.S0.toString())) - { - return UUID.fromString("dd6d99bb-f193-4ec1-86f2-43d3bccbc49c"); - } - if (serviceObjectiveName.toString().equalsIgnoreCase(ServiceObjectiveName.S1.toString())) - { - return UUID.fromString("f1173c43-91bd-4aaa-973c-54e79e15235b"); - } - if (serviceObjectiveName.toString().equalsIgnoreCase(ServiceObjectiveName.S2.toString())) - { - return UUID.fromString("1b1ebd4d-d903-4baa-97f9-4ea675f5e928"); - } - if (serviceObjectiveName.toString().equalsIgnoreCase(ServiceObjectiveName.S3.toString())) - { - return UUID.fromString("455330e1-00cd-488b-b5fa-177c226f28b7"); - } - if (serviceObjectiveName.toString().equalsIgnoreCase(ServiceObjectiveName.P1.toString())) - { - return UUID.fromString("7203483a-c4fb-4304-9e9f-17c71c904f5d"); - } - if (serviceObjectiveName.toString().equalsIgnoreCase(ServiceObjectiveName.P2.toString())) - { - return UUID.fromString("789681b8-ca10-4eb0-bdf2-e0b050601b40"); - } - if (serviceObjectiveName.toString().equalsIgnoreCase(ServiceObjectiveName.P3.toString())) - { - return UUID.fromString("a7d1b92d-c987-4375-b54d-2b1d0e0f5bb0"); - } - if (serviceObjectiveName.toString().equalsIgnoreCase(ServiceObjectiveName.P3.toString())) - { - return UUID.fromString("a7c4c615-cfb1-464b-b252-925be0a19446"); - } - return null; - }*/ + @Override + public SqlDatabaseImpl withSourceDatabaseId(String sourceDatabaseId) { + this.inner().withSourceDatabaseId(sourceDatabaseId); + return this; + } + + @Override + public SqlDatabaseImpl withCreateMode(CreateMode createMode) { + this.inner().withCreateMode(createMode); + return this; + } + + @Override + public SqlDatabaseImpl withoutSourceDatabaseId() { + return this; + } } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlDatabasesImpl.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlDatabasesImpl.java index 49ca60f12eab..a557bb010151 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlDatabasesImpl.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlDatabasesImpl.java @@ -30,7 +30,7 @@ class SqlDatabasesImpl extends IndependentChildResourcesImpl< implements SqlDatabases.SqlDatabaseCreatable, SupportsGettingByParent, SupportsListingByParent { - protected SqlDatabasesImpl(DatabasesInner innerCollection, SqlServerManager manager) { + protected SqlDatabasesImpl(DatabasesInner innerCollection, SqlServerManager manager) { super(innerCollection, manager); } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlServerImpl.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlServerImpl.java index eaf4cdf1e1ff..563a962214c3 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlServerImpl.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlServerImpl.java @@ -78,7 +78,7 @@ public ServerVersion version() { } @Override - public String adminLogin() { + public String administratorLogin() { return this.inner().administratorLogin(); } @@ -98,13 +98,13 @@ public Databases databases() { } @Override - public SqlServerImpl withAdminUserName(String administratorUserName) { - this.inner().withAdministratorLogin(administratorUserName); + public SqlServerImpl withAdministratorLogin(String administratorLogin) { + this.inner().withAdministratorLogin(administratorLogin); return this; } @Override - public SqlServerImpl withPassword(String administratorLoginPassword) { + public SqlServerImpl withAdministratorPassword(String administratorLoginPassword) { this.inner().withAdministratorLoginPassword(administratorLoginPassword); return this; } diff --git a/azure-mgmt-sql/src/test/java/com/microsoft/azure/management/sql/SqlServerOperationsTests.java b/azure-mgmt-sql/src/test/java/com/microsoft/azure/management/sql/SqlServerOperationsTests.java index cd53d27337e5..82006d003b80 100644 --- a/azure-mgmt-sql/src/test/java/com/microsoft/azure/management/sql/SqlServerOperationsTests.java +++ b/azure-mgmt-sql/src/test/java/com/microsoft/azure/management/sql/SqlServerOperationsTests.java @@ -17,8 +17,8 @@ import java.util.List; public class SqlServerOperationsTests extends SqlServerTestBase { - private static final String RG_NAME = "javasqlserver1237"; - private static final String SQL_SERVER_NAME = "javasqlserver1237"; + private static final String RG_NAME = "javasqlserver1238"; + private static final String SQL_SERVER_NAME = "javasqlserver1238"; private static final String SQL_DATABASE_NAME = "myTestDatabase2"; private static final String COLLATION = "SQL_Latin1_General_CP1_CI_AS"; private static final String SQL_ELASTIC_POOL_NAME = "testElasticPool"; @@ -43,7 +43,7 @@ public void canCRUDSqlServer() throws Exception { SqlServer sqlServer = createSqlServer(); validateSqlServer(sqlServer); - sqlServer.update().withPassword("P@ssword~2").apply(); + sqlServer.update().withAdministratorPassword("P@ssword~2").apply(); // List List sqlServers = sqlServerManager.sqlServers().listByGroup(RG_NAME); @@ -69,17 +69,34 @@ public void canCRUDSqlDatabase() throws Exception { SqlDatabase sqlDatabase = sqlServer.databases() .define(SQL_DATABASE_NAME) + .withoutExistingElasticPool() + .withoutSourceDatabaseId() .withCollation(COLLATION) .withEdition(DatabaseEditions.STANDARD) .createAsync().toBlocking().first(); - validateSqlDatabase(sqlDatabase); + validateSqlDatabase(sqlDatabase, SQL_DATABASE_NAME); sqlServer = sqlServerManager.sqlServers().getByGroup(RG_NAME, SQL_SERVER_NAME); validateSqlServer(sqlServer); + // Create another database with above created database as source database. + Creatable sqlElasticPoolCreatable = sqlServer.elasticPools() + .define(SQL_ELASTIC_POOL_NAME) + .withEdition(ElasticPoolEditions.STANDARD); + String anotherDatabaseName = "anotherDatabase"; + SqlDatabase anotherDatabase = sqlServer.databases() + .define(anotherDatabaseName) + .withNewElasticPool(sqlElasticPoolCreatable) + .withSourceDatabaseId(sqlDatabase.id()) + .withCreateMode(CreateMode.COPY) + .create(); + + validateSqlDatabaseWithElasticPool(anotherDatabase, anotherDatabaseName); + sqlServer.databases().delete(anotherDatabase.name()); + // Get - validateSqlDatabase(sqlServer.databases().get(SQL_DATABASE_NAME)); + validateSqlDatabase(sqlServer.databases().get(SQL_DATABASE_NAME), SQL_DATABASE_NAME); // List validateListSqlDatabase(sqlServer.databases().list()); @@ -91,6 +108,8 @@ public void canCRUDSqlDatabase() throws Exception { // Add another database to the server sqlDatabase = sqlServer.databases() .define("newDatabase") + .withoutExistingElasticPool() + .withoutSourceDatabaseId() .withCollation(COLLATION) .withEdition(DatabaseEditions.STANDARD) .createAsync().toBlocking().first(); @@ -111,12 +130,14 @@ public void canCRUDSqlDatabaseWithElasticPool() throws Exception { SqlDatabase sqlDatabase = sqlServer.databases() .define(SQL_DATABASE_NAME) + .withNewElasticPool(sqlElasticPoolCreatable) + .withoutSourceDatabaseId() .withCollation(COLLATION) .withEdition(DatabaseEditions.STANDARD) - .withNewElasticPool(sqlElasticPoolCreatable) + .withServiceObjective(ServiceObjectiveName.S1) .createAsync().toBlocking().first(); - validateSqlDatabase(sqlDatabase); + validateSqlDatabase(sqlDatabase, SQL_DATABASE_NAME); sqlServer = sqlServerManager.sqlServers().getByGroup(RG_NAME, SQL_SERVER_NAME); validateSqlServer(sqlServer); @@ -125,7 +146,7 @@ public void canCRUDSqlDatabaseWithElasticPool() throws Exception { validateSqlElasticPool(sqlServer.elasticPools().get(SQL_ELASTIC_POOL_NAME)); // Get - validateSqlDatabaseWithElasticPool(sqlServer.databases().get(SQL_DATABASE_NAME)); + validateSqlDatabaseWithElasticPool(sqlServer.databases().get(SQL_DATABASE_NAME), SQL_DATABASE_NAME); // List validateListSqlDatabase(sqlServer.databases().list()); @@ -179,9 +200,10 @@ public void canCRUDSqlDatabaseWithElasticPool() throws Exception { // Add another database to the server and pool. sqlDatabase = sqlServer.databases() .define("newDatabase") + .withExistingElasticPool(sqlElasticPool) + .withoutSourceDatabaseId() .withCollation(COLLATION) .withEdition(DatabaseEditions.STANDARD) - .withExistingElasticPool(sqlElasticPool) .createAsync().toBlocking().first(); sqlServer.databases().delete(sqlDatabase.name()); validateSqlDatabaseNotFound("newDatabase"); @@ -309,8 +331,8 @@ private static SqlServer createSqlServer() { .define(SQL_SERVER_NAME) .withRegion(Region.US_CENTRAL) .withNewResourceGroup(RG_NAME) - .withAdminUserName("userName") - .withPassword("P@ssword~1") + .withAdministratorLogin("userName") + .withAdministratorPassword("P@ssword~1") .withVersion(ServerVersion.ONE_TWO_FULL_STOP_ZERO) .create(); } @@ -371,20 +393,20 @@ private static void validateSqlServer(SqlServer sqlServer) { Assert.assertEquals(RG_NAME, sqlServer.resourceGroupName()); Assert.assertNotNull(sqlServer.fullyQualifiedDomainName()); Assert.assertEquals(ServerVersion.ONE_TWO_FULL_STOP_ZERO, sqlServer.version()); - Assert.assertEquals("userName", sqlServer.adminLogin()); + Assert.assertEquals("userName", sqlServer.administratorLogin()); } - private static void validateSqlDatabase(SqlDatabase sqlDatabase) { + private static void validateSqlDatabase(SqlDatabase sqlDatabase, String databaseName) { Assert.assertNotNull(sqlDatabase); - Assert.assertEquals(sqlDatabase.name(), SQL_DATABASE_NAME); + Assert.assertEquals(sqlDatabase.name(), databaseName); Assert.assertEquals(SQL_SERVER_NAME, sqlDatabase.sqlServerName()); Assert.assertEquals(sqlDatabase.collation(), COLLATION); Assert.assertEquals(sqlDatabase.edition(), DatabaseEditions.STANDARD); } - private static void validateSqlDatabaseWithElasticPool(SqlDatabase sqlDatabase) { - validateSqlDatabase(sqlDatabase); + private static void validateSqlDatabaseWithElasticPool(SqlDatabase sqlDatabase, String databaseName) { + validateSqlDatabase(sqlDatabase, databaseName); Assert.assertEquals(SQL_ELASTIC_POOL_NAME, sqlDatabase.elasticPoolName()); } } diff --git a/azure-mgmt-sql/src/test/java/com/microsoft/azure/management/sql/SqlServerTestBase.java b/azure-mgmt-sql/src/test/java/com/microsoft/azure/management/sql/SqlServerTestBase.java index 82bb55740981..38819c31e471 100644 --- a/azure-mgmt-sql/src/test/java/com/microsoft/azure/management/sql/SqlServerTestBase.java +++ b/azure-mgmt-sql/src/test/java/com/microsoft/azure/management/sql/SqlServerTestBase.java @@ -26,7 +26,7 @@ public static void createClients() { .withBaseUrl(AzureEnvironment.AZURE, AzureEnvironment.Endpoint.RESOURCE_MANAGER) .withCredentials(credentials) .withLogLevel(HttpLoggingInterceptor.Level.BODY) - .withReadTimeout(60, TimeUnit.SECONDS).withProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("localhost", 8888))) + .withReadTimeout(60, TimeUnit.SECONDS) .build(); resourceManager = ResourceManager