Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
--health-retries 5
strategy:
matrix:
java: ['21', '17', '11', '8']
java: ['25', '21', '17', '11', '8']
runs-on: ubuntu-latest
name: Run test suite with Java ${{ matrix.java }}
needs: build-and-check
Expand Down
18 changes: 17 additions & 1 deletion agent/bin/test_projects
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,23 @@ else
install_petclinic "land-of-apps/spring-petclinic" old-java-support
fi

patch -N -p1 -d build/fixtures/spring-petclinic < test/petclinic/pom.patch
# Select the appropriate patch file based on Java version
if is_java 25; then
PATCH_FILE="test/petclinic/pom-java25.patch"
else
PATCH_FILE="test/petclinic/pom.patch"
fi

# Apply patch, but only ignore if already applied (not other failures)
if ! patch -N -p1 -d build/fixtures/spring-petclinic < "$PATCH_FILE" 2>&1 | tee /tmp/patch_output.txt; then
if grep -q "Reversed (or previously applied) patch detected" /tmp/patch_output.txt; then
echo "Patch already applied, continuing..."
else
echo "ERROR: Patch failed to apply!"
cat /tmp/patch_output.txt
exit 1
fi
fi


install_scala_test_app
2 changes: 1 addition & 1 deletion agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependencies {
implementation 'com.alibaba:fastjson:1.2.83'
implementation "org.javassist:javassist:${javassistVersion}"
implementation 'org.reflections:reflections:0.10.2'
implementation 'net.bytebuddy:byte-buddy:1.14.10'
implementation 'net.bytebuddy:byte-buddy:1.18.4'
implementation 'org.apache.commons:commons-lang3:3.20.0'
implementation 'commons-io:commons-io:2.15.1'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.16.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ default Enumeration<String> getHeaderNames() {

/**
* Non-standard utility method. Retrieves all headers.
* Header names are normalized to lowercase since HTTP headers are case-insensitive.
*/
default Map<String, String> getHeaders() {
HashMap<String, String> headers = new HashMap<>();

for (Enumeration<String> e = getHeaderNames(); e.hasMoreElements();) {
String headerName = (String) e.nextElement();
headers.put(headerName, this.getHeader(headerName));
headers.put(headerName.toLowerCase(), this.getHeader(headerName));
}

return headers;
Expand Down
8 changes: 0 additions & 8 deletions agent/test/classloading/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ dependencies {
implementation files(appmapJar)
}

// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}


application {
// Define the main class for the application.
mainClass = 'com.appland.appmap.test.fixture.Runner'
Expand Down
7 changes: 0 additions & 7 deletions agent/test/classloading/lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,3 @@ repositories {

dependencies {
}

// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
14 changes: 0 additions & 14 deletions agent/test/classloading/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
/*
* This file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user manual at https://docs.gradle.org/8.1.1/userguide/multi_project_builds.html
*/

plugins {
// Apply the foojay-resolver plugin to allow automatic download of JDKs
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0'
}

rootProject.name = 'classloading'
include 'app', 'lib'
12 changes: 11 additions & 1 deletion agent/test/gretty-tomcat/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
buildscript {
ext {
if (GradleVersion.current() >= GradleVersion.version('9.0')) {
grettyVersion = '5.0.1'
} else {
grettyVersion = '4.1.6'
}
}
}

plugins {
id 'war'
id 'org.gretty' version '4.1.6'
id 'org.gretty' version "${grettyVersion}"
}

repositories {
Expand Down
8 changes: 7 additions & 1 deletion agent/test/helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,13 @@ find_annotation_jar() {
export ANNOTATION_JAR="$(find_annotation_jar)"

# absolute gradle wrapper path (in the same directory as this file)
GRADLE_WRAPPER="$TOP_LEVEL/agent/test/gradlew"
if is_java 25; then
# use 9.1 for newer java
GRADLE_WRAPPER="$TOP_LEVEL/gradlew"
else
# this is 8.5 for older javas
GRADLE_WRAPPER="$TOP_LEVEL/agent/test/gradlew"
fi

# Shared gradle wrapper function
gradlew() {
Expand Down
8 changes: 5 additions & 3 deletions agent/test/http_client/httpclient/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ dependencies {
}

application {
// mainClass = 'http_client.HttpClientTest'
mainClassName = project.hasProperty("mainClass") ? project.getProperty("mainClass") : "NULL"
if (properties.containsKey("mainClass")) {
mainClass = project.hasProperty("mainClass") ? project.getProperty("mainClass") : "NULL"
} else {
mainClassName = project.hasProperty("mainClass") ? project.getProperty("mainClass") : "NULL"
}
applicationDefaultJvmArgs = [
System.env.JAVA_OUTPUT_OPTIONS,
"-javaagent:${appmapJar}",
"-Djava.util.logging.config.file=${System.env.JUL_CONFIG}",
//"-Dappmap.debug=true",
//"-Dappmap.debug.file=../../build/log/httpclient-appmap.log"
]

}
7 changes: 0 additions & 7 deletions agent/test/http_client/setup_suite.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ setup_suite() {
export FIXTURE_DIR="build/fixtures/spring-petclinic"
_shared_setup
start_petclinic >&3

if is_java 17; then
SPRING_BOOT_VERSION="3.2.2"
else
SPRING_BOOT_VERSION="2.7.18"
fi
export SPRING_BOOT_VERSION
}

teardown_suite() {
Expand Down
19 changes: 17 additions & 2 deletions agent/test/http_client/springboot/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
buildscript {
ext {
if (JavaVersion.current() >= JavaVersion.VERSION_17) {
SPRING_BOOT_VERSION = '3.4.1'
javaCompatibility = JavaVersion.VERSION_17
} else {
SPRING_BOOT_VERSION = '2.7.18'
javaCompatibility = JavaVersion.VERSION_1_8
}
}
}

plugins {
id 'java'
id 'org.springframework.boot' version "${SPRING_BOOT_VERSION}"
id 'io.spring.dependency-management' version '1.1.4'

id 'io.spring.dependency-management' version '1.1.7'
}

repositories {
mavenCentral()
}

java {
sourceCompatibility = javaCompatibility
targetCompatibility = javaCompatibility
}

sourceSets {
main {
java {
Expand Down
1 change: 1 addition & 0 deletions agent/test/intellij/intellij.bats
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ init_plugin() {

setup_file() {
is_java 17 || skip "needs Java 17"
is_java 25 && skip "incompatible with Java 25"

export AGENT_JAR="$(find_agent_jar)"

Expand Down
39 changes: 33 additions & 6 deletions agent/test/jdbc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
buildscript {
ext {
if (JavaVersion.current() >= JavaVersion.VERSION_25) {
springBootVersion = '3.1.4'
javaVersion = JavaVersion.VERSION_17
} else {
springBootVersion = '2.7.0'
javaVersion = JavaVersion.VERSION_1_8
}
}
}

plugins {
id 'org.springframework.boot' version '2.7.0'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'org.springframework.boot' version "${springBootVersion}"
id 'io.spring.dependency-management' version '1.1.7'
id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

// suppress warnings about source compatibility
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:-options'
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}

repositories {
Expand All @@ -22,10 +33,26 @@ dependencies {
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.oracle.database.jdbc:ojdbc8:21.9.0.0'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

def appmapJar = "$System.env.AGENT_JAR"

// Spring boot 3.x uses Jakarta EE namespaces
task transformSources(type: Copy) {
from 'src/main/java'
into "$buildDir/generated-sources/transformed"

if (springBootVersion.startsWith("3.")) {
filter { line ->
line.replaceAll('javax.persistence', 'jakarta.persistence')
}
}
}

sourceSets.main.java.srcDirs = [transformSources.destinationDir]
compileJava.dependsOn transformSources

test {
useJUnitPlatform()
if (System.env.ORACLE_URL) {
Expand Down
8 changes: 5 additions & 3 deletions agent/test/petclinic/petclinic-tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ run_petclinic_test() {
run cat ./tmp/appmap/junit/org_springframework_samples_petclinic_${TEST_NAME}_testOwnerDetails.appmap.json
assert_success

# Thread 1 is the test runner's main thread. Check to make sure that parent_id
# of the "return" event matches the id of the "call" event.
assert_json_eq '.events | map(select(.thread_id == 1)) | ((.[0].event == "call" and .[1].event == "return") and (.[1].parent_id == .[0].id))' "true"
# Find the test runner's main thread (the one with testOwnerDetails method).
# Check to make sure that parent_id of the "return" event matches the id of the "call" event.
# Note: In Java 21 the main thread is typically thread 1, but in Java 25 it can be thread 3.
local main_thread_id=$(jq -r '[.events[] | select(.method_id == "testOwnerDetails")][0].thread_id' ./tmp/appmap/junit/org_springframework_samples_petclinic_${TEST_NAME}_testOwnerDetails.appmap.json)
assert_json_eq ".events | map(select(.thread_id == ${main_thread_id})) | ((.[0].event == \"call\" and .[1].event == \"return\") and (.[1].parent_id == .[0].id))" "true"
}

@test "extra properties in appmap.yml are ignored when config is loaded" {
Expand Down
3 changes: 2 additions & 1 deletion agent/test/petclinic/petclinic.bats
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ setup() {
assert_success
stop_recording

assert_json_eq '.events[] | .http_server_response | .headers["Content-Type"]' "text/html;charset=UTF-8"
# HTTP headers are case-insensitive and are normalized to lowercase
assert_json_eq '.events[] | .http_server_response | .headers["content-type"]' "text/html;charset=UTF-8"
}

@test "recordings capture elapsed time" {
Expand Down
55 changes: 55 additions & 0 deletions agent/test/petclinic/pom-java25.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
diff --git a/pom.xml b/pom.xml
index fb38cc3..6cb8530 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,6 +65,23 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.appland</groupId>
+ <artifactId>annotation</artifactId>
+ <version>LATEST</version>
+ <scope>system</scope>
+ <systemPath>${env.ANNOTATION_JAR}</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
</dependency>

<dependency>
@@ -407,5 +424,26 @@
</pluginManagement>
</build>
</profile>
+ <profile>
+ <id>tomcat</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jetty</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jetty</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
</project>
Loading
Loading