-
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.
Read properties file in Java code to avoid having to set environment
variables when running tests from the IDE.
- Loading branch information
1 parent
9049e72
commit 5949a72
Showing
3 changed files
with
44 additions
and
6 deletions.
There are no files selected for viewing
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
26 changes: 23 additions & 3 deletions
26
tableau-server-GUI-tests/src/test/java/com/exasol/tableau/TableauServerConfiguration.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,12 +1,32 @@ | ||
package com.exasol.tableau; | ||
|
||
import java.io.*; | ||
import java.util.Properties; | ||
|
||
class TableauServerConfiguration { | ||
static final int TABLEAU_PORT = 8080; | ||
static final int TABLEAU_MAPPED_PORT = 33445; | ||
static final int EXASOL_PORT = 8563; | ||
static final int EXASOL_MAPPED_PORT = 33446; | ||
static final String TABLEAU_SERVER_DOCKER_IMAGE = "tablau_server_with_exasol_drivers:latest"; | ||
static final String TABLEAU_USERNAME = System.getProperty("TABLEAU_USERNAME"); | ||
static final String TABLEAU_PASSWORD = System.getProperty("TABLEAU_PASSWORD"); | ||
static final String TABLEAU_LICENSE_KEY = System.getProperty("TABLEAU_LICENSE_KEY"); | ||
|
||
private static final Properties PROPERTIES = readProperties("/credentials.properties"); | ||
|
||
static final String TABLEAU_USERNAME = PROPERTIES.getProperty("TABLEAU_USERNAME"); | ||
static final String TABLEAU_PASSWORD = PROPERTIES.getProperty("TABLEAU_PASSWORD"); | ||
static final String TABLEAU_LICENSE_KEY = PROPERTIES.getProperty("TABLEAU_LICENSE_KEY"); | ||
|
||
private static Properties readProperties(final String resource) { | ||
final Properties properties = new Properties(); | ||
try (InputStream stream = TableauServerConfiguration.class.getResourceAsStream(resource)) { | ||
if (stream == null) { | ||
throw new AssertionError("Resource '" + resource + "' not found on classpath"); | ||
} | ||
properties.load(stream); | ||
} catch (final IOException exception) { | ||
throw new UncheckedIOException("Error reading resource " + resource + " from classpath", exception); | ||
} | ||
return properties; | ||
} | ||
|
||
} |
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