initial test

This commit is contained in:
Jonathan Shook 2020-04-02 01:47:32 -05:00
parent f24373d330
commit fc25a2b4eb
3 changed files with 26 additions and 2 deletions

View File

@ -4,6 +4,8 @@ scenarios:
- run driver=cql tags==phase:schema threads==1
- run driver=cql tags==phase:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
- run driver=cql tags==phase:main cycles===TEMPLATE(main-cycles,10000000) threads=auto
params:
instrument: TEMPLATE(instrument,false)
bindings:
machine_id: Mod(<<sources:10000>>); ToHashedUUID() -> java.util.UUID
sensor_name: HashedLineToString('data/variable_words.txt')
@ -59,6 +61,8 @@ blocks:
idempotent: true
tags:
name: insert-rampup
params:
instrument: TEMPLATE(instrument-writes,TEMPLATE(instrument,false))
- tags:
phase: verify
type: read
@ -72,6 +76,8 @@ blocks:
verify-fields: "*, -cell_timestamp"
tags:
name: select-verify
params:
instrument: TEMPLATE(instrument-reads,TEMPLATE(instrument,false))
- tags:
phase: main
type: read
@ -85,6 +91,8 @@ blocks:
limit <<limit:10>>
tags:
name: select-read
params:
instrument: TEMPLATE(instrument-reads,TEMPLATE(instrument,false))
- tags:
phase: main
type: write
@ -100,3 +108,6 @@ blocks:
idempotent: true
tags:
name: insert-main
params:
instrument: TEMPLATE(instrument-writes,TEMPLATE(instrument,false))

View File

@ -48,8 +48,13 @@ public class StrInterpolator implements Function<String, String> {
}
@Override
public String apply(String s) {
return substitutor.replace(substitutor2.replace(s));
public String apply(String raw) {
String after = substitutor.replace(substitutor2.replace(raw));
while (!after.equals(raw)) {
raw=after;
after = substitutor.replace(substitutor2.replace(raw));
}
return after;
}
public static class MultiMap extends StrLookup<String> {

View File

@ -119,4 +119,12 @@ public class StrInterpolatorTest {
assertThat(a).isEqualTo("'Key': 'Value'.'Stuff'");
}
@Test
public void shouldExpandNestedTemplates() {
String a = interp.apply("-TEMPLATE(akey,TEMPLATE(dkey,whee)-");
assertThat(a).isEqualTo("-aval1-");
String b = interp.apply("-TEMPLATE(unknown,TEMPLATE(bkey,whee))-");
assertThat(b).isEqualTo("-bval1-");
}
}