Skip to content

Commit

Permalink
Refactor jaxb entity of agent e2e test (#32208)
Browse files Browse the repository at this point in the history
* Refactor MetricsPluginE2EIT

* Refactor MetricsPluginE2EIT

* Refactor MetricsPluginE2EIT

* Refactor jaxb entity of agent e2e test

* Refactor jaxb entity of agent e2e test

* Refactor jaxb entity of agent e2e test
  • Loading branch information
terrymanu authored Jul 20, 2024
1 parent ac74d49 commit cb5ea2f
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@Setter
public final class LogE2ETestCase implements AgentE2ETestCase {

@XmlAttribute(name = "log-regex")
@XmlAttribute(name = "log-regex", required = true)
private String logRegex;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
@Setter
public final class MetricE2ETestCase implements AgentE2ETestCase {

@XmlAttribute(name = "metric-name")
@XmlAttribute(name = "metric-name", required = true)
private String metricName;

@XmlAttribute(name = "metric-type")
@XmlAttribute(name = "metric-type", required = true)
private String metricType;

@XmlElement(name = "query-assertion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public final class JaegerSpanAssert {
*/
public static void assertIs(final String jaegerUrl, final JaegerE2ETestCase expected) {
assertTagKey(jaegerUrl, expected);
expected.getTags().stream().filter(JaegerTagAssertion::isNeedAssertValue).forEach(each -> assertTagValue(jaegerUrl, expected, each));
expected.getTags().stream().filter(each -> null != each.getTagValue()).forEach(each -> assertTagValue(jaegerUrl, expected, each));
}

private static void assertTagKey(final String jaegerUrl, final JaegerE2ETestCase expected) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
@Setter
public final class JaegerE2ETestCase implements AgentE2ETestCase {

@XmlAttribute(name = "service-name")
@XmlAttribute(name = "service-name", required = true)
private String serviceName;

@XmlAttribute(name = "span-name")
@XmlAttribute(name = "span-name", required = true)
private String spanName;

@XmlElement(name = "tag")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,12 @@
@Setter
public final class JaegerTagAssertion {

@XmlAttribute(name = "key")
@XmlAttribute(name = "key", required = true)
private String tagKey;

@XmlAttribute(name = "value")
private String tagValue;

@XmlAttribute(name = "need-assert-value")
private boolean needAssertValue = true;

@Override
public String toString() {
return String.format("%s -> %s", tagKey, tagValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<tag key="peer.port" value="3306" />
<tag key="db.instance" value="ds_0" />
<tag key="db.instance" value="ds_1" />
<tag key="db.bind_vars" need-assert-value="false" />
<tag key="db.statement" need-assert-value="false" />
<tag key="db.bind_vars" />
<tag key="db.statement" />
</test-case>
</e2e-test-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<tag key="peer.port" value="3306" />
<tag key="db.instance" value="ds_0" />
<tag key="db.instance" value="ds_1" />
<tag key="db.bind_vars" need-assert-value="false" />
<tag key="db.statement" need-assert-value="false" />
<tag key="db.bind_vars" />
<tag key="db.statement" />
</test-case>
</e2e-test-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public final class ZipkinSpanAssert {
*/
public static void assertIs(final String zipkinUrl, final ZipkinE2ETestCase expected) {
assertTagKey(zipkinUrl, expected);
expected.getTags().stream().filter(ZipkinTagAssertion::isNeedAssertValue).forEach(each -> assertTagValue(zipkinUrl, expected, each));
expected.getTags().stream().filter(each -> null != each.getTagValue()).forEach(each -> assertTagValue(zipkinUrl, expected, each));
}

private static void assertTagKey(final String zipkinUrl, final ZipkinE2ETestCase expected) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
@Setter
public final class ZipkinE2ETestCase implements AgentE2ETestCase {

@XmlAttribute(name = "service-name")
@XmlAttribute(name = "service-name", required = true)
private String serviceName;

@XmlAttribute(name = "span-name")
@XmlAttribute(name = "span-name", required = true)
private String spanName;

@XmlElement(name = "tag")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,12 @@
@Setter
public final class ZipkinTagAssertion {

@XmlAttribute(name = "key")
@XmlAttribute(name = "key", required = true)
private String tagKey;

@XmlAttribute(name = "value")
private String tagValue;

@XmlAttribute(name = "need-assert-value")
private boolean needAssertValue = true;

@Override
public String toString() {
return String.format("%s -> %s", tagKey, tagValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<tag key="peer.port" value="3306" />
<tag key="db.instance" value="ds_0" />
<tag key="db.instance" value="ds_1" />
<tag key="db.bind_vars" need-assert-value="false" />
<tag key="db.statement" need-assert-value="false" />
<tag key="db.bind_vars" />
<tag key="db.statement" />
</test-case>
</e2e-test-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<tag key="peer.port" value="3306" />
<tag key="db.instance" value="ds_0" />
<tag key="db.instance" value="ds_1" />
<tag key="db.bind_vars" need-assert-value="false" />
<tag key="db.statement" need-assert-value="false" />
<tag key="db.bind_vars" />
<tag key="db.statement" />
</test-case>
</e2e-test-cases>

0 comments on commit cb5ea2f

Please sign in to comment.