Skip to content

Commit 68d807e

Browse files
Ahmed Tawilapivovarit
authored andcommitted
close cache instances properly (eugenp#2630)
* Evaluation article: Different Types of Bean Injection in Spring * added tests & changed configuration to Java-based config * removed xml config files * rename unit tests * BAEL-972 - Apache Commons Text * remove code from evaluation article * remove code from evaluation article * BAEL-972 - Apache Commons Text - added another example * BAEL-972 - Apache Commons Text - just indentation * BAEL-994 - TemporalAdjuster in Java * BAEL-994 - TemporalAdjuster in Java * BAEL-994 - TemporalAdjuster in Java * BAEL-994 - TemporalAdjuster in Java * BAEL-994 - TemporalAdjuster in Java - fix problems * BAEL-1033 Introduction to StreamUtils * BAEL-1033 Introduction to StreamUtils * BAEL-1033 Introduction to StreamUtils * fix formatting * BAEL-1033 minor refactor * BAEL-1035 Introduction to Eclipse Collections * format * BAEL-1035 Introduction to Eclipse Collections * BAEL-1035 Introduction to Eclipse Collections * BAEL-1035 Introduction to Eclipse Collections * cleanup * cleanup * BAEL-1109 Introduction to JCache * BAEL-1109 Introduction to JCache * remove unneeded property in pom.xml * fix formatting * close cache instances properly * remove latest commit * BAEL-1057 Introduction to rxjava-jdbc
1 parent f5c539f commit 68d807e

19 files changed

Lines changed: 3653 additions & 4 deletions

‎libraries/pom.xml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,21 @@
550550
<artifactId>functionaljava</artifactId>
551551
<version>4.7</version>
552552
</dependency>
553+
<dependency>
554+
<groupId>org.functionaljava</groupId>
555+
<artifactId>functionaljava-java8</artifactId>
556+
<version>4.7</version>
557+
</dependency>
558+
<dependency>
559+
<groupId>org.functionaljava</groupId>
560+
<artifactId>functionaljava-quickcheck</artifactId>
561+
<version>4.7</version>
562+
</dependency>
563+
<dependency>
564+
<groupId>org.functionaljava</groupId>
565+
<artifactId>functionaljava-java-core</artifactId>
566+
<version>4.7</version>
567+
</dependency>
553568
<dependency>
554569
<groupId>javax.cache</groupId>
555570
<artifactId>cache-api</artifactId>

‎libraries/src/test/java/com/baeldung/jcache/CacheLoaderTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ public void whenReadingFromStorage_thenCorrect() {
4141
assertEquals("fromCache" + i, value);
4242
}
4343
}
44-
}
44+
}

‎libraries/src/test/java/com/baeldung/jcache/EntryProcessorTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ public void whenModifyValue_thenCorrect() {
3838
this.cache.invoke("key", new SimpleEntryProcessor());
3939
assertEquals("value - modified", cache.get("key"));
4040
}
41-
}
41+
}

‎libraries/src/test/java/com/baeldung/jcache/EventListenerTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ public void whenRunEvent_thenCorrect() throws InterruptedException {
5353
assertEquals(true, this.listener.getUpdated());
5454
}
5555

56-
}
56+
}

‎libraries/src/test/java/com/baeldung/jcache/JCacheTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ public void instantiateCache() {
2424
assertEquals("value2", cache.get("key2"));
2525
cacheManager.close();
2626
}
27-
}
27+
}

‎rxjava/pom.xml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,29 @@
3131
<artifactId>awaitility</artifactId>
3232
<version>1.7.0</version>
3333
</dependency>
34+
<dependency>
35+
<groupId>com.github.davidmoten</groupId>
36+
<artifactId>rxjava-jdbc</artifactId>
37+
<version>${rx.java.jdbc.version}</version>
38+
</dependency>
39+
<dependency>
40+
<groupId>com.h2database</groupId>
41+
<artifactId>h2</artifactId>
42+
<version>${h2.version}</version>
43+
<scope>runtime</scope>
44+
</dependency>
45+
<dependency>
46+
<groupId>org.assertj</groupId>
47+
<artifactId>assertj-core</artifactId>
48+
<version>${assertj.version}</version>
49+
</dependency>
3450
</dependencies>
3551

3652
<properties>
53+
<assertj.version>3.8.0</assertj.version>
3754
<rx.java.version>1.2.5</rx.java.version>
55+
<rx.java.jdbc.version>0.7.11</rx.java.jdbc.version>
56+
<h2.version>1.4.196</h2.version>
3857
</properties>
3958

4059

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.baeldung.rxjava.jdbc;
2+
3+
public class Connector {
4+
5+
public static final String DB_CONNECTION = "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1";
6+
public static final String DB_USER = "";
7+
public static final String DB_PASSWORD = "";
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.baeldung.rxjava.jdbc;
2+
3+
import com.github.davidmoten.rx.jdbc.annotations.Column;
4+
5+
public interface Employee {
6+
7+
@Column("id")
8+
int id();
9+
10+
@Column("name")
11+
String name();
12+
13+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.baeldung.rxjava.jdbc;
2+
3+
public class Manager {
4+
5+
private int id;
6+
private String name;
7+
8+
public Manager(int id, String name) {
9+
this.id = id;
10+
this.name = name;
11+
}
12+
13+
public int getId() {
14+
return id;
15+
}
16+
17+
public void setId(int id) {
18+
this.id = id;
19+
}
20+
21+
public String getName() {
22+
return name;
23+
}
24+
25+
public void setName(String name) {
26+
this.name = name;
27+
}
28+
29+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.baeldung.rxjava.jdbc;
2+
3+
import java.io.IOException;
4+
import java.io.InputStream;
5+
import java.io.StringWriter;
6+
7+
import org.apache.commons.io.IOUtils;
8+
9+
public class Utils {
10+
11+
public static String getStringFromInputStream(InputStream input) throws IOException {
12+
StringWriter writer = new StringWriter();
13+
IOUtils.copy(input, writer, "UTF-8");
14+
return writer.toString();
15+
}
16+
}

0 commit comments

Comments
 (0)