-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d17af39
commit 7212df1
Showing
7 changed files
with
133 additions
and
47 deletions.
There are no files selected for viewing
56 changes: 53 additions & 3 deletions
56
tableau-server-GUI-tests/src/test/java/com/exasol/tableau/JdbcConnectorIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,59 @@ | ||
package com.exasol.tableau; | ||
|
||
public class JdbcConnectorIT extends TableauServerUiBaseIT { | ||
import static com.exasol.tableau.TableauServerConfiguration.EXASOL_PORT; | ||
|
||
protected JdbcConnectorIT() { | ||
super("Exasol JDBC by Exasol AG"); | ||
import java.util.regex.Pattern; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import com.exasol.tableau.Workbook.Builder; | ||
|
||
class JdbcConnectorIT extends TableauServerUiBaseIT { | ||
|
||
@Override | ||
protected Builder createWorkbookBuilder() { | ||
return Workbook.builder().workbookName("Test_workbook") | ||
.connectorName("Exasol JDBC by Exasol AG") | ||
.hostname(DOCKER_NETWORK_ADDRESS) | ||
.port(EXASOL.getMappedPort(EXASOL_PORT).toString()) | ||
.username(EXASOL.getUsername()) | ||
.password(EXASOL.getPassword()) | ||
.fingerprint(getActualFingerprint()) | ||
.validateServerCertificate(true) | ||
.databaseName("EXA_DB"); | ||
} | ||
|
||
private String getActualFingerprint() { | ||
return extractFingerprint(EXASOL.getJdbcUrl()); | ||
} | ||
|
||
private static String extractFingerprint(final String jdbcUrl) { | ||
if (jdbcUrl.contains("validateservercertificate=0")) { | ||
throw new AssertionError("Jdbc url '" + jdbcUrl + "' does not validate certificate"); | ||
} | ||
final java.util.regex.Matcher matcher = Pattern.compile("jdbc:exa:[^/]+/([^:]+):.*").matcher(jdbcUrl); | ||
if (!matcher.matches()) { | ||
throw new IllegalStateException("Error extracting fingerprint from '" + jdbcUrl + "'"); | ||
} | ||
return matcher.group(1); | ||
} | ||
|
||
@Test | ||
void connectToExasolDatasourceWithoutFingerprint() { | ||
final Workbook workbook = createWorkbookBuilder().fingerprint("").validateServerCertificate(true).build(); | ||
assertCreatingWorkbookFails(workbook, "unable to find valid certification path to requested target"); | ||
} | ||
|
||
@Test | ||
void connectToExasolDatasourceWrongFingerprint() { | ||
final Workbook workbook = createWorkbookBuilder().fingerprint("wrongFingerprint") | ||
.validateServerCertificate(true).build(); | ||
assertCreatingWorkbookFails(workbook, "Fingerprint did not match"); | ||
} | ||
|
||
@Test | ||
void connectToExasolDatasourceIgnoringCertificateSucceeds() { | ||
final Workbook workbook = createWorkbookBuilder().validateServerCertificate(false).build(); | ||
assertCreatingWorkbookSucceeds(workbook); | ||
} | ||
} |
18 changes: 15 additions & 3 deletions
18
tableau-server-GUI-tests/src/test/java/com/exasol/tableau/OdbcConnectorIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
package com.exasol.tableau; | ||
|
||
import static com.exasol.tableau.TableauServerConfiguration.EXASOL_PORT; | ||
|
||
import com.exasol.tableau.Workbook.Builder; | ||
|
||
public class OdbcConnectorIT extends TableauServerUiBaseIT { | ||
|
||
protected OdbcConnectorIT() { | ||
super("Exasol ODBC by Exasol AG"); | ||
@Override | ||
protected Builder createWorkbookBuilder() { | ||
return Workbook.builder().workbookName("Test_workbook") | ||
.connectorName("Exasol ODBC by Exasol AG") | ||
.hostname(DOCKER_NETWORK_ADDRESS) | ||
.port(EXASOL.getMappedPort(EXASOL_PORT).toString()) | ||
.username(EXASOL.getUsername()) | ||
.password(EXASOL.getPassword()) | ||
.fingerprint(null) | ||
.validateServerCertificate(null) | ||
.databaseName(null); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters