Skip to content

Commit c571207

Browse files
committed
Add tests that Jandex index loads with contents
1 parent fe0131b commit c571207

File tree

6 files changed

+145
-3
lines changed

6 files changed

+145
-3
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ subprojects {
6565

6666
dependencies {
6767
testImplementation libraries.guava
68+
testImplementation libraries.jandex
6869
testImplementation testLibraries.mockito
6970
testImplementation testLibraries.hamcrest
7071
testImplementation testLibraries.awaitility
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright 2020 Ben Manes. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.github.benmanes.caffeine;
17+
18+
import static org.hamcrest.MatcherAssert.assertThat;
19+
import static org.hamcrest.Matchers.empty;
20+
import static org.hamcrest.Matchers.is;
21+
import static org.hamcrest.Matchers.not;
22+
23+
import java.io.IOException;
24+
import java.io.InputStream;
25+
import java.util.Collection;
26+
27+
import org.jboss.jandex.ClassInfo;
28+
import org.jboss.jandex.DotName;
29+
import org.jboss.jandex.Index;
30+
import org.jboss.jandex.IndexReader;
31+
import org.testng.annotations.Test;
32+
33+
/**
34+
* @author [email protected] (Ben Manes)
35+
*/
36+
public final class JandexTest {
37+
38+
@Test
39+
public void loadIndex() throws IOException {
40+
try (InputStream input = getClass().getResourceAsStream("/META-INF/jandex.idx")) {
41+
Index index = new IndexReader(input).read();
42+
assertThat(index.getKnownClasses(), is(not(empty())));
43+
44+
Collection<ClassInfo> caches = index.getAllKnownSubclasses(DotName.createSimple(
45+
"com.github.benmanes.caffeine.cache.BoundedLocalCache"));
46+
assertThat(caches, is(not(empty())));
47+
}
48+
}
49+
}

checksum.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,18 @@
391391
<dependency group='org.codehaus.jackson' module='jackson-mapper-asl' version='1.9.4'>
392392
<sha512>C3E9D22597510BBB2960D8219CBA762293262F1418C5DB830A2BC28B3A9D75B58317FCE868029F10EA3149B59A3C8A6ACE5C6C0D48D58A543CC465014AA18956</sha512>
393393
</dependency>
394+
<dependency group='org.jboss' module='jandex' version='2.0.1.Final'>
395+
<sha512>5E95C4C5B28EFCBAE4BEED6D35317A84E191F1782BA6C462575D53188295B740ED7D5FF1E538FC8A31FC972BFA5603C01A3FF34FB1DCB188782AA34EEEEDEBEA</sha512>
396+
</dependency>
394397
<dependency group='org.jboss' module='jandex' version='2.2.1.Final'>
395398
<sha512>D0D63D9B78AF292EF9167871598A345EF2F10B91DC0CD1E2B5B827AC6D57CF9AF40567ED59AFD6E434B4647C05FABC42CA6D9DD7417A5252E49EF3BBD21B16A6</sha512>
396399
</dependency>
397400
<dependency group='org.kordamp.gradle' module='jandex-gradle-plugin' version='0.6.0'>
398401
<sha512>93F5BF49FE5125BAFC561892F038BE371420B81F9FB210CAC31606C7868418F3CA9F133F3AC0C7D568CC1399468BF0FB54E32B6B0000AE1288A68E836B8D817E</sha512>
399402
</dependency>
403+
<dependency group='org.kordamp.gradle' module='jandex-gradle-plugin' version='0.7.0'>
404+
<sha512>4CF33A1093AA77448C71E16C989C2357AC96E473E75C2BDC65987484B526C1DC60594BB73E085A245BFD92AC0AF5C06300C302A111FF2D735068A418F685BF5D</sha512>
405+
</dependency>
400406
<dependency group='org.ow2.asm' module='asm-analysis' version='7.0'>
401407
<sha512>1A6CA169E9E2D29256F9C45570D89E5B039EAF7D405CCB3F7F79926552F2A0818975CE2C6ADCE3F1F59E28172E4303A1C790C52AB06263C61C9C8181FF279CEE</sha512>
402408
</dependency>

gradle/dependencies.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
ext {
2727
versions = [
2828
akka: '2.6.9',
29-
cache2k: '1.5.1.Alpha',
29+
cache2k: '1.6.0.Final',
3030
checkerFramework: '3.7.0',
3131
coherence: '20.06',
3232
collision: '0.3.3',
@@ -46,6 +46,7 @@ ext {
4646
googleJavaFormat: '1.7',
4747
guava: '29.0-jre',
4848
jackrabbit: '1.34.0',
49+
jandex: '2.2.1.Final',
4950
jamm: '0.3.3',
5051
javaObjectLayout: '0.13',
5152
javapoet: '1.13.0',
@@ -71,7 +72,7 @@ ext {
7172
jctools: '3.1.0',
7273
junit: '4.13',
7374
mockito: '3.5.13',
74-
paxExam: '4.13.3',
75+
paxExam: '4.13.4',
7576
testng: '7.3.0',
7677
truth: '0.24',
7778
felix: '6.0.3',
@@ -86,7 +87,7 @@ ext {
8687
coverity: '1.0.10',
8788
errorprone: '1.2.1',
8889
jacoco: '0.8.5',
89-
jandex: '0.6.0',
90+
jandex: '0.7.0',
9091
jmh: '0.5.2',
9192
jmhReport: '0.9.0',
9293
nullaway: '1.0.2',
@@ -126,6 +127,7 @@ ext {
126127
jackrabbit: dependencies.create("org.apache.jackrabbit:oak-core:${versions.jackrabbit}") {
127128
exclude group: 'junit'
128129
},
130+
jandex: "org.jboss:jandex:${versions.jandex}",
129131
jamm: "com.github.jbellis:jamm:${versions.jamm}",
130132
javaObjectLayout: "org.openjdk.jol:jol-cli:${versions.javaObjectLayout}",
131133
javapoet: "com.squareup:javapoet:${versions.javapoet}",
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright 2020 Ben Manes. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.github.benmanes.caffeine.guava;
17+
18+
import static org.hamcrest.MatcherAssert.assertThat;
19+
import static org.hamcrest.Matchers.empty;
20+
import static org.hamcrest.Matchers.is;
21+
import static org.hamcrest.Matchers.not;
22+
23+
import java.io.IOException;
24+
import java.io.InputStream;
25+
26+
import org.jboss.jandex.Index;
27+
import org.jboss.jandex.IndexReader;
28+
import org.junit.Test;
29+
30+
/**
31+
* @author [email protected] (Ben Manes)
32+
*/
33+
public final class JandexTest {
34+
35+
@Test
36+
public void loadIndex() throws IOException {
37+
try (InputStream input = getClass().getResourceAsStream("/META-INF/jandex.idx")) {
38+
Index index = new IndexReader(input).read();
39+
assertThat(index.getKnownClasses(), is(not(empty())));
40+
}
41+
}
42+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright 2020 Ben Manes. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.github.benmanes.caffeine.jcache;
17+
18+
import static org.hamcrest.MatcherAssert.assertThat;
19+
import static org.hamcrest.Matchers.empty;
20+
import static org.hamcrest.Matchers.is;
21+
import static org.hamcrest.Matchers.not;
22+
23+
import java.io.IOException;
24+
import java.io.InputStream;
25+
26+
import org.jboss.jandex.Index;
27+
import org.jboss.jandex.IndexReader;
28+
import org.testng.annotations.Test;
29+
30+
/**
31+
* @author [email protected] (Ben Manes)
32+
*/
33+
public final class JandexTest {
34+
35+
@Test
36+
public void loadIndex() throws IOException {
37+
try (InputStream input = getClass().getResourceAsStream("/META-INF/jandex.idx")) {
38+
Index index = new IndexReader(input).read();
39+
assertThat(index.getKnownClasses(), is(not(empty())));
40+
}
41+
}
42+
}

0 commit comments

Comments
 (0)