Skip to content

Commit

Permalink
Fix checkstyle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Vamsi committed Feb 13, 2025
1 parent 619672e commit a15a7b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.thrift.TException;
import org.apache.xtable.catalog.CatalogPartition;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.junit.jupiter.MockitoExtension;

import org.apache.xtable.catalog.CatalogPartition;
import org.apache.xtable.catalog.CatalogPartitionSyncOperations;
import org.apache.xtable.exception.CatalogSyncException;

Expand Down Expand Up @@ -112,8 +112,10 @@ void testGetAllPartitions() {
void testAddPartitionsToTableSuccess() throws Exception {
setupCommonMocks();
when(mockHMSCatalogConfig.getMaxPartitionsPerRequest()).thenReturn(100);
CatalogPartition partition1 = new CatalogPartition(Collections.singletonList("value1"), "location1");
CatalogPartition partition2 = new CatalogPartition(Collections.singletonList("value2"), "location2");
CatalogPartition partition1 =
new CatalogPartition(Collections.singletonList("value1"), "location1");
CatalogPartition partition2 =
new CatalogPartition(Collections.singletonList("value2"), "location2");
List<CatalogPartition> partitionsToAdd = Arrays.asList(partition1, partition2);

StorageDescriptor tableSd = new StorageDescriptor();
Expand Down Expand Up @@ -160,7 +162,8 @@ void testAddPartitionsToTableSuccess() throws Exception {
void testAddPartitionsToTableThrowsException() throws Exception {
setupCommonMocks();
List<CatalogPartition> partitionsToAdd =
Collections.singletonList(new CatalogPartition(Collections.singletonList("value1"), "location1"));
Collections.singletonList(
new CatalogPartition(Collections.singletonList("value1"), "location1"));

when(mockMetaStoreClient.getTable(
TEST_CATALOG_TABLE_IDENTIFIER.getDatabaseName(),
Expand All @@ -187,8 +190,10 @@ void testAddPartitionsToTableThrowsException() throws Exception {
void testUpdatePartitionsToTableSuccess() throws Exception {
setupCommonMocks();

CatalogPartition changedPartition1 = new CatalogPartition(Collections.singletonList("value1"), "location1");
CatalogPartition changedPartition2 = new CatalogPartition(Collections.singletonList("value2"), "location2");
CatalogPartition changedPartition1 =
new CatalogPartition(Collections.singletonList("value1"), "location1");
CatalogPartition changedPartition2 =
new CatalogPartition(Collections.singletonList("value2"), "location2");
List<CatalogPartition> changedPartitions = Arrays.asList(changedPartition1, changedPartition2);

StorageDescriptor tableSd = new StorageDescriptor();
Expand Down Expand Up @@ -244,7 +249,8 @@ void testUpdatePartitionsToTableSuccess() throws Exception {
@Test
void testUpdatePartitionsToTableThrowsException() throws Exception {
setupCommonMocks();
CatalogPartition changedPartition = new CatalogPartition(Collections.singletonList("value1"), "location1");
CatalogPartition changedPartition =
new CatalogPartition(Collections.singletonList("value1"), "location1");

when(mockMetaStoreClient.getTable(
TEST_CATALOG_TABLE_IDENTIFIER.getDatabaseName(),
Expand Down Expand Up @@ -274,8 +280,10 @@ void testUpdatePartitionsToTableThrowsException() throws Exception {
void testDropPartitionsSuccess() throws Exception {
setupCommonMocks();

CatalogPartition partition1 = new CatalogPartition(Collections.singletonList("value1"), "location1");
CatalogPartition partition2 = new CatalogPartition(Collections.singletonList("value2"), "location2");
CatalogPartition partition1 =
new CatalogPartition(Collections.singletonList("value1"), "location1");
CatalogPartition partition2 =
new CatalogPartition(Collections.singletonList("value2"), "location2");
List<CatalogPartition> partitionsToDrop = Arrays.asList(partition1, partition2);

// Execute the method
Expand Down Expand Up @@ -314,7 +322,8 @@ void testDropPartitionsEmptyList() throws Exception {
void testDropPartitionsThrowsException() throws Exception {
setupCommonMocks();

CatalogPartition partition1 = new CatalogPartition(Collections.singletonList("value1"), "location1");
CatalogPartition partition1 =
new CatalogPartition(Collections.singletonList("value1"), "location1");
List<CatalogPartition> partitionsToDrop = Collections.singletonList(partition1);

doThrow(new TException("Test exception"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.stream.Collectors;

import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.xtable.hudi.catalog.HudiCatalogTableUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
Expand All @@ -44,6 +43,7 @@
import org.apache.xtable.hms.HMSCatalogSyncTestBase;
import org.apache.xtable.hms.HMSSchemaExtractor;
import org.apache.xtable.hudi.HudiTableManager;
import org.apache.xtable.hudi.catalog.HudiCatalogTableUtils;

@ExtendWith(MockitoExtension.class)
public class TestHudiHMSCatalogTableBuilder extends HMSCatalogSyncTestBase {
Expand Down

0 comments on commit a15a7b7

Please sign in to comment.