aboutsummaryrefslogtreecommitdiff
path: root/spark-common/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'spark-common/src/test')
-rw-r--r--spark-common/src/test/java/me/lucko/spark/common/sampler/SamplerTest.java8
-rw-r--r--spark-common/src/test/java/me/lucko/spark/common/sampler/node/NodeTest.java9
2 files changed, 8 insertions, 9 deletions
diff --git a/spark-common/src/test/java/me/lucko/spark/common/sampler/SamplerTest.java b/spark-common/src/test/java/me/lucko/spark/common/sampler/SamplerTest.java
index 7db14a3..f6d9f87 100644
--- a/spark-common/src/test/java/me/lucko/spark/common/sampler/SamplerTest.java
+++ b/spark-common/src/test/java/me/lucko/spark/common/sampler/SamplerTest.java
@@ -22,9 +22,8 @@ package me.lucko.spark.common.sampler;
import me.lucko.spark.common.sampler.async.AsyncSampler;
import me.lucko.spark.common.sampler.java.JavaSampler;
-import me.lucko.spark.common.sampler.node.MergeMode;
+import me.lucko.spark.common.sampler.java.MergeStrategy;
import me.lucko.spark.common.sampler.source.ClassSourceLookup;
-import me.lucko.spark.common.util.MethodDisambiguator;
import me.lucko.spark.proto.SparkSamplerProtos;
import me.lucko.spark.test.TestClass2;
import me.lucko.spark.test.plugin.TestCommandSender;
@@ -74,9 +73,12 @@ public class SamplerTest {
Sampler.ExportProps exportProps = new Sampler.ExportProps()
.creator(TestCommandSender.INSTANCE.toData())
- .mergeMode(() -> MergeMode.sameMethod(new MethodDisambiguator(plugin.platform().createClassFinder())))
.classSourceLookup(() -> ClassSourceLookup.create(plugin.platform()));
+ if (profilerType == ProfilerType.JAVA) {
+ exportProps.mergeStrategy(MergeStrategy.SAME_METHOD);
+ }
+
SparkSamplerProtos.SamplerData proto = sampler.toProto(plugin.platform(), exportProps);
assertNotNull(proto);
diff --git a/spark-common/src/test/java/me/lucko/spark/common/sampler/node/NodeTest.java b/spark-common/src/test/java/me/lucko/spark/common/sampler/node/NodeTest.java
index 7df9e59..f1534a8 100644
--- a/spark-common/src/test/java/me/lucko/spark/common/sampler/node/NodeTest.java
+++ b/spark-common/src/test/java/me/lucko/spark/common/sampler/node/NodeTest.java
@@ -23,9 +23,9 @@ package me.lucko.spark.common.sampler.node;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import me.lucko.spark.common.sampler.SamplerMode;
+import me.lucko.spark.common.sampler.async.AsyncNodeExporter;
import me.lucko.spark.common.sampler.async.AsyncStackTraceElement;
import me.lucko.spark.common.sampler.window.ProtoTimeEncoder;
-import me.lucko.spark.common.util.MethodDisambiguator;
import me.lucko.spark.proto.SparkSamplerProtos;
import org.junit.jupiter.api.Test;
@@ -39,7 +39,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
public class NodeTest {
- private static final StackTraceNode.Describer<AsyncStackTraceElement> STACK_TRACE_DESCRIBER = (element, parent) -> new StackTraceNode.Description(element.getClassName(), element.getMethodName(), element.getMethodDescription());
+ private static final StackTraceNode.Describer<AsyncStackTraceElement> STACK_TRACE_DESCRIBER = (element, parent) -> new StackTraceNode.AsyncDescription(element.getClassName(), element.getMethodName(), element.getMethodDescription());
private static final int WINDOW = 10;
private static final AsyncStackTraceElement NODE_0 = new AsyncStackTraceElement("java.lang.Thread", "run", "()V");
@@ -104,10 +104,7 @@ public class NodeTest {
int[] keys = timeEncoder.getKeys();
assertArrayEquals(new int[]{WINDOW, WINDOW + 1}, keys);
- SparkSamplerProtos.ThreadNode proto = threadNode.toProto(
- MergeMode.sameMethod(new MethodDisambiguator(null)),
- timeEncoder
- );
+ SparkSamplerProtos.ThreadNode proto = new AsyncNodeExporter(timeEncoder).export(threadNode);
SparkSamplerProtos.ThreadNode expected = SparkSamplerProtos.ThreadNode.newBuilder()
.setName("Test Thread")