Fixed ShardLocation port issue

This commit is contained in:
Dhruva N 2018-06-21 17:34:00 +05:30
Родитель 25230e8793
Коммит a865918ed8
5 изменённых файлов: 20 добавлений и 15 удалений

Просмотреть файл

@ -6,7 +6,7 @@
<groupId>com.microsoft.azure</groupId>
<artifactId>elastic-db-tools</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<version>1.0.1</version>
<name>Azure Elastic Database Tools</name>
<developers>
@ -20,11 +20,11 @@
<properties>
<azurejavasdk.version>${project.version}</azurejavasdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jre.version>1.8</jre.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jre.version>1.8</jre.version>
<junit.version>4.12</junit.version>
<maven.compiler.version>3.7.0</maven.compiler.version>
<maven.surefire.version>2.20.1</maven.surefire.version>
<maven.surefire.version>2.20.1</maven.surefire.version>
<mssql.jdbc.version>6.1.0.jre8</mssql.jdbc.version>
<guava.version>19.0</guava.version>
<commons.collections.version>3.2.2</commons.collections.version>
@ -64,6 +64,7 @@
</includes>
<reuseForks>false</reuseForks>
<forkCount>1</forkCount>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</configuration>
</plugin>

Просмотреть файл

@ -159,7 +159,7 @@ public final class ShardLocation implements Serializable {
* DataSource name which can be used to construct connection string Data Source property.
*/
public String getDataSource() {
return StringUtilsLocal.formatInvariant("%s%s%s", this.getProtocolPrefix(), this.getServer(), this.getPortSuffix());
return StringUtilsLocal.formatInvariant("%s%s", this.getServer(), this.getPortSuffix());
}
public String getDatabase() {
@ -254,8 +254,8 @@ public final class ShardLocation implements Serializable {
* @return Connection string suffix containing string representation of port.
*/
private String getPortSuffix() {
if (this.getPort() != 0) {
return StringUtilsLocal.formatInvariant(",%s", this.getPort());
if (this.getPort() != 0) {
return StringUtilsLocal.formatInvariant(":%s", this.getPort());
}
else {
return "";

Просмотреть файл

@ -1,9 +1,9 @@
#MultiShardTestResources
MULTI_SHARD_TEST_CONN_USER=MultiShardTestUser
MULTI_SHARD_TEST_CONN_PASSWORD=MultiShardTestPass
MULTI_SHARD_TEST_CONN_PASSWORD=MultiShardTestP@5s
#QueryTestResources
TEMP_CONN_USER=TestUser
TEMP_CONN_PASSWORD=TestPass
TEMP_CONN_PASSWORD=TestP@5s
#ShardTestResources
TEST_CONN_USER=sa
TEST_CONN_PASSWORD=SystemAdmin

Просмотреть файл

@ -6,7 +6,7 @@
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-samples</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<packaging>jar</packaging>
<name>Azure Elastic Scale Starter Kit</name>
@ -16,7 +16,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${jre.version}</source>
<target>${jre.version}</target>
@ -25,7 +25,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<version>${exec-maven-plugin.version}</version>
<executions>
<execution>
<goals>
@ -45,7 +45,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>elastic-db-tools</artifactId>
<version>1.0.0</version>
<version>${elastic-db-tools.version}</version>
</dependency>
</dependencies>
@ -53,6 +53,9 @@
<azurejavasdk.version>${project.version}</azurejavasdk.version>
<jre.version>1.8</jre.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<elastic-db-tools.version>1.0.1</elastic-db-tools.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
</properties>
<developers>

Просмотреть файл

@ -10,6 +10,7 @@ import com.microsoft.azure.elasticdb.shard.base.Range;
import com.microsoft.azure.elasticdb.shard.base.RangeMapping;
import com.microsoft.azure.elasticdb.shard.base.Shard;
import com.microsoft.azure.elasticdb.shard.base.ShardLocation;
import com.microsoft.azure.elasticdb.shard.base.SqlProtocol;
import com.microsoft.azure.elasticdb.shard.map.ListShardMap;
import com.microsoft.azure.elasticdb.shard.map.RangeShardMap;
import java.util.ArrayList;
@ -82,7 +83,7 @@ class CreateShardSample {
SqlDatabaseUtils.executeSqlScript(shardMapManagerServerName, databaseName, properties.getProperty("INITIAL_SHARD_SCRIPT"));
// Add it to the shard map
ShardLocation shardLocation = new ShardLocation(shardMapManagerServerName, databaseName);
ShardLocation shardLocation = new ShardLocation(shardMapManagerServerName, databaseName, SqlProtocol.Tcp, 1433);
shard = ShardManagementUtils.createOrGetShard(shardMap, shardLocation);
}
@ -115,7 +116,7 @@ class CreateShardSample {
SqlDatabaseUtils.executeSqlScript(shardMapManagerServerName, databaseName, properties.getProperty("INITIAL_SHARD_SCRIPT"));
// Add it to the shard map
ShardLocation shardLocation = new ShardLocation(shardMapManagerServerName, databaseName);
ShardLocation shardLocation = new ShardLocation(shardMapManagerServerName, databaseName, SqlProtocol.Tcp, 1433);
shard = ShardManagementUtils.createOrGetShard(shardMap, shardLocation);
}