Skip to content

Commit a75816c

Browse files
minor changes to synapse unit tests.
1 parent b22e490 commit a75816c

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

athena-synapse/src/test/java/com/amazonaws/athena/connectors/synapse/SynapseMetadataHandlerTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -402,14 +402,14 @@ public void doGetTable()
402402
when(connection.getMetaData().getURL()).thenReturn("jdbc:sqlserver://hostname;databaseName=fakedatabase");
403403

404404
TableName inputTableName = new TableName(TEST_SCHEMA, TEST_TABLE);
405-
when(connection.getCatalog()).thenReturn("testCatalog");
406-
when(connection.getMetaData().getColumns("testCatalog", inputTableName.getSchemaName(), inputTableName.getTableName(), null)).thenReturn(resultSet2);
405+
when(connection.getCatalog()).thenReturn(TEST_CATALOG);
406+
when(connection.getMetaData().getColumns(TEST_CATALOG, inputTableName.getSchemaName(), inputTableName.getTableName(), null)).thenReturn(resultSet2);
407407

408408
GetTableResponse getTableResponse = this.synapseMetadataHandler.doGetTable(
409-
blockAllocator, new GetTableRequest(this.federatedIdentity, TEST_QUERY_ID, "testCatalog", inputTableName, Collections.emptyMap()));
409+
blockAllocator, new GetTableRequest(this.federatedIdentity, TEST_QUERY_ID, TEST_CATALOG, inputTableName, Collections.emptyMap()));
410410
assertEquals(expected, getTableResponse.getSchema());
411411
assertEquals(inputTableName, getTableResponse.getTableName());
412-
assertEquals("testCatalog", getTableResponse.getCatalogName());
412+
assertEquals(TEST_CATALOG, getTableResponse.getCatalogName());
413413
}
414414

415415
@Test
@@ -436,20 +436,20 @@ public void doDataTypeConversion()
436436
when(connection.getMetaData().getURL()).thenReturn("jdbc:sqlserver://hostname-ondemand;databaseName=fakedatabase");
437437

438438
TableName inputTableName = new TableName(TEST_SCHEMA, TEST_TABLE);
439-
when(connection.getCatalog()).thenReturn("testCatalog");
440-
when(connection.getMetaData().getColumns("testCatalog", inputTableName.getSchemaName(), inputTableName.getTableName(), null)).thenReturn(resultSet2);
439+
when(connection.getCatalog()).thenReturn(TEST_CATALOG);
440+
when(connection.getMetaData().getColumns(TEST_CATALOG, inputTableName.getSchemaName(), inputTableName.getTableName(), null)).thenReturn(resultSet2);
441441

442442
GetTableResponse getTableResponse = this.synapseMetadataHandler.doGetTable(
443-
blockAllocator, new GetTableRequest(this.federatedIdentity, TEST_QUERY_ID, "testCatalog", inputTableName, Collections.emptyMap()));
443+
blockAllocator, new GetTableRequest(this.federatedIdentity, TEST_QUERY_ID, TEST_CATALOG, inputTableName, Collections.emptyMap()));
444444
assertEquals(inputTableName, getTableResponse.getTableName());
445-
assertEquals("testCatalog", getTableResponse.getCatalogName());
445+
assertEquals(TEST_CATALOG, getTableResponse.getCatalogName());
446446
}
447447

