Skip to content

Commit

Permalink
Merge pull request #89 from rayokota/postgres
Browse files Browse the repository at this point in the history
Test postgres
  • Loading branch information
rayokota committed Mar 7, 2021
2 parents a254bc5 + 7c7f7c6 commit 81e4264
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
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();
}
}

0 comments on commit 81e4264

Please sign in to comment.