Skip to content
Merged
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
25 changes: 24 additions & 1 deletion apm-agent-core/src/test/java/co/elastic/apm/agent/JsonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,35 @@
*/
package co.elastic.apm.agent;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;

import java.io.IOException;
import java.nio.CharBuffer;

public class JsonUtils {

private static final ObjectMapper objectMapper = new ObjectMapper();
private static final ObjectMapper objectMapper;

static {
objectMapper = new ObjectMapper();

// using default serializer for CharBuffer will try to make some properties accessible using introspection
// which fails with Java 15+ and we don't need in practice, thus using a custom serializer allows to avoid this.
SimpleModule module = new SimpleModule();
module.addSerializer(CharBuffer.class, new StdSerializer<CharBuffer>(CharBuffer.class) {

@Override
public void serialize(CharBuffer charBuffer, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
jsonGenerator.writeString(charBuffer.toString());
}
});
objectMapper.registerModule(module);
}

public static JsonNode toJson(Object o) {
return objectMapper.valueToTree(o);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnJre;
import org.junit.jupiter.api.condition.JRE;
import org.slf4j.event.SubstituteLoggingEvent;
import org.stagemonitor.configuration.ConfigurationRegistry;

Expand Down Expand Up @@ -292,6 +294,7 @@ void testPatchClassFileVersionJava6ToJava7() {
}

@Test
@DisabledOnJre(JRE.JAVA_15) // https://github.com/elastic/apm-agent-java/issues/1944
void testPatchClassFileVersionJava5ToJava7() {
// loading classes compiled with bytecode level 49 (Java 6)
new org.slf4j.event.SubstituteLoggingEvent();
Expand All @@ -311,6 +314,7 @@ void testPatchClassFileVersionJava5ToJava7() {
}

@Test
@DisabledOnJre(JRE.JAVA_15) // https://github.com/elastic/apm-agent-java/issues/1944
void testPatchClassFileVersionJava5ToJava7CommonsMath() {
org.apache.commons.math3.stat.StatUtils.max(new double[]{3.14});

Expand All @@ -329,6 +333,7 @@ void testPatchClassFileVersionJava5ToJava7CommonsMath() {
}

@Test
@DisabledOnJre(JRE.JAVA_15) // https://github.com/elastic/apm-agent-java/issues/1944
void testPatchClassFileVersionJava4ToJava7CommonsMath() {
org.apache.log4j.LogManager.exists("not");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
package co.elastic.apm.agent.impl.payload;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnJre;
import org.junit.jupiter.api.condition.JRE;

import javax.annotation.Nullable;

Expand Down Expand Up @@ -117,6 +119,7 @@ void testKubernetesInfo_podUid_with_underscores() {
}

@Test
@DisabledOnJre({JRE.JAVA_15, JRE.JAVA_16}) // https://github.com/elastic/apm-agent-java/issues/1942
void testKubernetesDownwardApi() throws Exception {
String line = "1:name=systemd:/kubepods/besteffort/pode9b90526-f47d-11e8-b2a5-080027b9f4fb/15aa6e53-b09a-40c7-8558-c6c31e36c88a";
String containerId = "15aa6e53-b09a-40c7-8558-c6c31e36c88a";
Expand Down
2 changes: 1 addition & 1 deletion apm-agent-plugins/apm-grails-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<dependency>
<groupId>org.grails</groupId>
<artifactId>grails-web-mvc</artifactId>
<version>4.0.3</version>
<version>4.1.0.M4</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<goals>
Expand Down