Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
nineinchnick committed Jan 12, 2024
1 parent a8ddfed commit 144bfd6
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 160 deletions.
59 changes: 20 additions & 39 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
</distributionManagement>

<properties>
<project.build.targetJdk>17</project.build.targetJdk>
<air.java.version>17.0.6</air.java.version>
<project.build.targetJdk>21</project.build.targetJdk>
<air.java.version>21.0.1</air.java.version>

<air.main.basedir>${project.basedir}</air.main.basedir>

Expand All @@ -47,23 +47,22 @@
<air.check.fail-checkstyle>true</air.check.fail-checkstyle>
<air.check.skip-checkstyle>false</air.check.skip-checkstyle>

<dep.trino.version>435</dep.trino.version>
<dep.trino.version>436</dep.trino.version>
<dep.airlift.version>239</dep.airlift.version>
<dep.slice.version>2.2</dep.slice.version>
<dep.opentelemetry.version>1.33.0</dep.opentelemetry.version>
<dep.opentelemetry.version>1.34.1</dep.opentelemetry.version>
<dep.opentelemetry-instrumentation.version>1.32.0</dep.opentelemetry-instrumentation.version>
<dep.packaging.version>${dep.airlift.version}</dep.packaging.version>
<dep.guava.version>32.1.3-jre</dep.guava.version>
<dep.guava.version>33.0.0-jre</dep.guava.version>
<dep.guice.version>7.0.0</dep.guice.version>
<dep.errorprone.version>2.23.0</dep.errorprone.version>
<dep.jackson.version>2.16.0</dep.jackson.version>
<dep.testng.version>7.8.0</dep.testng.version>
<dep.joda.version>2.12.5</dep.joda.version>
<dep.errorprone.version>2.24.1</dep.errorprone.version>
<dep.jackson.version>2.16.1</dep.jackson.version>
<dep.joda.version>2.12.6</dep.joda.version>
<dep.junit.version>5.10.1</dep.junit.version>
<dep.slf4j.version>2.0.9</dep.slf4j.version>
<dep.assertj-core.version>3.24.2</dep.assertj-core.version>
<dep.slf4j.version>2.0.11</dep.slf4j.version>
<dep.assertj-core.version>3.25.1</dep.assertj-core.version>
<dep.logback.version>1.4.14</dep.logback.version>
<dep.plugin.surefire.version>3.1.2</dep.plugin.surefire.version>
<dep.plugin.surefire.version>3.2.5</dep.plugin.surefire.version>

