use of io.nosqlbench.virtdata.core.bindings.Bindings in project nosqlbench by nosqlbench.
the class IntegratedBindingsTest method testSetNamedFieldsIterated.
@Test
public void testSetNamedFieldsIterated() {
Bindings bindings = VirtData.getTemplate("mod5", "Mod(5)", "mod7", "Mod(7)").resolveBindings();
final StringBuilder sb = new StringBuilder();
Bindings.FieldSetter fs = new Bindings.FieldSetter() {
@Override
public void setField(String name, Object value) {
sb.append(name).append("=").append(value).append(";");
}
};
bindings.setNamedFieldsIterated(fs, 12, 2, "mod5");
assertThat(sb.toString()).isEqualTo("mod50=2;mod51=3;");
bindings.setNamedFieldsIterated(fs, 12, 2, "mod7");
assertThat(sb.toString()).isEqualTo("mod50=2;mod51=3;mod70=5;mod71=6;");
}
use of io.nosqlbench.virtdata.core.bindings.Bindings in project nosqlbench by nosqlbench.
the class IntegratedBindingsTest method testIteratedMaps.
@Test
public void testIteratedMaps() {
Bindings bindings = VirtData.getTemplate("mod5", "Mod(5)", "mod7", "Mod(7)").resolveBindings();
List<Map<String, Object>> maps = bindings.getIteratedMaps(11, 2);
assertThat(maps).hasSize(2);
assertThat(maps.get(0)).hasSize(2);
assertThat(maps.get(1)).hasSize(2);
assertThat(maps.get(0).get("mod5")).isEqualTo(1L);
assertThat(maps.get(0).get("mod7")).isEqualTo(4L);
assertThat(maps.get(1).get("mod5")).isEqualTo(2L);
assertThat(maps.get(1).get("mod7")).isEqualTo(5L);
}
use of io.nosqlbench.virtdata.core.bindings.Bindings in project nosqlbench by nosqlbench.
the class IntegratedBindingsTest method testSetNamedFields.
@Test
public void testSetNamedFields() {
Bindings bindings = VirtData.getTemplate("mod5", "Mod(5)", "mod7", "Mod(7)", "mod13", "Mod(13)").resolveBindings();
final StringBuilder sb = new StringBuilder();
Bindings.FieldSetter fs = new Bindings.FieldSetter() {
@Override
public void setField(String name, Object value) {
sb.append(name).append("=").append(value).append(";");
}
};
bindings.setNamedFields(fs, 12, "mod5", "mod7");
assertThat(sb.toString()).isEqualTo("mod5=2;mod7=5;");
}
use of io.nosqlbench.virtdata.core.bindings.Bindings in project nosqlbench by nosqlbench.
the class IntegratedComposerLibraryTest method testChainedTypeResolutionForWithInternalLong.
@Test
public void testChainedTypeResolutionForWithInternalLong() {
BindingsTemplate bt = new BindingsTemplate();
bt.addFieldBinding("longchain", "compose HashRange(1234,6789) -> long; Mod(3) -> int;");
Bindings bindings = bt.resolveBindings();
Object n1 = bindings.getAll(123)[0];
assertThat(n1).isOfAnyClassIn(Integer.class);
}
use of io.nosqlbench.virtdata.core.bindings.Bindings in project nosqlbench by nosqlbench.
the class IntegratedComposerLibraryTest method testStringConversion.
@Test
public void testStringConversion() {
BindingsTemplate bt = new BindingsTemplate();
bt.addFieldBinding("phone", "compose HashRange(1000000000,9999999999L); ToString() -> String");
Bindings bindings = bt.resolveBindings();
}
Aggregations