Skip to content

Commit

Permalink
re-enabled v8 tests (#40)
Browse files Browse the repository at this point in the history
* re-enabled v8 tests
  • Loading branch information
pj-spoelders authored Nov 28, 2023
1 parent 8264dc9 commit a72c8c4
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .project-keeper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ excludes:
- "E-PK-CORE-18: Outdated content: '.github/workflows/ci-build.yml'"
- "E-PK-CORE-18: Outdated content: '.github/workflows/release_droid_upload_github_release_assets.yml'"
- "E-PK-CORE-18: Outdated content: '.github/workflows/release_droid_prepare_original_checksum.yml'"
ciBuildRunnerOS: ubuntu-20.04

6 changes: 5 additions & 1 deletion doc/changes/changes_2.4.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ This release adds integration tests using Exasol 8 and the extension code making
* Updated `com.exasol:exasol-testcontainers:6.6.2` to `6.6.3`
* Added `com.exasol:extension-manager-integration-test-java:0.5.6`
* Updated `com.exasol:hamcrest-resultset-matcher:1.6.1` to `1.6.2`
* Updated `com.exasol:test-db-builder-java:3.5.1` to `3.5.2`
* Added `com.oracle.database.jdbc:ojdbc8:23.3.0.23.09`
* Updated `nl.jqno.equalsverifier:equalsverifier:3.15.2` to `3.15.3`
* Updated `org.jacoco:org.jacoco.agent:0.8.10` to `0.8.11`
Expand All @@ -40,9 +41,12 @@ This release adds integration tests using Exasol 8 and the extension code making
#### Plugin Dependency Updates

* Updated `com.exasol:error-code-crawler-maven-plugin:1.3.0` to `1.3.1`
* Updated `com.exasol:project-keeper-maven-plugin:2.9.12` to `2.9.15`
* Updated `com.exasol:project-keeper-maven-plugin:2.9.12` to `2.9.16`
* Updated `org.apache.maven.plugins:maven-clean-plugin:2.5` to `3.3.2`
* Updated `org.apache.maven.plugins:maven-dependency-plugin:3.6.0` to `3.6.1`
* Updated `org.apache.maven.plugins:maven-enforcer-plugin:3.4.0` to `3.4.1`
* Updated `org.apache.maven.plugins:maven-failsafe-plugin:3.1.2` to `3.2.2`
* Updated `org.apache.maven.plugins:maven-surefire-plugin:3.1.2` to `3.2.2`
* Added `org.codehaus.mojo:exec-maven-plugin:3.1.0`
* Updated `org.codehaus.mojo:versions-maven-plugin:2.16.0` to `2.16.1`
* Updated `org.jacoco:jacoco-maven-plugin:0.8.10` to `0.8.11`
Expand Down
15 changes: 10 additions & 5 deletions pk_generated_parent.pom

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<dependency>
<groupId>com.exasol</groupId>
<artifactId>test-db-builder-java</artifactId>
<version>3.5.1</version>
<version>3.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -156,7 +156,7 @@
<plugin>
<groupId>com.exasol</groupId>
<artifactId>project-keeper-maven-plugin</artifactId>
<version>2.9.15</version>
<version>2.9.16</version>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
package com.exasol.adapter.dialects.oracle;

import static com.exasol.adapter.metadata.DataType.IntervalType.DAY_TO_SECOND;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.*;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.extension.ExtendWith;

import com.exasol.adapter.commontests.scalarfunction.ScalarFunctionsTestBase;
import com.exasol.adapter.commontests.scalarfunction.TestSetup;
import com.exasol.adapter.commontests.scalarfunction.virtualschematestsetup.*;
Expand All @@ -12,19 +21,10 @@
import com.exasol.dbbuilder.dialects.Table;
import com.exasol.dbbuilder.dialects.exasol.VirtualSchema;
import com.exasol.dbbuilder.dialects.oracle.OracleObjectFactory;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.extension.ExtendWith;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.*;

import static com.exasol.adapter.metadata.DataType.IntervalType.DAY_TO_SECOND;

@ExtendWith({CloseAfterAllExtension.class})
@ExtendWith({ CloseAfterAllExtension.class })
class OracleScalarFunctionsIT extends ScalarFunctionsTestBase {


@CloseAfterAll
private static final OracleVirtualSchemaIntegrationTestSetup SETUP = new OracleVirtualSchemaIntegrationTestSetup();
static int idCounter = 0;
Expand All @@ -34,11 +34,6 @@ protected static String getUniqueIdentifier() {
return "ID" + idCounter;
}

@BeforeAll
static void assumeExasol71() throws SQLException {
ExasolVersionCheck.assumeExasolVersion7(SETUP.getExasolContainer().createConnection());
}

@Override
protected TestSetup getTestSetup() {
final OracleObjectFactory oracleFactory = SETUP.getOracleFactory();
Expand Down Expand Up @@ -71,36 +66,34 @@ static void beforeAll() {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}


public class OracleTestSetup implements TestSetup {
final OracleObjectFactory oracleFactory;

OracleTestSetup(OracleObjectFactory oracleFactory) {
OracleTestSetup(final OracleObjectFactory oracleFactory) {
this.oracleFactory = oracleFactory;
}

@Override
public VirtualSchemaTestSetupProvider getVirtualSchemaTestSetupProvider() {
return (final CreateVirtualSchemaTestSetupRequest request) -> {
//create schema in oracle DB with increasing ID, ID1, ID2, etc.
// create schema in oracle DB with increasing ID, ID1, ID2, etc.
final Schema oracleSchema = oracleFactory.createSchema(getUniqueIdentifier());

for (final TableRequest tableRequest : request.getTableRequests()) {
createTableInSchema(oracleSchema, tableRequest);
}
//create a virtual schema with the same name as the oracle schema
// create a virtual schema with the same name as the oracle schema
final VirtualSchema virtualSchema = SETUP.createVirtualSchema(oracleSchema.getName(),
Collections.emptyMap());

return new OracleScalarFunctionsIT.OracleSingleTableVirtualSchemaTestSetup(virtualSchema, oracleSchema);
};
}

//case sensitive!!! 1 on 1
// case sensitive!!! 1 on 1
// .tolower() for the table and column names (brought over from postgresql) was causing trouble here.
private void createTableInSchema(Schema oracleSchema, TableRequest tableRequest) {
final Table.Builder tableBuilder = oracleSchema
.createTableBuilder(tableRequest.getName());
private void createTableInSchema(final Schema oracleSchema, final TableRequest tableRequest) {
final Table.Builder tableBuilder = oracleSchema.createTableBuilder(tableRequest.getName());
for (final Column column : tableRequest.getColumns()) {
tableBuilder.column(column.getName(), column.getType());
}
Expand All @@ -110,47 +103,49 @@ private void createTableInSchema(Schema oracleSchema, TableRequest tableRequest)
}
}

//https://docs.exasol.com/db/latest/migration_guides/oracle/execution/datatypemapping.htm
// https://docs.exasol.com/db/latest/migration_guides/oracle/execution/datatypemapping.htm
@Override
public String getExternalTypeFor(final DataType exasolType) {
switch (exasolType.getExaDataType()) {
case VARCHAR:
return "VARCHAR2(" + exasolType.getSize() + " CHAR)";
case CHAR:
return "NCHAR2(" + exasolType.getSize() + ")";
case DATE:
return "DATE";
case TIMESTAMP:
return "TIMESTAMP (" + exasolType.getPrecision() + ")";
case DOUBLE:
return "DOUBLE PRECISION";
case DECIMAL:
return "DECIMAL";
case BOOLEAN:
return "NUMBER(1)";
case HASHTYPE:
return "RAW(" + exasolType.getSize() + ")";
case INTERVAL:
if (exasolType.getIntervalType() == DAY_TO_SECOND) {
return "INTERVAL DAY(" + exasolType.getPrecision() + ") TO SECOND(" + exasolType.getIntervalFraction() + ")";
} else {
return "INTERVAL YEAR(" + exasolType.getPrecision() + ") TO MONTH";
}
default:
return exasolType.toString();
case VARCHAR:
return "VARCHAR2(" + exasolType.getSize() + " CHAR)";
case CHAR:
return "NCHAR2(" + exasolType.getSize() + ")";
case DATE:
return "DATE";
case TIMESTAMP:
return "TIMESTAMP (" + exasolType.getPrecision() + ")";
case DOUBLE:
return "DOUBLE PRECISION";
case DECIMAL:
return "DECIMAL";
case BOOLEAN:
return "NUMBER(1)";
case HASHTYPE:
return "RAW(" + exasolType.getSize() + ")";
case INTERVAL:
if (exasolType.getIntervalType() == DAY_TO_SECOND) {
return "INTERVAL DAY(" + exasolType.getPrecision() + ") TO SECOND("
+ exasolType.getIntervalFraction() + ")";
} else {
return "INTERVAL YEAR(" + exasolType.getPrecision() + ") TO MONTH";
}
default:
return exasolType.toString();
}
}

@Override
public Set<String> getDialectSpecificExcludes() {
return Set.of("neg",
"upper(\"DOUBLE_PRECISION_C0\")",//oracle converts 0.5 to '.5' instead of '0.5'
"upper(\"DATE_C5\")",//different date formatting
"upper(\"TIMESTAMP_0_C6\")", //different timestamp formatting
"to_dsinterval", "numtoyminterval", "systimestamp", "cast", "current_timestamp", "numtodsinterval", "to_yminterval",
"character_length", "trim", "add_months", "char_length", "instr", "lower", "regexp_replace", "substr", "add_hours", "left", "mid", "add_weeks",
"add_minutes", "to_timestamp", "reverse", "regexp_instr", "soundex", "add_days", "add_years", "replace", "translate", "lpad", "ltrim", "regexp_substr", "ucase", "lcase",
"character_Length", "locate", "curdate", "substring", "rpad", "to_date", "to_char", "repeat", "to_number", "length", "rtrim", "add_seconds");
return Set.of("neg", "upper(\"DOUBLE_PRECISION_C0\")", // oracle converts 0.5 to '.5' instead of '0.5'
"upper(\"DATE_C5\")", // different date formatting
"upper(\"TIMESTAMP_0_C6\")", // different timestamp formatting
"to_dsinterval", "numtoyminterval", "systimestamp", "cast", "current_timestamp", "numtodsinterval",
"to_yminterval", "character_length", "trim", "add_months", "char_length", "instr", "lower",
"regexp_replace", "substr", "add_hours", "left", "mid", "add_weeks", "add_minutes", "to_timestamp",
"reverse", "regexp_instr", "soundex", "add_days", "add_years", "replace", "translate", "lpad",
"ltrim", "regexp_substr", "ucase", "lcase", "character_Length", "locate", "curdate", "substring",
"rpad", "to_date", "to_char", "repeat", "to_number", "length", "rtrim", "add_seconds");
}

@Override
Expand Down

0 comments on commit a72c8c4

Please sign in to comment.