<air.javadoc.lint>-missing</air.javadoc.lint>
<project.scm.id>github</project.scm.id>
Expand All @@ -81,7 +80,7 @@
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-bom</artifactId>
<version>1.9.21</version>
<version>1.9.22</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -248,9 +247,14 @@
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${dep.testng.version}</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -339,29 +343,6 @@
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<!-- allow both JUnit and TestNG -->
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>${dep.plugin.surefire.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${dep.junit.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
10 changes: 5 additions & 5 deletions src/test/java/pl/net/was/trino/git/TestGitClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.testng.annotations.Test;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
Expand All @@ -28,18 +28,18 @@
import java.nio.file.Path;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.TimeZone;

import static org.testng.Assert.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;

public class TestGitClient
{
@Test
public void testMetadata()
{
GitClient client = new GitClient(new GitConfig());
assertEquals(client.getSchemaNames(), List.of("default"));
assertThat(client.getSchemaNames()).isEqualTo(Set.of("default"));
}

public static void setupRepo(URI uri)
Expand All @@ -63,7 +63,7 @@ public static void setupRepo(URI uri)
Repository repository = FileRepositoryBuilder.create(new File(localPath, ".git"));
repository.create();

// create a new file file
// create a new file
File myFile = new File(repository.getDirectory().getParent(), "testfile");
if (!myFile.createNewFile()) {
throw new IOException("Could not create file " + myFile);
Expand Down
106 changes: 50 additions & 56 deletions src/test/java/pl/net/was/trino/git/TestGitMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
import io.trino.spi.connector.TableNotFoundException;
import io.trino.spi.type.ArrayType;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;

import java.io.IOException;
import java.net.URI;
Expand All @@ -37,17 +39,16 @@
import static io.trino.spi.type.VarcharType.createUnboundedVarcharType;
import static io.trino.testing.TestingConnectorSession.SESSION;
import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.fail;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.fail;

@Test(singleThreaded = true)
@Execution(ExecutionMode.SAME_THREAD)
public class TestGitMetadata
{
private GitTableHandle commitsTableHandle;
private GitMetadata metadata;

@BeforeMethod
@BeforeEach
public void setUp()
throws IOException, GitAPIException, URISyntaxException
{
Expand All @@ -71,27 +72,25 @@ public void testListSchemaNames()
@Test
public void testGetTableHandle()
{
assertNull(metadata.getTableHandle(SESSION, new SchemaTableName("example", "unknown")));
assertNull(metadata.getTableHandle(SESSION, new SchemaTableName("unknown", "numbers")));
assertNull(metadata.getTableHandle(SESSION, new SchemaTableName("unknown", "unknown")));
assertThat(metadata.getTableHandle(SESSION, new SchemaTableName("example", "unknown"))).isNull();
assertThat(metadata.getTableHandle(SESSION, new SchemaTableName("unknown", "numbers"))).isNull();
assertThat(metadata.getTableHandle(SESSION, new SchemaTableName("unknown", "unknown"))).isNull();
}

@Test
public void testGetColumnHandles()
{
// known table
assertEquals(
metadata.getColumnHandles(SESSION, commitsTableHandle),
Map.of(
"object_id", new GitColumnHandle("object_id", createUnboundedVarcharType(), 0),
"author_name", new GitColumnHandle("author_name", createUnboundedVarcharType(), 1),
"author_email", new GitColumnHandle("author_email", createUnboundedVarcharType(), 2),
"committer_name", new GitColumnHandle("committer_name", createUnboundedVarcharType(), 3),
"committer_email", new GitColumnHandle("committer_email", createUnboundedVarcharType(), 4),
"message", new GitColumnHandle("message", createUnboundedVarcharType(), 5),
"parents", new GitColumnHandle("parents", new ArrayType(createUnboundedVarcharType()), 6),
"tree_id", new GitColumnHandle("tree_id", createUnboundedVarcharType(), 7),
"commit_time", new GitColumnHandle("commit_time", createTimestampWithTimeZoneType(0), 8)));
assertThat(metadata.getColumnHandles(SESSION, commitsTableHandle)).isEqualTo(Map.of(
"object_id", new GitColumnHandle("object_id", createUnboundedVarcharType(), 0),
"author_name", new GitColumnHandle("author_name", createUnboundedVarcharType(), 1),
"author_email", new GitColumnHandle("author_email", createUnboundedVarcharType(), 2),
"committer_name", new GitColumnHandle("committer_name", createUnboundedVarcharType(), 3),
"committer_email", new GitColumnHandle("committer_email", createUnboundedVarcharType(), 4),
"message", new GitColumnHandle("message", createUnboundedVarcharType(), 5),
"parents", new GitColumnHandle("parents", new ArrayType(createUnboundedVarcharType()), 6),
"tree_id", new GitColumnHandle("tree_id", createUnboundedVarcharType(), 7),
"commit_time", new GitColumnHandle("commit_time", createTimestampWithTimeZoneType(0), 8)));

// unknown table
try {
Expand All @@ -107,39 +106,35 @@ public void getTableMetadata()
{
// known table
ConnectorTableMetadata tableMetadata = metadata.getTableMetadata(SESSION, commitsTableHandle);
assertEquals(tableMetadata.getTable().getSchemaName(), "default");
assertEquals(
tableMetadata.getColumns(),
List.of(
new ColumnMetadata("object_id", createUnboundedVarcharType()),
new ColumnMetadata("author_name", createUnboundedVarcharType()),
new ColumnMetadata("author_email", createUnboundedVarcharType()),
new ColumnMetadata("committer_name", createUnboundedVarcharType()),
new ColumnMetadata("committer_email", createUnboundedVarcharType()),
new ColumnMetadata("message", createUnboundedVarcharType()),
new ColumnMetadata("parents", new ArrayType(createUnboundedVarcharType())),
new ColumnMetadata("tree_id", createUnboundedVarcharType()),
new ColumnMetadata("commit_time", createTimestampWithTimeZoneType(0))));
assertThat(tableMetadata.getTable().getSchemaName()).isEqualTo("default");
assertThat(tableMetadata.getColumns()).isEqualTo(List.of(
new ColumnMetadata("object_id", createUnboundedVarcharType()),
new ColumnMetadata("author_name", createUnboundedVarcharType()),
new ColumnMetadata("author_email", createUnboundedVarcharType()),
new ColumnMetadata("committer_name", createUnboundedVarcharType()),
new ColumnMetadata("committer_email", createUnboundedVarcharType()),
new ColumnMetadata("message", createUnboundedVarcharType()),
new ColumnMetadata("parents", new ArrayType(createUnboundedVarcharType())),
new ColumnMetadata("tree_id", createUnboundedVarcharType()),
new ColumnMetadata("commit_time", createTimestampWithTimeZoneType(0))));

// unknown tables should produce null
assertNull(metadata.getTableMetadata(SESSION, new GitTableHandle("unknown", "unknown", Optional.empty(), OptionalLong.empty())));
assertNull(metadata.getTableMetadata(SESSION, new GitTableHandle("example", "unknown", Optional.empty(), OptionalLong.empty())));
assertNull(metadata.getTableMetadata(SESSION, new GitTableHandle("unknown", "numbers", Optional.empty(), OptionalLong.empty())));
assertThat(metadata.getTableMetadata(SESSION, new GitTableHandle("unknown", "unknown", Optional.empty(), OptionalLong.empty()))).isNull();
assertThat(metadata.getTableMetadata(SESSION, new GitTableHandle("example", "unknown", Optional.empty(), OptionalLong.empty()))).isNull();
assertThat(metadata.getTableMetadata(SESSION, new GitTableHandle("unknown", "numbers", Optional.empty(), OptionalLong.empty()))).isNull();
}

@Test
public void testListTables()
{
// all schemas
assertEquals(
Set.copyOf(metadata.listTables(SESSION, Optional.empty())),
Set.of(
new SchemaTableName("default", "commits"),
new SchemaTableName("default", "branches"),
new SchemaTableName("default", "diff_stats"),
new SchemaTableName("default", "objects"),
new SchemaTableName("default", "tags"),
new SchemaTableName("default", "trees")));
assertThat(Set.copyOf(metadata.listTables(SESSION, Optional.empty()))).isEqualTo(Set.of(
new SchemaTableName("default", "commits"),
new SchemaTableName("default", "branches"),
new SchemaTableName("default", "diff_stats"),
new SchemaTableName("default", "objects"),
new SchemaTableName("default", "tags"),
new SchemaTableName("default", "trees")));

// unknown schema
try {
Expand All @@ -153,10 +148,9 @@ public void testListTables()
@Test
public void getColumnMetadata()
{
assertEquals(
metadata.getColumnMetadata(SESSION, commitsTableHandle,
new GitColumnHandle("text", createUnboundedVarcharType(), 0)),
new ColumnMetadata("text", createUnboundedVarcharType()));
ColumnMetadata actualColumn = metadata.getColumnMetadata(SESSION, commitsTableHandle,
new GitColumnHandle("text", createUnboundedVarcharType(), 0));
assertThat(actualColumn).isEqualTo(new ColumnMetadata("text", createUnboundedVarcharType()));

// example connector assumes that the table handle and column handle are
// properly formed, so it will return a metadata object for any
Expand All @@ -165,20 +159,20 @@ public void getColumnMetadata()
// directly.
}

@Test(expectedExceptions = TrinoException.class)
@Test
public void testCreateTable()
{
metadata.createTable(
assertThatThrownBy(() -> metadata.createTable(
SESSION,
new ConnectorTableMetadata(
new SchemaTableName("example", "foo"),
List.of(new ColumnMetadata("text", createUnboundedVarcharType()))),
false);
false)).isInstanceOf(TrinoException.class);
}

@Test(expectedExceptions = TrinoException.class)
@Test
public void testDropTableTable()
{
metadata.dropTable(SESSION, commitsTableHandle);
assertThatThrownBy(() -> metadata.dropTable(SESSION, commitsTableHandle)).isInstanceOf(TrinoException.class);
}
}
Loading

0 comments on commit 144bfd6

Please sign in to comment.