Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test postgres #89

Merged
merged 3 commits into from Mar 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions kcache-rdbms/pom.xml
Expand Up @@ -57,6 +57,13 @@
<scope>test</scope>
</dependency>
-->
<!--
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.19.jre7</version>
</dependency>
-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions kcache-rdbms/src/main/java/io/kcache/rdbms/RdbmsCache.java
Expand Up @@ -312,6 +312,12 @@ protected KeyValueIterator<K, V> all(boolean isDescending) {
public void flush() {
}

@Override
public void clear() {
// For testing
dsl().deleteFrom(KV).execute();
}

@Override
protected void closeDB() {
}
Expand Down
Expand Up @@ -34,6 +34,11 @@ protected Properties getKafkaCacheProperties() throws Exception {
//props.put(prefix + RdbmsCache.DIALECT_CONFIG, "MYSQL");
//props.put(prefix + RdbmsCache.USERNAME_CONFIG, "root");

//props.put(prefix + RdbmsCache.JDBC_URL_CONFIG, "jdbc:postgresql:postgres");
//props.put(prefix + RdbmsCache.DIALECT_CONFIG, "POSTGRES");
//props.put(prefix + RdbmsCache.USERNAME_CONFIG, "postgres");
//props.put(prefix + RdbmsCache.PASSWORD_CONFIG, "postgres");

//props.put(prefix + RdbmsCache.JDBC_URL_CONFIG, "jdbc:h2:" + dir.newFolder().getAbsolutePath() + "/kcache");
//props.put(prefix + RdbmsCache.DIALECT_CONFIG, "H2");

Expand Down
10 changes: 10 additions & 0 deletions kcache-rdbms/src/test/java/io/kcache/rdbms/RdbmsCacheTest.java
Expand Up @@ -37,6 +37,11 @@ protected Cache<Bytes, byte[]> createCache() throws Exception {
//configs.put(RdbmsCache.DIALECT_CONFIG, "MYSQL");
//configs.put(RdbmsCache.USERNAME_CONFIG, "root");

//configs.put(RdbmsCache.JDBC_URL_CONFIG, "jdbc:postgresql:postgres");
//configs.put(RdbmsCache.DIALECT_CONFIG, "POSTGRES");
//configs.put(RdbmsCache.USERNAME_CONFIG, "postgres");
//configs.put(RdbmsCache.PASSWORD_CONFIG, "postgres");

//configs.put(RdbmsCache.JDBC_URL_CONFIG, "jdbc:h2:" + dir.newFolder().getAbsolutePath() + "/kcache");
//configs.put(RdbmsCache.DIALECT_CONFIG, "H2");

Expand All @@ -49,4 +54,9 @@ protected Cache<Bytes, byte[]> createCache() throws Exception {
cache.configure(configs);
return cache;
}

@After
public void clearCache() {
getCache().clear();
}
}