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
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'

- name: Setup Gradle
Expand All @@ -33,7 +33,7 @@ jobs:
test-suite:
strategy:
matrix:
java: ['17', '11', '8']
java: ['21', '17', '11', '8']
runs-on: ubuntu-latest
name: Run test suite with Java ${{ matrix.java }}
needs: build-and-check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-java@v5
with:
java-version: "17"
java-version: "21"
distribution: "temurin"
cache: gradle
- name: Setup node
Expand Down
2 changes: 0 additions & 2 deletions agent/bin/test_install
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ for d in build/fixtures/*; do
./mvnw package -quiet -DskipTests -Dcheckstyle.skip=true -Dspring-javaformat.skip=true
cd -
done

../gradlew testClasses
28 changes: 14 additions & 14 deletions agent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ plugins {
}

repositories {
jcenter()
mavenCentral()
}

Expand Down Expand Up @@ -75,6 +74,7 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.junit.jupiter:junit-jupiter-params'
testImplementation 'org.junit.vintage:junit-vintage-engine'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

testImplementation 'com.github.stefanbirkner:system-rules:1.19.0'
testImplementation 'com.github.stefanbirkner:system-lambda:1.2.1'
Expand All @@ -85,8 +85,7 @@ dependencies {
}

compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
options.release = 8
}

jar {
Expand All @@ -97,11 +96,11 @@ jar {
}
}

apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.gradleup.shadow'

shadowJar {
baseName = 'appmap'
classifier = ''
archiveBaseName = 'appmap'
archiveClassifier = ''
minimize() {
// tinylog computes the dependencies it needs at runtime, so don't exclude
// anything.
Expand Down Expand Up @@ -162,6 +161,7 @@ test {
dependsOn cleanTest
exclude 'com/appland/appmap/integration/**'
// systemProperty "appmap.log.level", "debug"
jvmArgs '--add-opens', 'java.base/java.lang=ALL-UNNAMED'
}

task relocateShadowJar(type: ShadowRelocation) {
Expand All @@ -179,16 +179,16 @@ tasks.shadowJar.dependsOn tasks.relocateShadowJar

jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.enabled true
xml.required = false
csv.required = false
html.required = true
}
}

// extra artifacts used in publishing
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
classifier = 'sources'
archiveClassifier = 'sources'
}

// for some reason this block generates empty Javadoc
Expand All @@ -198,7 +198,7 @@ javadoc {
}

task mockJavadocJar(type: Jar) {
classifier = 'javadoc'
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}

Expand All @@ -212,8 +212,8 @@ publishing {

// 1. coordinates (parameterized)

groupId publishGroupId
artifactId publishArtifactId
groupId = publishGroupId
artifactId = publishArtifactId

// version defined globally

Expand Down Expand Up @@ -271,4 +271,4 @@ if (project.hasProperty("signingKey")) {
}
}

tasks.publishToMavenLocal.dependsOn(check, integrationTest)
tasks.publishToMavenLocal.dependsOn(check, integrationTest)
20 changes: 20 additions & 0 deletions agent/test/access/MyClass.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package access;

public class MyClass {
public void myMethod() {
// do nothing
}

public void callNonPublic() {
myPackageMethod();
myPrivateMethod();
}

String myPackageMethod() {
return "package method";
}

private String myPrivateMethod() {
return "private method";
}
}
3 changes: 2 additions & 1 deletion agent/test/access/RecordPackage.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package access;

import java.io.IOException;
import java.io.OutputStreamWriter;

import com.appland.appmap.record.Recorder;
import com.appland.appmap.record.Recording;
import com.appland.appmap.test.fixture.MyClass;

public class RecordPackage {
public static void main(String[] argv) {
Expand Down
21 changes: 12 additions & 9 deletions agent/test/access/access.bats
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ load '../helper'

sep="$JAVA_PATH_SEPARATOR"
AGENT_JAR="$(find_agent_jar)"
wd=$(getcwd)
test_cp="${wd}/test/access${sep}${wd}/build/classes/java/test"

# Resolves to .../agent/test
TEST_DIR="$(dirname "$BATS_TEST_DIRNAME")"

# test_cp must include 'test' (for access package) and 'test/access' (for default package)
test_cp="${TEST_DIR}${sep}${TEST_DIR}/access"
java_cmd="java -javaagent:'${AGENT_JAR}' -cp '${test_cp}'"

setup() {
javac -cp "${AGENT_JAR}${sep}${test_cp}" test/access/*.java

cd test/access
cd "$BATS_TEST_DIRNAME" || exit
javac -cp "${AGENT_JAR}" -sourcepath "$TEST_DIR" ./*.java
_configure_logging
}

Expand All @@ -22,7 +25,7 @@ setup() {
# functionaly it enables is pretty useless, though, so it seems harmless to
# hijack it.
@test "testProtected" {
local cmd="${java_cmd} RecordPackage"
local cmd="${java_cmd} access.RecordPackage"
[[ $BATS_VERBOSE_RUN == 1 ]] && echo "cmd: $cmd" >&3

# Exactly 4 events means that MyClass.myPrivateMethod was not recorded
Expand All @@ -31,7 +34,7 @@ setup() {
}

@test "testPrivate" {
local cmd="${java_cmd} -Dappmap.record.private=true RecordPackage"
local cmd="${java_cmd} -Dappmap.record.private=true access.RecordPackage"
[[ $BATS_VERBOSE_RUN == 1 ]] && echo "cmd: $cmd" >&3

# 6 events means that both myPackageMethod and myPrivateMethod were recorded
Expand All @@ -40,15 +43,15 @@ setup() {
}

@test "outside git repo" {
cp -v "$(_top_level)/agent/appmap.yml" "$BATS_TEST_TMPDIR"/.
cp -v "appmap.yml" "$BATS_TEST_TMPDIR"/.
cd "$BATS_TEST_TMPDIR"

# sanity check
run git rev-parse --show-top-level
assert_output -p 'not a git repository'
assert_failure

local cmd="${java_cmd} RecordPackage"
local cmd="${java_cmd} access.RecordPackage"
[[ $BATS_VERBOSE_RUN == 1 ]] && echo "cmd: $cmd" >&3
run bash -c "eval \"$cmd\" 2>/dev/null"
assert_success
Expand Down
2 changes: 1 addition & 1 deletion agent/test/access/appmap.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test-access
packages:
- path: com.appland.appmap.test.fixture
- path: access
- path: HelloWorld
4 changes: 2 additions & 2 deletions agent/test/event/DisabledValue.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package event;

import java.io.IOException;
import java.io.OutputStreamWriter;

import com.appland.appmap.record.Recorder;
import com.appland.appmap.record.Recording;

import com.appland.appmap.test.fixture.Example;

public class DisabledValue {

public static void main(String[] argv) {
Expand Down
12 changes: 12 additions & 0 deletions agent/test/event/Example.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package event;

public class Example {
@Override
public String toString() {
return "an Example";
}

public Example doSomething(Example other) {
return other;
}
}
2 changes: 1 addition & 1 deletion agent/test/event/appmap.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: test-event
packages:
- path: com.appland.appmap.test.fixture
- path: event
15 changes: 7 additions & 8 deletions agent/test/event/event.bats
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@

load '../helper'

sep="$JAVA_PATH_SEPARATOR"
AGENT_JAR="$(find_agent_jar)"
wd=$(getcwd)
test_cp="${wd}/test/event${sep}${wd}/build/classes/java/test"
java_cmd="java -javaagent:'${AGENT_JAR}' -cp '${test_cp}'"

setup() {
javac -cp "${AGENT_JAR}${sep}${test_cp}" test/event/*.java
# Resolves to .../agent/test
TEST_DIR="$(dirname "$BATS_TEST_DIRNAME")"
java_cmd="java -javaagent:'${AGENT_JAR}' -cp '${TEST_DIR}'"

cd test/event
setup() {
cd "$BATS_TEST_DIRNAME" || exit
javac -cp "${AGENT_JAR}" -sourcepath "$TEST_DIR" ./*.java
_configure_logging
}

@test "disabled value" {
local cmd="${java_cmd} -Dappmap.event.disableValue=true DisabledValue"
local cmd="${java_cmd} -Dappmap.event.disableValue=true event.DisabledValue"
[[ $BATS_VERBOSE_RUN == 1 ]] && echo "cmd: $cmd" >&3

local output
Expand Down
12 changes: 7 additions & 5 deletions agent/test/httpcore/httpcore.bats
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
load '../helper'

setup_file() {
mkdir -p build/log
agent_root="$BATS_TEST_DIRNAME/../.."
mkdir -p "$agent_root/build/log"

export LOG="$(getcwd)/build/log/httpcore.log"
export SERVER_PORT=9090
export WS_URL=${WS_URL:-http://localhost:9090}
cd test/httpcore
export LOG="$agent_root/build/log/httpcore.log"
export SERVER_PORT=46406
export WS_URL=${WS_URL:-http://localhost:${SERVER_PORT}}

cd "$BATS_TEST_DIRNAME" || exit
_configure_logging

printf 'getting set up' >&3
Expand Down
4 changes: 3 additions & 1 deletion agent/test/jdbc/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading