verified via UAT; Test would be difficult without elaborate scaffolding; closes #994

This commit is contained in:
Jonathan Shook 2023-02-10 22:46:43 -06:00
parent a0e8a56a6a
commit 46890232e2

View File

@ -77,11 +77,12 @@ public class StandardActivity<R extends Op, S> extends SimpleActivity implements
List<DriverAdapter> adapterlist = new ArrayList<>();
NBConfigModel supersetConfig = ConfigModel.of(StandardActivity.class).add(yamlmodel);
Optional<String> defaultDriverOption = activityDef.getParams().getOptionalString("driver");
for (OpTemplate ot : opTemplates) {
ParsedOp incompleteOpDef = new ParsedOp(ot, NBConfiguration.empty(), List.of());
String driverName = incompleteOpDef.takeOptionalStaticValue("driver", String.class)
.or(() -> incompleteOpDef.takeOptionalStaticValue("type",String.class))
.or(() -> activityDef.getParams().getOptionalString("driver"))
.or(() -> defaultDriverOption)
.orElseThrow(() -> new OpConfigError("Unable to identify driver name for op template:\n" + ot));
// String driverName = ot.getOptionalStringParam("driver")
@ -109,7 +110,6 @@ public class StandardActivity<R extends Op, S> extends SimpleActivity implements
}
supersetConfig.assertValidConfig(activityDef.getParams().getStringStringMap());
DriverAdapter adapter = adapters.get(driverName);
adapterlist.add(adapter);
ParsedOp pop = new ParsedOp(ot, adapter.getConfiguration(), List.of(adapter.getPreprocessor()));
@ -117,6 +117,13 @@ public class StandardActivity<R extends Op, S> extends SimpleActivity implements
pops.add(pop);
}
if (defaultDriverOption.isPresent()) {
long matchingDefault = mappers.keySet().stream().filter(n -> n.equals(defaultDriverOption.get())).count();
if (matchingDefault==0) {
logger.warn("All op templates used a different driver than the default '" + defaultDriverOption.get()+"'");
}
}
try {
boolean strict = activityDef.getParams().getOptionalBoolean("strict").orElse(false);
sequence = createOpSourceFromParsedOps(adapters, mappers, adapterlist, pops);