Signed-off-by: Pan Li <panli@microsoft.com>
This commit is contained in:
Родитель
1d474ee629
Коммит
256ec01f7d
|
@ -7,15 +7,18 @@ package com.microsoft.azure.spring.data.cosmosdb.common;
|
|||
|
||||
import com.microsoft.azure.documentdb.IndexingMode;
|
||||
import com.microsoft.azure.spring.data.cosmosdb.domain.Address;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class TestConstants {
|
||||
|
||||
private TestConstants() {
|
||||
// Hide the implicit public one
|
||||
}
|
||||
private static final int SUFFIX_LENGTH = 3;
|
||||
private static final String DB_NAME_SUFFIX = UUID.randomUUID().toString().substring(0, SUFFIX_LENGTH);
|
||||
|
||||
private static final Address ADDRESS_1 = new Address("201107", "Zixing Road", "Shanghai");
|
||||
private static final Address ADDRESS_2 = new Address("200000", "Xuhui", "Shanghai");
|
||||
|
@ -73,7 +76,7 @@ public class TestConstants {
|
|||
"{\"kind\":\"Range\",\"dataType\":\"String\",\"precision\":-1}," +
|
||||
"]}";
|
||||
|
||||
public static final String DB_NAME = "database_name_pli";
|
||||
public static final String DB_NAME = String.join("-", "testdb", DB_NAME_SUFFIX);
|
||||
public static final String FIRST_NAME = "first_name_li";
|
||||
public static final String LAST_NAME = "last_name_p";
|
||||
public static final String ID_1 = "id-1";
|
||||
|
|
|
@ -8,6 +8,7 @@ package com.microsoft.azure.spring.data.cosmosdb.repository;
|
|||
import com.microsoft.azure.documentdb.ConnectionPolicy;
|
||||
import com.microsoft.azure.documentdb.ConsistencyLevel;
|
||||
import com.microsoft.azure.documentdb.DocumentClient;
|
||||
import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants;
|
||||
import com.microsoft.azure.spring.data.cosmosdb.config.AbstractDocumentDbConfiguration;
|
||||
import com.microsoft.azure.spring.data.cosmosdb.repository.config.EnableDocumentDbRepositories;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
@ -18,6 +19,7 @@ import org.springframework.context.annotation.PropertySource;
|
|||
@PropertySource(value = {"classpath:application.properties"})
|
||||
@EnableDocumentDbRepositories
|
||||
public class TestRepositoryConfig extends AbstractDocumentDbConfiguration {
|
||||
|
||||
@Value("${cosmosdb.uri}")
|
||||
String dbUri;
|
||||
|
||||
|
@ -31,6 +33,6 @@ public class TestRepositoryConfig extends AbstractDocumentDbConfiguration {
|
|||
|
||||
@Override
|
||||
public String getDatabase() {
|
||||
return "testdb";
|
||||
return TestConstants.DB_NAME;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче