From 32bce07de032466067ea066e51c7fa9ff11621a9 Mon Sep 17 00:00:00 2001 From: dkovalenkoI <137103092+dkovalenkoI@users.noreply.github.com> Date: Thu, 17 Aug 2023 10:48:44 -0700 Subject: [PATCH] update dependency and add parent to jdbc, fix checkstyles error --- jdbc/pom.xml | 30 ++++--------------- .../jdbc/TimestreamColumnsResultSet.java | 4 +-- .../jdbc/TimestreamDatabaseMetaData.java | 2 +- .../jdbc/TimestreamDatabaseMetaDataTest.java | 18 +++++++++-- pom.xml | 20 ++++++++++--- 5 files changed, 41 insertions(+), 33 deletions(-) diff --git a/jdbc/pom.xml b/jdbc/pom.xml index f774e2a..d0d4142 100644 --- a/jdbc/pom.xml +++ b/jdbc/pom.xml @@ -14,7 +14,6 @@ --> 4.0.0 - software.amazon.timestream amazon-timestream-jdbc 2.0.0 @@ -30,6 +29,12 @@ + + software.amazon.timestream + timestream + 2.0.0 + + scm:git:git://github.com:awslabs/amazon-timestream-driver-jdbc.git https://github.com/awslabs/amazon-timestream-driver-jdbc/tree/main @@ -54,11 +59,6 @@ - - 1.8 - 1.8 - UTF-8 - 2 0 @@ -67,15 +67,6 @@ -Duser.timezone=Europe/Paris - - - 1.12.512 - 32.0.0-jre - 5.6.2 - 1.16.1 - 2.28.2 - 1.7.24 - 1.11.872 @@ -105,49 +96,40 @@ com.amazonaws aws-java-sdk-core - ${awssdk.version} com.amazonaws aws-java-sdk-sts - ${awssdk.version} com.amazonaws aws-java-sdk-timestreamquery - ${timestream.version} com.google.guava guava - ${guava.version} org.slf4j jul-to-slf4j - ${slf4j.version} org.jsoup jsoup - ${jsoup.version} org.junit.jupiter junit-jupiter - ${junit.jupiter.version} test org.mockito mockito-core - ${mockito.version} test org.mockito mockito-inline - ${mockito.version} test diff --git a/jdbc/src/main/java/software/amazon/timestream/jdbc/TimestreamColumnsResultSet.java b/jdbc/src/main/java/software/amazon/timestream/jdbc/TimestreamColumnsResultSet.java index 45a2169..555e06f 100644 --- a/jdbc/src/main/java/software/amazon/timestream/jdbc/TimestreamColumnsResultSet.java +++ b/jdbc/src/main/java/software/amazon/timestream/jdbc/TimestreamColumnsResultSet.java @@ -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; diff --git a/jdbc/src/main/java/software/amazon/timestream/jdbc/TimestreamDatabaseMetaData.java b/jdbc/src/main/java/software/amazon/timestream/jdbc/TimestreamDatabaseMetaData.java index 1d5c948..4f417a1 100644 --- a/jdbc/src/main/java/software/amazon/timestream/jdbc/TimestreamDatabaseMetaData.java +++ b/jdbc/src/main/java/software/amazon/timestream/jdbc/TimestreamDatabaseMetaData.java @@ -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(); } diff --git a/jdbc/src/test/java/software/amazon/timestream/jdbc/TimestreamDatabaseMetaDataTest.java b/jdbc/src/test/java/software/amazon/timestream/jdbc/TimestreamDatabaseMetaDataTest.java index 03e79e5..f42cdab 100644 --- a/jdbc/src/test/java/software/amazon/timestream/jdbc/TimestreamDatabaseMetaDataTest.java +++ b/jdbc/src/test/java/software/amazon/timestream/jdbc/TimestreamDatabaseMetaDataTest.java @@ -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 { @@ -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 { @@ -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 { @@ -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 = { @@ -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"}) @@ -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()); } } @@ -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 { diff --git a/pom.xml b/pom.xml index 7d4efed..c1dd640 100644 --- a/pom.xml +++ b/pom.xml @@ -32,14 +32,14 @@ 1.8 UTF-8 - 1.11.870 - 32.0.0-jre + 1.12.530 + 32.1.2-jre 5.6.2 - 1.15.3 + 1.16.1 3.0.0-M1 2.28.2 1.7.24 - 1.11.872 + 1.12.530 2.0.0 @@ -90,6 +90,18 @@ junit-jupiter ${junit.jupiter.version} + + org.mockito + mockito-core + ${mockito.version} + test + + + org.mockito + mockito-inline + ${mockito.version} + test + software.amazon.timestream amazon-timestream-jdbc