mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
improve build, components should not do non-component things
This commit is contained in:
@@ -202,7 +202,7 @@ public class SimpleActivity extends NBBaseComponent implements Activity {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return getAlias() + ':' + this.runState + ':' + this.tally;
|
||||
return activityDef.getAlias() + ':' + this.runState + ':' + this.tally;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,13 +41,15 @@ public class TestComponent extends NBBaseComponent {
|
||||
|
||||
@Override
|
||||
public NBComponent attach(NBComponent... children) {
|
||||
System.out.println("attaching children:" + Arrays.toString(children));
|
||||
System.out.println("attaching children:" +
|
||||
Arrays.stream(children).map(c -> c.getLabels().linearizeAsMetrics()).toList());
|
||||
return super.attach(children);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBComponent detach(NBComponent... children) {
|
||||
System.out.println("detaching children:" + Arrays.toString(children));
|
||||
System.out.println("detaching children:" +
|
||||
Arrays.stream(children).map(c -> c.getLabels().linearizeAsMetrics()).toList());
|
||||
return super.detach(children);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,12 @@ public class NBBaseComponent extends NBBaseComponentMetrics implements NBCompone
|
||||
|
||||
public NBBaseComponent(NBComponent parentComponent, NBLabels componentSpecificLabelsOnly) {
|
||||
this.labels = componentSpecificLabelsOnly;
|
||||
this.parent = parentComponent;
|
||||
if (this.parent!=null) { parentComponent.attach(this);}
|
||||
if (parentComponent!=null) {
|
||||
parent = parentComponent;
|
||||
parent.attach(this);
|
||||
} else {
|
||||
parent=null;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public NBComponent getParent() {
|
||||
|
||||
@@ -19,7 +19,6 @@ package io.nosqlbench.api.labels;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class NBLabelsRenderingTest {
|
||||
|
||||
@@ -38,7 +37,7 @@ class NBLabelsRenderingTest {
|
||||
public void testLinearizeOpenMetricsFormat() {
|
||||
var l1 = NBLabels.forKV("a","b","c","d","e","f");
|
||||
String oml1 = l1.linearizeAsMetrics();
|
||||
assertThat(oml1).isEqualTo("{a:\"b\",c:\"d\",e:\"f\"}");
|
||||
assertThat(oml1).isEqualTo("{a=\"b\",c=\"d\",e=\"f\"}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ class NBMetricsQueryTest {
|
||||
private final static TestComponent root_c2 = new TestComponent(root,"c2","c2");
|
||||
private final static TestComponent root_c3 = new TestComponent(root,"c3","c3");
|
||||
private final static NBMetric m1 = new NBBaseMetric("m1","m1");
|
||||
private final String m1Handle = root.addMetric(m1);
|
||||
private final static String m1Handle = root.addMetric(m1);
|
||||
private final static NBMetric m2 = new NBBaseMetric("m2","m2");
|
||||
private final String m2Handle = root_c2.addMetric(m2);
|
||||
private final static String m2Handle = root_c2.addMetric(m2);
|
||||
private final static NBMetric m3 = new NBBaseMetric("m3","m3");
|
||||
private final String m3Handle = root_c3.addMetric(m3);
|
||||
private final static String m3Handle = root_c3.addMetric(m3);
|
||||
|
||||
@Test
|
||||
public void testFindInTree() {
|
||||
|
||||
Reference in New Issue
Block a user