Skip to content

Commit

Permalink
[pinpoint-apm#9380] Calltree verification Unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
feelform committed Dec 8, 2022
1 parent 94c1334 commit bc71edf
Show file tree
Hide file tree
Showing 3 changed files with 269 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,15 +415,209 @@ public String toString() {
}

public static class Builder {

private int version = 0;

private String agentId;
private String agentName;
private String applicationId;
private long agentStartTime;

private TransactionId transactionId;

private final long spanId;

private long parentSpanId;

private String parentApplicationId;
private short parentApplicationServiceType;

private long startTime;
private int elapsed;

private String rpc;
private short serviceType;
private String endPoint;
private int apiId;

private List<AnnotationBo> annotationBoList = new ArrayList<>();
private short flag; // optional
private int errCode;

private final List<SpanEventBo> spanEventBoList = new ArrayList<>();
private List<SpanChunkBo> spanChunkBoList;

private long collectorAcceptTime;

private int exceptionId;
private String exceptionMessage;
private String exceptionClass;

private Short applicationServiceType;

private String acceptorHost;
private String remoteAddr; // optional

private byte loggingTransactionInfo; //optional

public Builder(long spanId) {
this.spanId = spanId;
}

public Builder setVersion(int version) {
this.version = version;
return this;
}

public Builder setAgentId(String agentId) {
this.agentId = agentId;
return this;
}

public Builder setAgentName(String agentName) {
this.agentName = agentName;
return this;
}

public Builder setApplicationId(String applicationId) {
this.applicationId = applicationId;
return this;
}

public Builder setAgentStartTime(long agentStartTime) {
this.agentStartTime = agentStartTime;
return this;
}

public Builder setTransactionId(TransactionId transactionId) {
this.transactionId = transactionId;
return this;
}

public Builder setParentSpanId(long parentSpanId) {
this.parentSpanId = parentSpanId;
return this;
}

public Builder setParentApplicationId(String parentApplicationId) {
this.parentApplicationId = parentApplicationId;
return this;
}

public Builder setParentApplicationServiceType(short parentApplicationServiceType) {
this.parentApplicationServiceType = parentApplicationServiceType;
return this;
}

public Builder setStartTime(long startTime) {
this.startTime = startTime;
return this;
}

public Builder setElapsed(int elapsed) {
this.elapsed = elapsed;
return this;
}

public Builder setRpc(String rpc) {
this.rpc = rpc;
return this;
}

public Builder setServiceType(short serviceType) {
this.serviceType = serviceType;
return this;
}

public Builder setEndPoint(String endPoint) {
this.endPoint = endPoint;
return this;
}

public Builder setApiId(int apiId) {
this.apiId = apiId;
return this;
}

public Builder setFlag(short flag) {
this.flag = flag;
return this;
}

public Builder setErrCode(int errCode) {
this.errCode = errCode;
return this;
}

public Builder setCollectorAcceptTime(long collectorAcceptTime) {
this.collectorAcceptTime = collectorAcceptTime;
return this;
}

public Builder setExceptionId(int exceptionId) {
this.exceptionId = exceptionId;
return this;
}

public Builder setExceptionMessage(String exceptionMessage) {
this.exceptionMessage = exceptionMessage;
return this;
}

public Builder setExceptionClass(String exceptionClass) {
this.exceptionClass = exceptionClass;
return this;
}

public Builder setApplicationServiceType(Short applicationServiceType) {
this.applicationServiceType = applicationServiceType;
return this;
}

public Builder setAcceptorHost(String acceptorHost) {
this.acceptorHost = acceptorHost;
return this;
}

public Builder setRemoteAddr(String remoteAddr) {
this.remoteAddr = remoteAddr;
return this;
}

public Builder setLoggingTransactionInfo(byte loggingTransactionInfo) {
this.loggingTransactionInfo = loggingTransactionInfo;
return this;
}

public SpanBo build() {
SpanBo result = new SpanBo();
result.setVersion(this.version);
result.setAgentId(this.agentId);
result.setAgentName(this.agentName);
result.setApplicationId(this.applicationId);
result.setAgentStartTime(this.agentStartTime);
result.setTransactionId(this.transactionId);
result.setSpanId(this.spanId);
result.setParentSpanId(this.parentSpanId);
result.setParentApplicationId(this.parentApplicationId);
result.setParentApplicationServiceType(this.parentApplicationServiceType);
result.setStartTime(this.startTime);
result.setElapsed(this.elapsed);
result.setRpc(this.rpc);
result.setServiceType(this.serviceType);
result.setEndPoint(this.endPoint);
result.setApiId(this.apiId);
result.setFlag(this.flag);
result.setErrCode(this.errCode);
result.setCollectorAcceptTime(this.collectorAcceptTime);
result.setExceptionClass(this.exceptionClass);
if (this.exceptionMessage != null) {
result.setExceptionInfo(this.exceptionId, this.exceptionMessage);
}
result.setApplicationServiceType(this.applicationServiceType);
result.setAcceptorHost(this.acceptorHost);
result.setRemoteAddr(this.remoteAddr);
result.setLoggingTransactionInfo(this.loggingTransactionInfo);
return result;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,53 @@ public String toString() {

public static class Builder {
private final SpanBo spanBo;
private boolean meta;
private int id;
private long gap;
private int depth;
private long executionMilliseconds;

public Builder(SpanBo spanBo) {
this.spanBo = spanBo;
}

public Builder enableMeta() {
this.meta = true;
return this;
}

public Builder disableMeta() {
this.meta = false;
return this;
}

public Builder setId(int id) {
this.id = id;
return this;
}

public Builder setGap(long gap) {
this.gap = gap;
return this;
}

public Builder setDepth(int depth) {
this.depth = depth;
return this;
}

public Builder setExecutionMilliseconds(long executionMilliseconds) {
this.executionMilliseconds = executionMilliseconds;
return this;
}

public SpanAlign build() {
return new SpanAlign(this.spanBo);
SpanAlign align = new SpanAlign(this.spanBo, meta);
align.setId(this.id);
align.setGap(this.gap);
align.setDepth(this.depth);
align.setExecutionMilliseconds(this.executionMilliseconds);
return align;
}
}
}
Loading

0 comments on commit bc71edf

Please sign in to comment.