mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
Code review adjustments
This commit is contained in:
@@ -19,6 +19,7 @@ package io.nosqlbench.engine.api.activityimpl;
|
||||
import com.codahale.metrics.Histogram;
|
||||
import com.codahale.metrics.Timer;
|
||||
import io.nosqlbench.api.engine.metrics.ActivityMetrics;
|
||||
import io.nosqlbench.api.errors.MVELCompilationError;
|
||||
import io.nosqlbench.engine.api.activityimpl.uniform.DriverAdapter;
|
||||
import io.nosqlbench.engine.api.activityimpl.uniform.flowtypes.Op;
|
||||
import io.nosqlbench.engine.api.metrics.ThreadLocalNamedTimers;
|
||||
@@ -66,21 +67,29 @@ public abstract class BaseOpDispenser<T extends Op, S> implements OpDispenser<T>
|
||||
}
|
||||
}
|
||||
configureInstrumentation(op);
|
||||
configureExpectations(op);
|
||||
}
|
||||
|
||||
// TODO/MVEL: Please add some error handling around that explains to the user
|
||||
// what happened in the event of a compilation failure.
|
||||
private void configureExpectations(ParsedOp op) {
|
||||
op.getOptionalStaticValue("expected-result", String.class)
|
||||
.map(MVEL::compileExpression)
|
||||
.ifPresent(result -> this.expectedResultExpression = result);
|
||||
configureResultExpectations(op);
|
||||
}
|
||||
|
||||
public Serializable getExpectedResultExpression() {
|
||||
return expectedResultExpression;
|
||||
}
|
||||
|
||||
private void configureResultExpectations(ParsedOp op) {
|
||||
op.getOptionalStaticValue("expected-result", String.class)
|
||||
.map(this::compileExpectedResultExpression)
|
||||
.ifPresent(result -> this.expectedResultExpression = result);
|
||||
}
|
||||
|
||||
private Serializable compileExpectedResultExpression(String expectedResultExpression) {
|
||||
try {
|
||||
return MVEL.compileExpression(expectedResultExpression);
|
||||
} catch (Exception e) {
|
||||
throw new MVELCompilationError(
|
||||
String.format("Failed to compile expected-result expression: \"%s\"", expectedResultExpression), e
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String getOpName() {
|
||||
return opName;
|
||||
}
|
||||
|
||||
@@ -33,9 +33,4 @@ package io.nosqlbench.engine.api.activityimpl.uniform.flowtypes;
|
||||
*/
|
||||
// TODO: optimize the runtime around the specific op type
|
||||
public interface Op extends OpResultSize {
|
||||
// TODO/MVEL: Let's take this out of here to keep Op as a tagging interface
|
||||
// I think it will sit fine on the BaseOpDispenser, and lifecycles align for this nicely
|
||||
default boolean verified() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user