Skip to content

Commit

Permalink
chore: add index for JDK 21 and 17 temurin (#168)
Browse files Browse the repository at this point in the history
* chore: add index for JDK 21.0.2+13 Temurin

* chore: add index for JDK 17.0.10+7 Temurin
  • Loading branch information
algomaster99 authored Mar 7, 2024
1 parent d7beeb1 commit 61a8650
Show file tree
Hide file tree
Showing 3 changed files with 49,615 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -35,19 +36,36 @@ void jdkIndexShouldBeDeterministic_irrespectiveOfTheJDK(@TempDir Path tempDir) t

@EnabledOnJre(JRE.JAVA_21)
@Test
void jdkIndexShouldHave__jdk_internal_foreign_MemorySessionImpl__and__java_lang_foreign_MemorySegment$Scope(
@TempDir Path tempDir) {
void jdk21_0_2_indexShouldBeReproducible_temurin(@TempDir Path tempDir) throws IOException {
// arrange
Path indexFile = tempDir.resolve("jdk.json");
Path actualIndex = tempDir.resolve("jdk.jsonl");
Path expectedIndex = Path.of("src", "test", "resources", "jdk-index", "21.0.2-tem.jsonl");

// act
String[] args = {"jdk", "-o", indexFile.toString()};
String[] args = {"jdk", "-o", actualIndex.toString()};
Index.main(args);

// assert
Map<String, Set<ClassFileAttributes>> referenceProvenance = ParsingHelper.deserializeFingerprints(indexFile);
assertThat(referenceProvenance)
.containsKeys("jdk/internal/foreign/MemorySessionImpl", "java/lang/foreign/MemorySegment$Scope");
List<String> actual = Files.readAllLines(actualIndex);
List<String> expected = Files.readAllLines(expectedIndex);
assertThat(actual).isEqualTo(expected);
}

@EnabledOnJre(JRE.JAVA_17)
@Test
void jdk17_0_10_indexShouldBeReproducibleAcrossMultiple_implementations(@TempDir Path tempDir) throws IOException {
// arrange
Path actualIndex = tempDir.resolve("jdk.jsonl");
Path expectedIndex = Path.of("src", "test", "resources", "jdk-index", "17.0.10-tem.jsonl");

// act
String[] args = {"jdk", "-o", actualIndex.toString()};
Index.main(args);

// assert
List<String> actual = Files.readAllLines(actualIndex);
List<String> expected = Files.readAllLines(expectedIndex);
assertThat(actual).isEqualTo(expected);
}

@Test
Expand Down
Loading

0 comments on commit 61a8650

Please sign in to comment.