Skip to content

Commit

Permalink
feat: static access to extractor builders
Browse files Browse the repository at this point in the history
  • Loading branch information
bbortt authored and christophd committed Sep 5, 2023
1 parent 138e573 commit 3cf2480
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ public void extractVariables(Message message, TestContext context) {
public static final class Builder implements VariableExtractor.Builder<JsonPathVariableExtractor, Builder>, MessageProcessorAdapter, ValidationContextAdapter {
private final Map<String, Object> expressions = new LinkedHashMap<>();

public static Builder fromJsonPath() {
return new Builder();
}

@Override
public Builder expressions(Map<String, Object> expressions) {
this.expressions.putAll(expressions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,15 @@
* @author Christoph Deppisch
*/
public class XpathPayloadVariableExtractor implements VariableExtractor {
/** Logger */
private static final Logger LOG = LoggerFactory.getLogger(XpathPayloadVariableExtractor.class);

/** Map defines xpath expressions and target variable names */
private final Map<String, Object> xPathExpressions;

/** Namespace definitions used in xpath expressions */
private final Map<String, String> namespaces;

/** Logger */
private static final Logger LOG = LoggerFactory.getLogger(XpathPayloadVariableExtractor.class);

public XpathPayloadVariableExtractor() {
this(new Builder());
}
Expand Down Expand Up @@ -143,6 +142,10 @@ public static final class Builder implements VariableExtractor.Builder<XpathPayl
private final Map<String, Object> expressions = new HashMap<>();
private final Map<String, String> namespaces = new HashMap<>();

public static Builder fromXpath() {
return new Builder();
}

/**
* Adds explicit namespace declaration for later path validation expressions.
*
Expand Down

0 comments on commit 3cf2480

Please sign in to comment.