-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for
com.github.ben-manes.caffeine:caffeine:2.9.3
- Loading branch information
1 parent
9f159ca
commit b12db26
Showing
16 changed files
with
729 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
metadata/com.github.ben-manes.caffeine/caffeine/2.9.3/index.json
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ | ||
"reflect-config.json" | ||
] |
203 changes: 203 additions & 0 deletions
203
metadata/com.github.ben-manes.caffeine/caffeine/2.9.3/reflect-config.json
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 |
---|---|---|
@@ -0,0 +1,203 @@ | ||
[ | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BBHeader$ReadAndWriteCounterRef"}, | ||
"name":"com.github.benmanes.caffeine.cache.BBHeader$ReadAndWriteCounterRef", | ||
"fields":[{"name":"writeCounter"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BBHeader$ReadCounterRef"}, | ||
"name":"com.github.benmanes.caffeine.cache.BBHeader$ReadCounterRef", | ||
"fields":[{"name":"readCounter"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BLCHeader$DrainStatusRef"}, | ||
"name":"com.github.benmanes.caffeine.cache.BLCHeader$DrainStatusRef", | ||
"fields":[{"name":"drainStatus"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueue"}, | ||
"name":"com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueueColdProducerFields", | ||
"fields":[{"name":"producerLimit"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueue"}, | ||
"name":"com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueueConsumerFields", | ||
"fields":[{"name":"consumerIndex"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueue"}, | ||
"name":"com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueueProducerFields", | ||
"fields":[{"name":"producerIndex"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.Caffeine"}, | ||
"name":"com.github.benmanes.caffeine.cache.CacheLoader", | ||
"methods":[{"name":"asyncLoadAll","parameterTypes":["java.lang.Iterable","java.util.concurrent.Executor"] }, {"name":"loadAll","parameterTypes":["java.lang.Iterable"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.LocalLoadingCache"}, | ||
"name":"com.github.benmanes.caffeine.cache.CacheLoader", | ||
"methods":[{"name":"loadAll","parameterTypes":["java.lang.Iterable"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.FW"}, | ||
"name":"com.github.benmanes.caffeine.cache.FW", | ||
"fields":[{"name":"value"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.WI"}, | ||
"name":"com.github.benmanes.caffeine.cache.FW", | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.PD"}, | ||
"name":"com.github.benmanes.caffeine.cache.PD", | ||
"fields":[{"name":"value"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.PS"}, | ||
"name":"com.github.benmanes.caffeine.cache.PS", | ||
"fields":[{"name":"key"}, {"name":"value"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.PSA"}, | ||
"name":"com.github.benmanes.caffeine.cache.PSA", | ||
"fields":[{"name":"accessTime"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.SSA"}, | ||
"name":"com.github.benmanes.caffeine.cache.PSA", | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.SSSMS"}, | ||
"name":"com.github.benmanes.caffeine.cache.PSMS", | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.SSMW"}, | ||
"name":"com.github.benmanes.caffeine.cache.PSMW", | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.PSR"}, | ||
"name":"com.github.benmanes.caffeine.cache.PSR", | ||
"fields":[{"name":"writeTime"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.SSMSR"}, | ||
"name":"com.github.benmanes.caffeine.cache.PSRMS", | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.PSW"}, | ||
"name":"com.github.benmanes.caffeine.cache.PSW", | ||
"fields":[{"name":"writeTime"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.SSA"}, | ||
"name":"com.github.benmanes.caffeine.cache.PSW", | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.SSW"}, | ||
"name":"com.github.benmanes.caffeine.cache.PSW", | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.SSSMW"}, | ||
"name":"com.github.benmanes.caffeine.cache.PSWMW", | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.PW"}, | ||
"name":"com.github.benmanes.caffeine.cache.PW", | ||
"fields":[{"name":"value"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalManualCache"}, | ||
"name":"com.github.benmanes.caffeine.cache.SI", | ||
"methods":[{"name":"<init>","parameterTypes":["com.github.benmanes.caffeine.cache.Caffeine","com.github.benmanes.caffeine.cache.CacheLoader","boolean"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache"}, | ||
"name":"com.github.benmanes.caffeine.cache.SSA", | ||
"methods":[{"name":"<init>","parameterTypes":["com.github.benmanes.caffeine.cache.Caffeine","com.github.benmanes.caffeine.cache.CacheLoader","boolean"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache"}, | ||
"name":"com.github.benmanes.caffeine.cache.SSMS", | ||
"methods":[{"name":"<init>","parameterTypes":["com.github.benmanes.caffeine.cache.Caffeine","com.github.benmanes.caffeine.cache.CacheLoader","boolean"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache"}, | ||
"name":"com.github.benmanes.caffeine.cache.SSMSR", | ||
"methods":[{"name":"<init>","parameterTypes":["com.github.benmanes.caffeine.cache.Caffeine","com.github.benmanes.caffeine.cache.CacheLoader","boolean"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.LocalCacheFactory"}, | ||
"name":"com.github.benmanes.caffeine.cache.SSMSW", | ||
"methods":[{"name":"<init>","parameterTypes":["com.github.benmanes.caffeine.cache.Caffeine","com.github.benmanes.caffeine.cache.CacheLoader","boolean"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache"}, | ||
"name":"com.github.benmanes.caffeine.cache.SSMW", | ||
"methods":[{"name":"<init>","parameterTypes":["com.github.benmanes.caffeine.cache.Caffeine","com.github.benmanes.caffeine.cache.CacheLoader","boolean"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalManualCache"}, | ||
"name":"com.github.benmanes.caffeine.cache.SSSMS", | ||
"methods":[{"name":"<init>","parameterTypes":["com.github.benmanes.caffeine.cache.Caffeine","com.github.benmanes.caffeine.cache.CacheLoader","boolean"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache"}, | ||
"name":"com.github.benmanes.caffeine.cache.SSSMWW", | ||
"methods":[{"name":"<init>","parameterTypes":["com.github.benmanes.caffeine.cache.Caffeine","com.github.benmanes.caffeine.cache.CacheLoader","boolean"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache"}, | ||
"name":"com.github.benmanes.caffeine.cache.SSW", | ||
"methods":[{"name":"<init>","parameterTypes":["com.github.benmanes.caffeine.cache.Caffeine","com.github.benmanes.caffeine.cache.CacheLoader","boolean"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.StripedBuffer"}, | ||
"name":"com.github.benmanes.caffeine.cache.StripedBuffer", | ||
"fields":[{"name":"tableBusy"}] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache"}, | ||
"name":"com.github.benmanes.caffeine.cache.WI", | ||
"methods":[{"name":"<init>","parameterTypes":["com.github.benmanes.caffeine.cache.Caffeine","com.github.benmanes.caffeine.cache.CacheLoader","boolean"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.StripedBuffer"}, | ||
"name":"java.lang.Thread", | ||
"fields":[{"name":"threadLocalRandomProbe"}] | ||
}, | ||
|
||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.UnsafeAccess"}, | ||
"name":"sun.misc.Unsafe", | ||
"fields":[{"name":"theUnsafe"}] | ||
},{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.NodeFactory"}, | ||
"name":"com.github.benmanes.caffeine.cache.PSWMS", | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalManualCache"}, | ||
"name":"com.github.benmanes.caffeine.cache.SI", | ||
"methods":[{"name":"<init>","parameterTypes":["com.github.benmanes.caffeine.cache.Caffeine","com.github.benmanes.caffeine.cache.AsyncCacheLoader","boolean"] }] | ||
}, | ||
{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.NodeFactory"}, | ||
"name":"com.github.benmanes.caffeine.cache.PD", | ||
"fields":[{"name":"value"}], | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
},{ | ||
"condition":{"typeReachable":"com.github.benmanes.caffeine.cache.NodeFactory"}, | ||
"name":"com.github.benmanes.caffeine.cache.PW", | ||
"fields":[{"name":"value"}], | ||
"methods":[{"name":"<init>","parameterTypes":[] }] | ||
} | ||
] |
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
4 changes: 4 additions & 0 deletions
4
tests/src/com.github.ben-manes.caffeine/caffeine/2.9.3/.gitignore
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
gradlew.bat | ||
gradlew | ||
gradle/ | ||
build/ |
36 changes: 36 additions & 0 deletions
36
tests/src/com.github.ben-manes.caffeine/caffeine/2.9.3/build.gradle
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright and related rights waived via CC0 | ||
* | ||
* You should have received a copy of the CC0 legalcode along with this | ||
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
*/ | ||
|
||
plugins { | ||
id "org.graalvm.internal.tck" | ||
} | ||
|
||
String libraryVersion = tck.testedLibraryVersion.get() | ||
|
||
dependencies { | ||
testImplementation "com.github.ben-manes.caffeine:caffeine:$libraryVersion" | ||
testImplementation 'org.assertj:assertj-core:3.22.0' | ||
testImplementation 'io.reactivex.rxjava3:rxjava:3.1.6' | ||
testImplementation 'org.awaitility:awaitility:4.2.0' | ||
testImplementation 'com.google.guava:guava-testlib:32.1.2-jre' | ||
} | ||
|
||
graalvmNative { | ||
agent { | ||
defaultMode = "conditional" | ||
modes { | ||
conditional { | ||
userCodeFilterPath = "user-code-filter.json" | ||
} | ||
} | ||
metadataCopy { | ||
mergeWithExisting = true | ||
inputTaskNames.add("test") | ||
outputDirectories.add("src/test/resources/META-INF/native-image/com.github.ben-manes.caffeine/caffeine") | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
tests/src/com.github.ben-manes.caffeine/caffeine/2.9.3/gradle.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
library.version = 2.9.3 | ||
metadata.dir = com.github.ben-manes.caffeine/caffeine/2.9.3/ |
13 changes: 13 additions & 0 deletions
13
tests/src/com.github.ben-manes.caffeine/caffeine/2.9.3/settings.gradle
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
pluginManagement { | ||
def tckPath = Objects.requireNonNullElse( | ||
System.getenv("GVM_TCK_TCKDIR"), | ||
"../../../../tck-build-logic" | ||
) | ||
includeBuild(tckPath) | ||
} | ||
|
||
plugins { | ||
id "org.graalvm.internal.tck-settings" version "1.0.0-SNAPSHOT" | ||
} | ||
|
||
rootProject.name = 'com.github.ben-manes.caffeine.caffeine_tests' |
74 changes: 74 additions & 0 deletions
74
...ine/caffeine/2.9.3/src/test/java/com_github_ben_manes_caffeine/caffeine/CaffeineTest.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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright and related rights waived via CC0 | ||
* | ||
* You should have received a copy of the CC0 legalcode along with this | ||
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | ||
*/ | ||
package com_github_ben_manes_caffeine.caffeine; | ||
|
||
import com.github.benmanes.caffeine.cache.Cache; | ||
import com.github.benmanes.caffeine.cache.Caffeine; | ||
import com.github.benmanes.caffeine.cache.CaffeineSpec; | ||
import com.github.benmanes.caffeine.cache.LoadingCache; | ||
import com.github.benmanes.caffeine.cache.Scheduler; | ||
import com.google.common.testing.FakeTicker; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.lang.ref.Cleaner; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class CaffeineTest { | ||
@Test | ||
void testRefresh() { | ||
LoadingCache<String, String> graphs = Caffeine.newBuilder().maximumSize(10_000).refreshAfterWrite(1, TimeUnit.MINUTES) | ||
.build(key -> key.equals("Hello") ? "World" : "Universe"); | ||
assertThat(graphs.get("Hello")).isEqualTo("World"); | ||
assertThat(graphs.getAll(List.of("Hi", "Aloha"))).isEqualTo(Map.of("Hi", "Universe", "Aloha", "Universe")); | ||
} | ||
|
||
@Test | ||
void testStatistics() { | ||
Cache<String, String> graphs = Caffeine.newBuilder().maximumSize(10_000).recordStats().build(); | ||
graphs.put("Hello", "World"); | ||
assertThat(graphs.getIfPresent("Hello")).isEqualTo("World"); | ||
} | ||
|
||
@Test | ||
void testSpecification() { | ||
CaffeineSpec spec = CaffeineSpec.parse("maximumWeight=1000, expireAfterWrite=10m, recordStats"); | ||
LoadingCache<String, String> graphs = Caffeine.from(spec).weigher((String key, String graph) -> graph.length()) | ||
.build(key -> key.equals("Hello") ? "World" : "Universe"); | ||
assertThat(graphs.get("Hello")).isEqualTo("World"); | ||
} | ||
|
||
@Test | ||
void testCleanup() { | ||
LoadingCache<String, String> firstGraphs = Caffeine.newBuilder().scheduler(Scheduler.systemScheduler()).expireAfterWrite(10, TimeUnit.MINUTES) | ||
.build(key -> key.equals("Hello") ? "World" : "Universe"); | ||
firstGraphs.put("Hello", "World"); | ||
assertThat(firstGraphs.getIfPresent("Hello")).isEqualTo("World"); | ||
Cache<String, String> secondGraphs = Caffeine.newBuilder().weakValues().build(); | ||
Cleaner cleaner = Cleaner.create(); | ||
cleaner.register("World", secondGraphs::cleanUp); | ||
secondGraphs.put("Hello", "World"); | ||
assertThat(secondGraphs.getIfPresent("Hello")).isEqualTo("World"); | ||
} | ||
|
||
@Test | ||
void testTesting() { | ||
FakeTicker ticker = new FakeTicker(); | ||
Cache<String, String> cache = Caffeine.newBuilder() | ||
.expireAfterWrite(10, TimeUnit.MINUTES) | ||
.executor(Runnable::run) | ||
.ticker(ticker::read) | ||
.maximumSize(10) | ||
.build(); | ||
cache.put("Hello", "World"); | ||
ticker.advance(30, TimeUnit.MINUTES); | ||
assertThat(cache.getIfPresent("Hello")).isNull(); | ||
} | ||
} |
Oops, something went wrong.