448448
@Test
449449
public void doListTables() throws Exception
450450
{
451451
BlockAllocator blockAllocator = new BlockAllocatorImpl();
452-
ListTablesRequest listTablesRequest = new ListTablesRequest(federatedIdentity, TEST_QUERY_ID, "testCatalog", TEST_SCHEMA, null, 3);
452+
ListTablesRequest listTablesRequest = new ListTablesRequest(federatedIdentity, TEST_QUERY_ID, TEST_CATALOG, TEST_SCHEMA, null, 3);
453453

454454
DatabaseMetaData mockDatabaseMetaData = mock(DatabaseMetaData.class);
455455
ResultSet mockResultSet = mock(ResultSet.class);
@@ -589,15 +589,15 @@ public void testDoDataTypeConversion_withAzureServerless() throws Exception {
589589
when(connection.getMetaData().getURL()).thenReturn("jdbc:sqlserver://test-ondemand.sql.azuresynapse.net;databaseName=fakedatabase");
590590

591591
TableName inputTableName = new TableName(TEST_SCHEMA, TEST_TABLE);
592-
when(connection.getCatalog()).thenReturn("testCatalog");
592+
when(connection.getCatalog()).thenReturn(TEST_CATALOG);
593593

594594
GetTableResponse getTableResponse = this.synapseMetadataHandler.doGetTable(
595-
blockAllocator, new GetTableRequest(this.federatedIdentity, TEST_QUERY_ID, "testCatalog", inputTableName, Collections.emptyMap()));
595+
blockAllocator, new GetTableRequest(this.federatedIdentity, TEST_QUERY_ID, TEST_CATALOG, inputTableName, Collections.emptyMap()));
596596

597597
// Compare schemas ignoring order
598598
assertTrue("Schemas do not match when ignoring order", schemasMatchIgnoringOrder(expected, getTableResponse.getSchema()));
599599
assertEquals(inputTableName, getTableResponse.getTableName());
600-
assertEquals("testCatalog", getTableResponse.getCatalogName());
600+
assertEquals(TEST_CATALOG, getTableResponse.getCatalogName());
601601

602602
}
603603

athena-synapse/src/test/java/com/amazonaws/athena/connectors/synapse/SynapseRecordHandlerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ private Split mockSplitWithPartitionProperties(String from, String to, String pa
153153
ImmutableMap<String, String> properties = ImmutableMap.of(
154154
SynapseMetadataHandler.PARTITION_BOUNDARY_FROM, from,
155155
SynapseMetadataHandler.PARTITION_NUMBER, partitionNumber,
156-
SynapseMetadataHandler.PARTITION_COLUMN, SynapseRecordHandlerTest.TEST_COL1,
156+
SynapseMetadataHandler.PARTITION_COLUMN, TEST_COL1,
157157
SynapseMetadataHandler.PARTITION_BOUNDARY_TO, to
158158
);
159159
when(split.getProperties()).thenReturn(properties);
160160
when(split.getProperty(eq(SynapseMetadataHandler.PARTITION_BOUNDARY_FROM))).thenReturn(from);
161161
when(split.getProperty(eq(SynapseMetadataHandler.PARTITION_NUMBER))).thenReturn(partitionNumber);
162-
when(split.getProperty(eq(SynapseMetadataHandler.PARTITION_COLUMN))).thenReturn(SynapseRecordHandlerTest.TEST_COL1);
162+
when(split.getProperty(eq(SynapseMetadataHandler.PARTITION_COLUMN))).thenReturn(TEST_COL1);
163163
when(split.getProperty(eq(SynapseMetadataHandler.PARTITION_BOUNDARY_TO))).thenReturn(to);
164164
return split;
165165
}
@@ -168,7 +168,7 @@ private ValueSet getSingleValueSet()
168168
{
169169
Range range = Mockito.mock(Range.class, Mockito.RETURNS_DEEP_STUBS);
170170
when(range.isSingleValue()).thenReturn(true);
171-
when(range.getLow().getValue()).thenReturn(SynapseRecordHandlerTest.TEST_VARCHAR_VALUE);
171+
when(range.getLow().getValue()).thenReturn(TEST_VARCHAR_VALUE);
172172
ValueSet valueSet = Mockito.mock(SortedRangeSet.class, Mockito.RETURNS_DEEP_STUBS);
173173
when(valueSet.getRanges().getOrderedRanges()).thenReturn(Collections.singletonList(range));
174174
return valueSet;

0 commit comments

Comments
 (0)