Skip to content
This repository was archived by the owner on Dec 7, 2023. It is now read-only.

Update dependency for JDBC application #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 6 additions & 24 deletions jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>software.amazon.timestream</groupId>
<artifactId>amazon-timestream-jdbc</artifactId>
<version>2.0.0</version>
Expand All @@ -30,6 +29,12 @@
</license>
</licenses>

<parent>
<groupId>software.amazon.timestream</groupId>
<artifactId>timestream</artifactId>
<version>2.0.0</version>
</parent>

<scm>
<connection>scm:git:git://github.com:awslabs/amazon-timestream-driver-jdbc.git</connection>
<url>https://github.com/awslabs/amazon-timestream-driver-jdbc/tree/main</url>
Expand All @@ -54,11 +59,6 @@
</distributionManagement>

<properties>
<!-- Optionally specify a compiler here, we chose Java 8 -->
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- Version properties are written out to be picked up by the driver. -->
<driver.major.version>2</driver.major.version>
<driver.minor.version>0</driver.minor.version>
Expand All @@ -67,15 +67,6 @@

<!-- Set the timezone information for unit tests. -->
<argLine>-Duser.timezone=Europe/Paris</argLine>

<!-- Dependency versions -->
<awssdk.version>1.12.512</awssdk.version>
<guava.version>32.0.0-jre</guava.version>
<junit.jupiter.version>5.6.2</junit.jupiter.version>
<jsoup.version>1.16.1</jsoup.version>
<mockito.version>2.28.2</mockito.version>
<slf4j.version>1.7.24</slf4j.version>
<timestream.version>1.11.872</timestream.version>
</properties>

<profiles>
Expand Down Expand Up @@ -105,49 +96,40 @@
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>${awssdk.version}</version>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should dependency be loaded from the parent as well?

</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-sts</artifactId>
<version>${awssdk.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-timestreamquery</artifactId>
<version>${timestream.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>${jsoup.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public class TimestreamColumnsResultSet extends TimestreamBaseResultSet {
TimestreamDataType.createColumnInfo(TimestreamDataType.VARCHAR, "IS_GENERATEDCOLUMN"));

/* Index of table schema value in the resultSet returned from getTables() */
private final int TABLE_SCHEM_INDX = 2;
private static final int TABLE_SCHEM_INDX = 2;
/* Index of table name value in the resultSet returned from getTables() */
private final int TABLE_NAME_INDX = 3;
private static final int TABLE_NAME_INDX = 3;

private final TimestreamStatement statement;
private ResultSet result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public String getCatalogTerm() {
}

@Override
public ResultSet getCatalogs(){
public ResultSet getCatalogs() {
LOGGER.debug("Catalogs are not supported. Returning an empty result set.");
return new TimestreamDatabasesResultSet();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ void init() throws SQLException {

/**
* Checks that an empty result set is returned for getCatalogs
*
* @throws SQLException The method can throw an SQLException
*/
@Test
void testGetCatalogsWithResult() throws SQLException {
Expand All @@ -69,6 +71,8 @@ void testGetCatalogsWithResult() throws SQLException {

/**
* Checks that all result sets are returned for getSchemas with no parameters
*
* @throws SQLException The method can throw an SQLException
*/
@Test
void testGetSchemasWithResult() throws SQLException {
Expand All @@ -82,6 +86,8 @@ void testGetSchemasWithResult() throws SQLException {

/**
* Checks that all result sets are returned for getSchemas with null parameters
*
* @throws SQLException The method can throw an SQLException
*/
@Test
void testGetSchemasNullParamWithResult() throws SQLException {
Expand All @@ -97,6 +103,8 @@ void testGetSchemasNullParamWithResult() throws SQLException {
* Checks that all result sets are returned for getSchemas with schemaPattern
* @param schemaPattern Schema pattern to be tested
* @param expectedValue Expected resultset number
*
* @throws SQLException The method can throw an SQLException
*/
@ParameterizedTest
@CsvSource(value = {
Expand All @@ -117,6 +125,8 @@ void testGetSchemasWithSchemaPattern(String schemaPattern, int expectedValue) th
/**
* Checks that nothing could be returned for invalid schema
* @param schemaPattern Schema pattern to be tested
*
* @throws SQLException The method can throw an SQLException
*/
@ParameterizedTest
@ValueSource(strings = {"invalidDB"})
Expand All @@ -130,17 +140,19 @@ void testGetSchemasWithInvalidSchemaPattern(String schemaPattern) throws SQLExce

/**
* Checks that exception "access denied" could be thrown
*
* @throws SQLException The method can throw an SQLException
*/
@Test
void testGetSchemasWithResultException() throws SQLException {
initializeWithResultException();

try {
ResultSet resultSet = dbMetaData.getSchemas();
dbMetaData.getSchemas();
Assertions.fail("unexpected success");
} catch (AmazonTimestreamQueryException ae) {
Assertions.assertEquals(ae.getErrorMessage(), "access denied");
} catch(Exception e) {
} catch (Exception e) {
Assertions.fail("unexpected exception " + e.getMessage());
}
}
Expand Down Expand Up @@ -242,6 +254,8 @@ void testGetTablesWithResult() throws SQLException {

/**
* Checks that empty result set is returned for empty database
*
* @throws SQLException The method can throw an SQLException
*/
@Test
void testGetTablesWithEmptyDatabase() throws SQLException {
Expand Down
20 changes: 16 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<awssdk.version>1.11.870</awssdk.version>
<guava.version>32.0.0-jre</guava.version>
<awssdk.version>1.12.530</awssdk.version>
<guava.version>32.1.2-jre</guava.version>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will declaring versions as a property work with Dependabot?

<junit.jupiter.version>5.6.2</junit.jupiter.version>
<jsoup.version>1.15.3</jsoup.version>
<jsoup.version>1.16.1</jsoup.version>
<maven.install.version>3.0.0-M1</maven.install.version>
<mockito.version>2.28.2</mockito.version>
<slf4j.version>1.7.24</slf4j.version>
<timestream.version>1.11.872</timestream.version>
<timestream.version>1.12.530</timestream.version>
<timestream.jdbc.version>2.0.0</timestream.jdbc.version>
</properties>

Expand Down Expand Up @@ -90,6 +90,18 @@
<artifactId>junit-jupiter</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
<dependency>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to remove this dependency from the child pom since it's been added to the parent?

<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>software.amazon.timestream</groupId>
<artifactId>amazon-timestream-jdbc</artifactId>
Expand Down