Skip to content

Commit

Permalink
Simplify extensability of BaseHiveConnectorTest
Browse files Browse the repository at this point in the history
  • Loading branch information
losipiuk committed Jan 24, 2022
1 parent ff8efb2 commit c36a280
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,14 @@ public abstract class BaseHiveConnectorTest
private static final DateTimeFormatter TIMESTAMP_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSSSS");
private final String catalog;
private final Session bucketedSession;
private final Map<String, String> extraProperties;

protected BaseHiveConnectorTest(Map<String, String> extraProperties)
protected BaseHiveConnectorTest()
{
this.catalog = HIVE_CATALOG;
this.bucketedSession = createBucketedSession(Optional.of(new SelectedRole(ROLE, Optional.of("admin"))));
this.extraProperties = ImmutableMap.copyOf(requireNonNull(extraProperties, "extraProperties is null"));
}

@Override
protected final QueryRunner createQueryRunner()
protected static QueryRunner createHiveQueryRunner(Map<String, String> extraProperties)
throws Exception
{
DistributedQueryRunner queryRunner = HiveQueryRunner.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@
package io.trino.plugin.hive;

import io.trino.testing.FaultTolerantExecutionConnectorTestHelper;
import io.trino.testing.QueryRunner;

import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class TestHiveFaultTolerantExecutionConnectorTest
extends BaseHiveConnectorTest
{
public TestHiveFaultTolerantExecutionConnectorTest()
@Override
protected QueryRunner createQueryRunner()
throws Exception
{
super(FaultTolerantExecutionConnectorTestHelper.getExtraProperties());
return BaseHiveConnectorTest.createHiveQueryRunner(FaultTolerantExecutionConnectorTestHelper.getExtraProperties());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@
package io.trino.plugin.hive;

import com.google.common.collect.ImmutableMap;
import io.trino.testing.QueryRunner;

public class TestHivePipelinedExecutionConnectorTest
extends BaseHiveConnectorTest
{
public TestHivePipelinedExecutionConnectorTest()
@Override
protected QueryRunner createQueryRunner()
throws Exception
{
super(ImmutableMap.of());
return BaseHiveConnectorTest.createHiveQueryRunner(ImmutableMap.of());
}
}

0 comments on commit c36a280

Please sign in to comment.