diff --git a/Jenkinsfile b/Jenkinsfile index a85b2753..e3e6e7fb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -164,15 +164,6 @@ pipeline { ''' } } - stage('Stock JDBC tests') { - agent { label 'medium' } - steps { - checkout scm - sh ''' - (cd tests/client_tests/stock_jdbc && ./gradlew test) - ''' - } - } stage('Rust client tests') { agent { dockerfile { diff --git a/tests/client_tests/stock_jdbc/build.gradle b/tests/client_tests/stock_jdbc/build.gradle deleted file mode 100644 index 70080790..00000000 --- a/tests/client_tests/stock_jdbc/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -plugins { - id 'java-library' - id 'idea' -} - -repositories { - mavenCentral() -} - -dependencies { - testImplementation 'junit:junit:4.12' - testImplementation 'org.postgresql:postgresql:42.2.9' - testImplementation 'org.hamcrest:hamcrest:2.1' - testImplementation 'io.crate:crate-testing:0.9.0' -} - -test { - useJUnit() - testLogging { - exceptionFormat = 'full' - } -} diff --git a/tests/client_tests/stock_jdbc/gradle/wrapper/gradle-wrapper.jar b/tests/client_tests/stock_jdbc/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index cc4fdc29..00000000 Binary files a/tests/client_tests/stock_jdbc/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/tests/client_tests/stock_jdbc/gradle/wrapper/gradle-wrapper.properties b/tests/client_tests/stock_jdbc/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 4c5803d1..00000000 --- a/tests/client_tests/stock_jdbc/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/tests/client_tests/stock_jdbc/gradlew b/tests/client_tests/stock_jdbc/gradlew deleted file mode 100755 index 2fe81a7d..00000000 --- a/tests/client_tests/stock_jdbc/gradlew +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -exec "$JAVACMD" "$@" diff --git a/tests/client_tests/stock_jdbc/gradlew.bat b/tests/client_tests/stock_jdbc/gradlew.bat deleted file mode 100644 index 9618d8d9..00000000 --- a/tests/client_tests/stock_jdbc/gradlew.bat +++ /dev/null @@ -1,100 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/tests/client_tests/stock_jdbc/settings.gradle b/tests/client_tests/stock_jdbc/settings.gradle deleted file mode 100644 index c3e9b403..00000000 --- a/tests/client_tests/stock_jdbc/settings.gradle +++ /dev/null @@ -1,10 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user manual at https://docs.gradle.org/6.0.1/userguide/multi_project_builds.html - */ - -rootProject.name = 'stock_jdbc' diff --git a/tests/client_tests/stock_jdbc/src/test/java/stock_jdbc/JdbcMetaDataTest.java b/tests/client_tests/stock_jdbc/src/test/java/stock_jdbc/JdbcMetaDataTest.java deleted file mode 100644 index 8a1ca592..00000000 --- a/tests/client_tests/stock_jdbc/src/test/java/stock_jdbc/JdbcMetaDataTest.java +++ /dev/null @@ -1,1238 +0,0 @@ -package stock_jdbc; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.RowIdLifetime; -import java.util.Map; - -import org.hamcrest.Matchers; -import org.junit.Assert; -import org.junit.ClassRule; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -import io.crate.testing.CrateTestCluster; - -@RunWith(JUnit4.class) -public class JdbcMetaDataTest { - - @ClassRule - public static final CrateTestCluster TEST_CLUSTER = CrateTestCluster - .fromURL("https://cdn.crate.io/downloads/releases/nightly/crate-latest.tar.gz") - .settings(Map.of("psql.port", 55432)) - .build(); - public static final String URL = "jdbc:postgresql://localhost:55432/doc?user=crate"; - - @Test - public void test_allProceduresAreCallable() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().allProceduresAreCallable(), is(true)); - } - } - - @Test - public void test_allTablesAreSelectable() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().allTablesAreSelectable(), is(true)); - } - } - - @Test - public void test_autoCommitFailureClosesAllResultSets() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().autoCommitFailureClosesAllResultSets(), is(false)); - } - } - - @Test - public void test_dataDefinitionCausesTransactionCommit_TODO() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().dataDefinitionCausesTransactionCommit(), is(false)); - } - } - - @Test - public void test_dataDefinitionIgnoredInTransactions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().dataDefinitionIgnoredInTransactions(), is(false)); - } - } - - @Test - public void test_deletesAreDetected() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().deletesAreDetected(ResultSet.TYPE_FORWARD_ONLY), is(false)); - } - } - - @Test - public void test_doesMaxRowSizeIncludeBlobs() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().doesMaxRowSizeIncludeBlobs(), is(false)); - } - } - - @Test - public void test_generatedKeyAlwaysReturned() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().generatedKeyAlwaysReturned(), is(true)); - } - } - - @Test - @Ignore("Not implemented in PostgreSQL JDBC") - public void test_getAttributes() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - conn.getMetaData().getAttributes("", "", "", ""); - } - } - - @Test - public void test_getBestRowIdentifier() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var result = conn.getMetaData().getBestRowIdentifier(null, "sys", "summits", DatabaseMetaData.bestRowSession, true); - assertThat(result.next(), is(true)); - } - } - - @Test - public void test_getCatalogSeparator() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getCatalogSeparator(), is(".")); - } - } - - @Test - public void test_getCatalogTerm() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getCatalogTerm(), is("database")); - } - } - - @Test - public void test_getCatalogs() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var result = conn.getMetaData().getCatalogs(); - assertThat(result.next(), is(true)); - assertThat(result.getString(1), is("doc")); - } - } - - @Test - public void test_getClientInfoProperties() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var result = conn.getMetaData().getClientInfoProperties(); - assertThat(result.next(), is(true)); - assertThat(result.getString(1), is("ApplicationName")); - } - } - - @Test - @Ignore("https://github.com/crate/crate/issues/9568") - public void test_getColumnPrivileges() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getColumnPrivileges("", "sys", "summits", ""); - assertThat(results.next(), is(true)); - } - } - - @Test - public void test_getColumns() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getColumns("", "sys", "summits", ""); - assertThat(results.next(), is(true)); - assertThat(results.getString(3), is("summits")); - assertThat(results.getString(4), is("classification")); - } - } - - @Test - public void test_getCrossReference() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getCrossReference("", "sys", "jobs", "", "sys", "jobs_log"); - assertThat(results.next(), is(false)); - } - } - - @Test - public void test_getDatabaseMajorVersion() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getDatabaseMajorVersion(), is(14)); - } - } - - @Test - public void test_getDatabaseMinorVersion() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getDatabaseMinorVersion(), is(0)); - } - } - - @Test - public void test_getDatabaseProductName() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getDatabaseProductName(), is("PostgreSQL")); - } - } - - @Test - public void test_getDatabaseProductVersion() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getDatabaseProductVersion(), is("14.0")); - } - } - - @Test - public void test_getDefaultTransactionIsolation() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getDefaultTransactionIsolation(), is(Connection.TRANSACTION_READ_COMMITTED)); - } - } - - @Test - public void test_getExportedKeys() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getExportedKeys("", "sys", "summits"); - assertThat(results.next(), is(false)); - } - } - - @Test - public void test_getExtraNameCharacters() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getExtraNameCharacters(), is("")); - } - } - - @Test - public void test_getFunctionColumns() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getFunctionColumns("", "", "substr", ""); - assertThat(results.next(), is(false)); - } - } - - @Test - public void test_getFunctions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getFunctions("", "", "current_schema"); - assertThat(results.next(), is(true)); - } - } - - @Test - public void test_getIdentifierQuoteString() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getIdentifierQuoteString(), is("\"")); - } - } - - @Test - public void test_getImportedKeys() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getImportedKeys("", "sys", "summits"); - assertThat(results.next(), is(false)); - } - } - - @Test - @Ignore("Blocked by https://github.com/crate/crate/issues/5463") - public void test_getIndexInfo() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getIndexInfo("", "sys", "summits", true, true); - assertThat(results.next(), is(false)); - } - } - - @Test - public void test_getMaxBinaryLiteralLength() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxBinaryLiteralLength(), is(0)); - } - } - - @Test - public void test_getMaxCatalogNameLength() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxCatalogNameLength(), is(63)); - } - } - - @Test - public void test_getMaxCharLiteralLength() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxCharLiteralLength(), is(0)); - } - } - - @Test - public void test_getMaxColumnNameLength() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxColumnNameLength(), is(63)); - } - } - - @Test - public void test_getMaxColumnsInGroupBy() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxColumnsInGroupBy(), is(0)); - } - } - - @Test - public void test_getMaxColumnsInIndex() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxColumnsInIndex(), is(32)); - } - } - - @Test - public void test_getMaxColumnsInOrderBy() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxColumnsInOrderBy(), is(0)); - } - } - - @Test - public void test_getMaxColumnsInSelect() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxColumnsInSelect(), is(0)); - } - } - - @Test - public void test_getMaxColumnsInTable() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxColumnsInTable(), is(1600)); - } - } - - @Test - public void test_getMaxConnections() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxConnections(), is(8192)); - } - } - - @Test - public void test_getMaxCursorNameLength() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxCursorNameLength(), is(63)); - } - } - - @Test - public void test_getMaxIndexLength() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxIndexLength(), is(0)); - } - } - - @Test - public void test_getMaxLogicalLobSize() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxLogicalLobSize(), is(0L)); - } - } - - @Test - public void test_getMaxProcedureNameLength() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxProcedureNameLength(), is(63)); - } - } - - @Test - public void test_getMaxRowSize() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxRowSize(), is(1073741824)); - } - } - - @Test - public void test_getMaxSchemaNameLength() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxSchemaNameLength(), is(63)); - } - } - - @Test - public void test_getMaxStatementLength() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxStatementLength(), is(0)); - } - } - - @Test - public void test_getMaxStatements() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxStatements(), is(0)); - } - } - - @Test - public void test_getMaxTableNameLength() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxTableNameLength(), is(63)); - } - } - - @Test - public void test_getMaxTablesInSelect() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxTablesInSelect(), is(0)); - } - } - - @Test - public void test_getMaxUserNameLength() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getMaxUserNameLength(), is(63)); - } - } - - @Test - public void tes_getNumericFunctions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat( - conn.getMetaData().getNumericFunctions(), - is("abs,acos,asin,atan,atan2,ceiling,cos,cot,degrees,exp,floor,log,log10,mod,pi,power,radians,round,sign,sin,sqrt,tan,truncate") - ); - } - } - - @Test - public void test_getPrimaryKeys() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - ResultSet results = conn.getMetaData().getPrimaryKeys(null, null, null); - assertThat(results.next(), is(true)); - } - } - - @Test - public void test_getProcedureColumns() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - conn.getMetaData().getProcedureColumns("", "", "", ""); - } - } - - @Test - public void test_getProcedureTerm() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getProcedureTerm(), is("function")); - } - } - - @Test - public void test_getProcedures() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - conn.getMetaData().getProcedures("", "", ""); - } - } - - @Test - @Ignore("Not implemented by PostgreSQL JDBC") - public void test_getPseudoColumns() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getPseudoColumns("", "sys", "summits", "m"); - } - } - - @Test - public void test_getResultSetHoldability() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getResultSetHoldability(), is(ResultSet.HOLD_CURSORS_OVER_COMMIT)); - } - } - - @Test - @Ignore("Not implemented by PostgreSQL JDBC") - public void test_getRowIdLifetime() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getRowIdLifetime(), is(RowIdLifetime.ROWID_UNSUPPORTED)); - } - } - - @Test - public void test_getSQLKeywords() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getSQLKeywords(), Matchers.containsString("summary")); - } - } - - @Test - public void test_getSQLStateType() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getSQLStateType(), is(DatabaseMetaData.sqlStateSQL)); - } - } - - @Test - public void test_getSchemaTerm() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getSchemaTerm(), is("schema")); - } - } - - @Test - public void test_getSchemas() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getSchemas(); - assertThat(results.next(), is(true)); - assertThat(results.getString(1), is("blob")); - } - } - - @Test - public void test_getSearchStringEscape() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getSearchStringEscape(), is("\\")); - } - } - - @Test - public void test_getStringFunctions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat( - conn.getMetaData().getStringFunctions(), - is("ascii,char,concat,lcase,left,length,ltrim,repeat,rtrim,space,substring,ucase,replace") - ); - } - } - - @Test - @Ignore("Not implemented in PostgreSQL JDBC") - public void test_getSuperTables() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - conn.getMetaData().getSuperTables("", "sys", "summits"); - } - } - - @Test - @Ignore("Not implemented in PostgreSQL JDBC") - public void test_getSuperTypes() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - conn.getMetaData().getSuperTypes("", "sys", "t"); - } - } - - @Test - public void test_getSystemFunctions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().getSystemFunctions(), is("database,ifnull,user")); - } - } - - @Test - public void test_getTablePrivileges() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getTablePrivileges("", "sys", "summits"); - } - } - - @Test - public void test_getTableTypes() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getTableTypes(); - assertThat(results.next(), is(true)); - } - } - - @Test - public void test_getTables() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getTables(null, "sys", "", null); - assertThat(results.next(), is(true)); - assertThat(results.getString(3), is("allocations_pkey")); - } - } - - @Test - public void test_getTimeDateFunctions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat( - conn.getMetaData().getTimeDateFunctions(), - is("curdate,curtime,dayname,dayofmonth,dayofweek,dayofyear,hour,minute,month,monthname,now,quarter,second,week,year,timestampadd") - ); - } - } - - @Test - public void test_getTypeInfo() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getTypeInfo(); - } - } - - @Test - public void test_getUDTs() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getUDTs("", "sys", "t", new int[0]); - } - } - - @Test - public void test_getVersionColumns() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var results = conn.getMetaData().getVersionColumns("", "sys", "summits"); - assertThat(results.next(), is(true)); - assertThat(results.getString(2), is("ctid")); - } - } - - @Test - public void test_insertsAreDetected() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().insertsAreDetected(ResultSet.TYPE_FORWARD_ONLY), is(false)); - } - } - - @Test - public void test_isCatalogAtStart() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().isCatalogAtStart(), is(true)); - } - } - - @Test - public void test_locatorsUpdateCopy() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().locatorsUpdateCopy(), is(true)); - } - } - - @Test - public void test_nullPlusNonNullIsNull() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().nullPlusNonNullIsNull(), is(true)); - } - } - - @Test - public void test_nullsAreSortedAtEnd() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().nullsAreSortedAtEnd(), is(false)); - } - } - - @Test - public void test_nullsAreSortedAtStart() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().nullsAreSortedAtStart(), is(false)); - } - } - - @Test - public void test_nullsAreSortedHigh() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().nullsAreSortedHigh(), is(true)); - } - } - - @Test - public void test_nullsAreSortedLow() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().nullsAreSortedLow(), is(false)); - } - } - - @Test - public void test_othersDeletesAreVisible() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().othersDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY), is(false)); - } - } - - @Test - public void test_othersInsertsAreVisible() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().othersInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY), is(false)); - } - } - - @Test - public void test_othersUpdatesAreVisible() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().othersUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY), is(false)); - } - } - - @Test - public void test_ownDeletesAreVisible() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().ownDeletesAreVisible(ResultSet.TYPE_FORWARD_ONLY), is(true)); - } - } - - @Test - public void test_ownInsertsAreVisible() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().ownInsertsAreVisible(ResultSet.TYPE_FORWARD_ONLY), is(true)); - } - } - - @Test - public void test_ownUpdatesAreVisible() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().ownUpdatesAreVisible(ResultSet.TYPE_FORWARD_ONLY), is(true)); - } - } - - @Test - public void test_storesLowerCaseIdentifiers() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().storesLowerCaseIdentifiers(), is(true)); - } - } - - @Test - public void test_storesLowerCaseQuotedIdentifiers() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().storesLowerCaseQuotedIdentifiers(), is(false)); - } - } - - @Test - public void test_storesMixedCaseIdentifiers() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().storesMixedCaseIdentifiers(), is(false)); - } - } - - @Test - public void test_storesMixedCaseQuotedIdentifiers() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().storesMixedCaseQuotedIdentifiers(), is(false)); - } - } - - @Test - public void test_storesUpperCaseIdentifiers() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().storesUpperCaseIdentifiers(), is(false)); - } - } - - @Test - public void test_storesUpperCaseQuotedIdentifiers() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().storesUpperCaseQuotedIdentifiers(), is(false)); - } - } - - @Test - public void test_supportsANSI92EntryLevelSQL() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsANSI92EntryLevelSQL(), is(true)); - } - } - - @Test - public void test_supportsANSI92FullSQL() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsANSI92FullSQL(), is(false)); - } - } - - @Test - public void test_supportsANSI92IntermediateSQL() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsANSI92IntermediateSQL(), is(false)); - } - } - - @Test - public void test_supportsAlterTableWithAddColumn() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsAlterTableWithAddColumn(), is(true)); - } - } - - @Test - public void test_supportsAlterTableWithDropColumn() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsAlterTableWithDropColumn(), is(true)); - } - } - - @Test - public void test_supportsBatchUpdates() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsBatchUpdates(), is(true)); - } - } - - @Test - public void test_supportsCatalogsInDataManipulation() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsCatalogsInDataManipulation(), is(false)); - } - } - - @Test - public void test_supportsCatalogsInIndexDefinitions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsCatalogsInIndexDefinitions(), is(false)); - } - } - - @Test - public void test_supportsCatalogsInPrivilegeDefinitions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsCatalogsInPrivilegeDefinitions(), is(false)); - } - } - - @Test - public void test_supportsCatalogsInProcedureCalls() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsCatalogsInProcedureCalls(), is(false)); - } - } - - @Test - public void test_supportsCatalogsInTableDefinitions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsCatalogsInTableDefinitions(), is(false)); - } - } - - @Test - public void test_supportsColumnAliasing() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsColumnAliasing(), is(true)); - } - } - - @Test - public void test_supportsConvert() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsConvert(), is(false)); - } - } - - @Test - public void test_supportsConvertWithArgs() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsConvert(1, 1), is(false)); - } - } - - @Test - public void test_supportsCoreSQLGrammar() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsCoreSQLGrammar(), is(false)); - } - } - - @Test - public void test_supportsCorrelatedSubqueries() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsCorrelatedSubqueries(), is(true)); - } - } - - @Test - public void test_supportsDataDefinitionAndDataManipulationTransactions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsDataDefinitionAndDataManipulationTransactions(), is(true)); - } - } - - @Test - public void test_supportsDataManipulationTransactionsOnly() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsDataManipulationTransactionsOnly(), is(false)); - } - } - - @Test - public void test_supportsDifferentTableCorrelationNames() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsDifferentTableCorrelationNames(), is(false)); - } - } - - @Test - public void test_supportsExpressionsInOrderBy() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsExpressionsInOrderBy(), is(true)); - } - } - - @Test - public void test_supportsExtendedSQLGrammar() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsExtendedSQLGrammar(), is(false)); - } - } - - @Test - public void test_supportsFullOuterJoins() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsFullOuterJoins(), is(true)); - } - } - - @Test - public void test_supportsGetGeneratedKeys() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsGetGeneratedKeys(), is(true)); - } - } - - @Test - public void test_supportsGroupBy() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsGroupBy(), is(true)); - } - } - - @Test - public void test_supportsGroupByBeyondSelect() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsGroupByBeyondSelect(), is(true)); - } - } - - @Test - public void test_supportsGroupByUnrelated() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsGroupByUnrelated(), is(true)); - } - } - - @Test - public void test_supportsIntegrityEnhancementFacility() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsIntegrityEnhancementFacility(), is(true)); - } - } - - @Test - public void test_supportsLikeEscapeClause() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsLikeEscapeClause(), is(true)); - } - } - - @Test - public void test_supportsLimitedOuterJoins() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsLimitedOuterJoins(), is(true)); - } - } - - @Test - public void test_supportsMinimumSQLGrammar() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsMinimumSQLGrammar(), is(true)); - } - } - - @Test - public void test_supportsMixedCaseIdentifiers() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsMixedCaseIdentifiers(), is(false)); - } - } - - @Test - public void test_supportsMixedCaseQuotedIdentifiers() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsMixedCaseQuotedIdentifiers(), is(true)); - } - } - - @Test - public void test_supportsMultipleOpenResults() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsMultipleOpenResults(), is(false)); - } - } - - @Test - public void test_supportsMultipleResultSets() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsMultipleResultSets(), is(true)); - } - } - - @Test - public void test_supportsMultipleTransactions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsMultipleTransactions(), is(true)); - } - } - - @Test - public void test_supportsNamedParameters() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsNamedParameters(), is(false)); - } - } - - @Test - public void test_supportsNonNullableColumns() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsNonNullableColumns(), is(true)); - } - } - - @Test - public void test_supportsOpenCursorsAcrossCommit() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsOpenCursorsAcrossCommit(), is(false)); - } - } - - @Test - public void test_supportsOpenCursorsAcrossRollback() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsOpenCursorsAcrossRollback(), is(false)); - } - } - - @Test - public void test_supportsOpenStatementsAcrossCommit() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsOpenStatementsAcrossCommit(), is(true)); - } - } - - @Test - public void test_supportsOpenStatementsAcrossRollback() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsOpenStatementsAcrossRollback(), is(true)); - } - } - - @Test - public void test_supportsOrderByUnrelated() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsOrderByUnrelated(), is(true)); - } - } - - @Test - public void test_supportsOuterJoins() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsOuterJoins(), is(true)); - } - } - - @Test - public void test_supportsPositionedDelete() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsPositionedDelete(), is(false)); - } - } - - @Test - public void test_supportsPositionedUpdate() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsPositionedUpdate(), is(false)); - } - } - - @Test - public void test_supportsRefCursors() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsRefCursors(), is(true)); - } - } - - @Test - public void test_supportsResultSetConcurrency() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat( - conn.getMetaData().supportsResultSetConcurrency(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY), - is(true) - ); - } - } - - @Test - public void test_supportsResultSetHoldability() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsResultSetHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT), is(true)); - } - } - - @Test - public void test_supportsResultSetType() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsResultSetType(ResultSet.TYPE_FORWARD_ONLY), is(true)); - } - } - - @Test - public void test_supportsSavepoints() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsSavepoints(), is(true)); - } - } - - @Test - public void test_supportsSchemasInDataManipulation() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsSchemasInDataManipulation(), is(true)); - } - } - - @Test - public void test_supportsSchemasInIndexDefinitions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsSchemasInIndexDefinitions(), is(true)); - } - } - - @Test - public void test_supportsSchemasInPrivilegeDefinitions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsSchemasInPrivilegeDefinitions(), is(true)); - } - } - - @Test - public void test_supportsSchemasInProcedureCalls() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsSchemasInProcedureCalls(), is(true)); - } - } - - @Test - public void test_supportsSchemasInTableDefinitions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsSchemasInTableDefinitions(), is(true)); - } - } - - @Test - public void test_supportsSelectForUpdate() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsSelectForUpdate(), is(true)); - } - } - - @Test - public void test_supportsSharding() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsSharding(), is(false)); - } - } - - @Test - public void test_supportsStatementPooling() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsStatementPooling(), is(false)); - } - } - - @Test - public void test_supportsStoredFunctionsUsingCallSyntax() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsStoredFunctionsUsingCallSyntax(), is(true)); - } - } - - @Test - public void test_supportsStoredProcedures() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsStoredProcedures(), is(true)); - } - } - - @Test - public void test_supportsSubqueriesInComparisons() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsSubqueriesInComparisons(), is(true)); - } - } - - @Test - public void test_supportsSubqueriesInExists() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsSubqueriesInExists(), is(true)); - } - } - - @Test - public void test_supportsSubqueriesInIns() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsSubqueriesInIns(), is(true)); - } - } - - @Test - public void test_supportsSubqueriesInQuantifieds() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsSubqueriesInQuantifieds(), is(true)); - } - } - - @Test - public void test_supportsTableCorrelationNames() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsTableCorrelationNames(), is(true)); - } - } - - @Test - public void test_supportsTransactionIsolationLevel() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsTransactionIsolationLevel(Connection.TRANSACTION_READ_UNCOMMITTED), is(true)); - } - } - - @Test - public void test_supportsTransactions() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsTransactions(), is(true)); - } - } - - @Test - public void test_supportsUnion() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsUnion(), is(true)); - } - } - - @Test - public void test_supportsUnionAll() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().supportsUnionAll(), is(true)); - } - } - - @Test - public void test_updatesAreDetected() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().updatesAreDetected(ResultSet.TYPE_FORWARD_ONLY), is(false)); - } - } - - @Test - public void test_usesLocalFilePerTable() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().usesLocalFilePerTable(), is(false)); - } - } - - @Test - public void test_usesLocalFiles() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - assertThat(conn.getMetaData().usesLocalFiles(), is(false)); - } - } -} - - diff --git a/tests/client_tests/stock_jdbc/src/test/java/stock_jdbc/JdbcTest.java b/tests/client_tests/stock_jdbc/src/test/java/stock_jdbc/JdbcTest.java deleted file mode 100644 index e0643f75..00000000 --- a/tests/client_tests/stock_jdbc/src/test/java/stock_jdbc/JdbcTest.java +++ /dev/null @@ -1,118 +0,0 @@ -package stock_jdbc; - -import java.sql.DriverManager; -import java.util.Map; - -import org.junit.After; -import org.junit.ClassRule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -import io.crate.testing.CrateTestCluster; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; - -@RunWith(JUnit4.class) -public class JdbcTest { - - @ClassRule - public static final CrateTestCluster TEST_CLUSTER = CrateTestCluster - .fromURL("https://cdn.crate.io/downloads/releases/nightly/crate-latest.tar.gz") - .settings(Map.of("psql.port", 55433)) - .build(); - public static final String URL = "jdbc:postgresql://localhost:55433/doc?user=crate"; - - @After - public void after() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var tables = conn.getMetaData().getTables(null, "doc", null, null); - while (tables.next()) { - String schema = tables.getString(2); - String table = tables.getString(3); - conn.createStatement().execute( - "DROP TABLE IF EXISTS \"" + schema + "\".\"" + table + "\""); - } - } - } - - @Test - public void test_crud_operations_can_be_used() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var stmt = conn.createStatement(); - var hasResultSet = stmt.execute("CREATE TABLE tbl (x int, y int)"); - assertThat(hasResultSet, is(false)); - assertThat(stmt.getUpdateCount(), is(1)); - - var insertStmt = conn.prepareStatement("INSERT INTO tbl (x, y) VALUES (?, ?)"); - insertStmt.setInt(1, 1); - insertStmt.setInt(2, 10); - insertStmt.execute(); - - stmt.execute("REFRESH TABLE tbl"); - - var results = conn.createStatement().executeQuery("SELECT x, y FROM tbl ORDER BY 1"); - assertThat(results.next(), is(true)); - assertThat(results.getInt(1), is(1)); - assertThat(results.getInt(2), is(10)); - assertThat(results.next(), is(false)); - - stmt.execute("UPDATE tbl SET y = y + 10"); - stmt.execute("REFRESH TABLE tbl"); - - var resultsAfterUpdate = conn.createStatement().executeQuery("SELECT x, y FROM tbl ORDER BY 1"); - assertThat(resultsAfterUpdate.next(), is(true)); - assertThat(resultsAfterUpdate.getInt(1), is(1)); - assertThat(resultsAfterUpdate.getInt(2), is(20)); - assertThat(resultsAfterUpdate.next(), is(false)); - } - } - - @Test - public void test_prepare_call_can_be_used_to_insert_records() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var stmt = conn.createStatement(); - stmt.execute("CREATE TABLE tbl (x int, y int)"); - - try (var call = conn.prepareCall("INSERT INTO tbl (x, y) VALUES (?, ?)")) { - call.setInt(1, 1); - call.setInt(2, 15); - call.execute(); - } - - stmt.execute("REFRESH TABLE tbl"); - - var results = conn.createStatement().executeQuery("SELECT x, y FROM tbl ORDER BY 1"); - assertThat(results.next(), is(true)); - assertThat(results.getInt(1), is(1)); - assertThat(results.getInt(2), is(15)); - assertThat(results.next(), is(false)); - } - } - - @Test - public void test_batch_insert_is_supported() throws Exception { - try (var conn = DriverManager.getConnection(URL)) { - var stmt = conn.createStatement(); - stmt.execute("CREATE TABLE tbl (x int, y int)"); - - try (var insert = conn.prepareStatement("INSERT INTO tbl (x, y) VALUES (?, ?)")) { - for (int i = 0; i < 20; i++) { - insert.setInt(1, i); - insert.setInt(2, i * 10); - insert.addBatch(); - } - int[] results = insert.executeBatch(); - assertThat(results.length, is(20)); - } - - stmt.execute("REFRESH TABLE tbl"); - - var results = conn.createStatement().executeQuery("SELECT count(*) FROM tbl"); - assertThat(results.next(), is(true)); - assertThat(results.getInt(1), is(20)); - } - - } -}