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 7, 2022
1 parent 5b54ce2 commit 94c1334
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,53 @@ public String toString() {
builder.append("}");
return builder.toString();
}

public static class Builder {
private CallTreeNode.Builder parent;
private CallTreeNode.Builder child;
private CallTreeNode.Builder sibling;
private final Align align;
private CallTreeNode node;

public Builder(Align align) {
this.align = align;
}

public Builder setParent(CallTreeNode.Builder parent) {
this.parent = parent;
return this;
}

public Builder setChild(CallTreeNode.Builder child) {
this.child = child;
return this;
}

public Builder setSibling(CallTreeNode.Builder sibling) {
this.sibling = sibling;
return this;
}

public CallTreeNode build() {
if (this.node != null) {
return this.node;
}

this.node = new CallTreeNode(getCallTreeNode(this.parent), this.align);
this.node.child = getCallTreeNode(this.child);
this.node.sibling = getCallTreeNode(this.sibling);
return this.node;
}

private CallTreeNode getCallTreeNode(CallTreeNode.Builder builder) {
if (builder == null) {
return null;
}

if (builder.node == null) {
builder.node = builder.build();
}
return builder.node;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,16 @@ public String toString() {
", executionMilliseconds=" + executionMilliseconds +
'}';
}

public static class Builder {
private final SpanBo spanBo;

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

public SpanAlign build() {
return new SpanAlign(this.spanBo);
}
}
}
Loading

0 comments on commit 94c1334

Please sign in to comment.