Commit c860a399 authored by Riabokon Stanislav(EPAM)[GCP]'s avatar Riabokon Stanislav(EPAM)[GCP]
Browse files

Merge remote-tracking branch 'origin/master' into integration-master

parents 4d230bf2 c97310c5
Pipeline #27351 failed with stage
in 8 seconds
......@@ -385,9 +385,13 @@ public class AzureSchemaInfoStore implements ISchemaInfoStore {
for (String tenant : tenantList) {
String id = tenant + ":" + schemaId;
String partitionKey = createSchemaInfoPartitionKey(schemaKindToSchemaIdentity(schemaId));
Boolean exists = cosmosStore.findItem(tenant, cosmosDBName, schemaInfoContainer, id, partitionKey, SchemaInfoDoc.class).isPresent();
if (exists) {
return false;
try {
Boolean exists = cosmosStore.findItem(tenant, cosmosDBName, schemaInfoContainer, id, partitionKey, SchemaInfoDoc.class).isPresent();
if (exists) {
return false;
}
} catch (AppException ex) {
log.warning(String.format("Error occurred while performing uniqueness check in tenant '%s'", tenant), ex);
}
}
return true;
......
......@@ -256,6 +256,31 @@ public class AzureSchemaInfoStoreTest {
}
}
@Test
public void testIsUnique_ApplicationException() throws ApplicationException {
TenantInfo tenant1 = new TenantInfo();
tenant1.setName(commonTenantId);
tenant1.setDataPartitionId(commonTenantId);
TenantInfo tenant2 = new TenantInfo();
tenant2.setName(dataPartitionId);
tenant2.setDataPartitionId(dataPartitionId);
Collection<TenantInfo> tenants = Lists.newArrayList(tenant1, tenant2);
when(this.tenantFactory.listTenantInfo()).thenReturn(tenants);
Optional<SchemaInfoDoc> cosmosItem = Optional.of(schemaInfoDoc);
// An error is encountered while checking uniqueness in one tenant.
doThrow(AppException.class)
.when(cosmosStore)
.findItem(
eq(dataPartitionId),
any(),
any(),
eq(dataPartitionId + ":" + schemaId),
eq(partitionKey),
any());
assertTrue(schemaInfoStore.isUnique(schemaId, commonTenantId));
}
@Test
public void testIsUnique_True() throws ApplicationException {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment