Java Code Examples for com.fasterxml.jackson.databind.node.ObjectNode#removeAll()

The following examples show how to use com.fasterxml.jackson.databind.node.ObjectNode#removeAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertyFilter.java    From jackson-jaxrs-propertyfiltering with Apache License 2.0 6 votes vote down vote up
private void filter(ObjectNode object) {
  if (!includedProperties.isEmpty() && !includedProperties.contains("*")) {
    object.retain(includedProperties);
  }

  if (excludedProperties.contains("*")) {
    object.removeAll();
  } else {
    object.remove(excludedProperties);
  }

  Iterator<Entry<String, JsonNode>> fields = object.fields();
  while (fields.hasNext()) {
    Entry<String, JsonNode> field = fields.next();

    if (nestedProperties.containsKey(field.getKey())) {
      nestedProperties.get(field.getKey()).filter(field.getValue());
    } else if (nestedProperties.containsKey("*")) {
      nestedProperties.get("*").filter(field.getValue());
    }
  }
}
 
Example 2
Source File: SchemaGenerationContextImpl.java    From jsonschema-generator with Apache License 2.0 4 votes vote down vote up
@Override
public ObjectNode makeNullable(ObjectNode node) {
    final String nullTypeName = this.getKeyword(SchemaKeyword.TAG_TYPE_NULL);
    if (node.has(this.getKeyword(SchemaKeyword.TAG_REF))
            || node.has(this.getKeyword(SchemaKeyword.TAG_ALLOF))
            || node.has(this.getKeyword(SchemaKeyword.TAG_ANYOF))
            || node.has(this.getKeyword(SchemaKeyword.TAG_ONEOF))) {
        // cannot be sure what is specified in those other schema parts, instead simply create a oneOf wrapper
        ObjectNode nullSchema = this.generatorConfig.createObjectNode()
                .put(this.getKeyword(SchemaKeyword.TAG_TYPE), nullTypeName);
        ArrayNode anyOf = this.generatorConfig.createArrayNode()
                // one option in the oneOf should be null
                .add(nullSchema)
                // the other option is the given (assumed to be) not-nullable node
                .add(this.generatorConfig.createObjectNode().setAll(node));
        // replace all existing (and already copied properties with the oneOf wrapper
        node.removeAll();
        node.set(this.getKeyword(SchemaKeyword.TAG_ANYOF), anyOf);
    } else {
        // given node is a simple schema, we can simply adjust its "type" attribute
        JsonNode fixedJsonSchemaType = node.get(this.getKeyword(SchemaKeyword.TAG_TYPE));
        if (fixedJsonSchemaType instanceof ArrayNode) {
            // there are already multiple "type" values
            ArrayNode arrayOfTypes = (ArrayNode) fixedJsonSchemaType;
            // one of the existing "type" values could be null
            boolean alreadyContainsNull = false;
            for (JsonNode arrayEntry : arrayOfTypes) {
                alreadyContainsNull = alreadyContainsNull || nullTypeName.equals(arrayEntry.textValue());
            }

            if (!alreadyContainsNull) {
                // null "type" was not mentioned before, to be safe we need to replace the old array and add the null entry
                node.replace(this.getKeyword(SchemaKeyword.TAG_TYPE), this.generatorConfig.createArrayNode()
                        .addAll(arrayOfTypes)
                        .add(nullTypeName));
            }
        } else if (fixedJsonSchemaType instanceof TextNode && !nullTypeName.equals(fixedJsonSchemaType.textValue())) {
            // add null as second "type" option
            node.replace(this.getKeyword(SchemaKeyword.TAG_TYPE), this.generatorConfig.createArrayNode()
                    .add(fixedJsonSchemaType)
                    .add(nullTypeName));
        }
        // if no "type" is specified, null is allowed already
    }
    return node;
}
 
Example 3
Source File: ProcessInstanceQueryResourceTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
/**
 * Test querying process instance based on variables. POST query/process-instances
 */
@Deployment
public void testQueryProcessInstancesWithVariables() throws Exception {
  HashMap<String, Object> processVariables = new HashMap<String, Object>();
  processVariables.put("stringVar", "Azerty");
  processVariables.put("intVar", 67890);
  processVariables.put("booleanVar", false);

  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", processVariables);

  String url = RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_INSTANCE_QUERY);

  // Process variables
  ObjectNode requestNode = objectMapper.createObjectNode();
  ArrayNode variableArray = objectMapper.createArrayNode();
  ObjectNode variableNode = objectMapper.createObjectNode();
  variableArray.add(variableNode);
  requestNode.put("variables", variableArray);

  // String equals
  variableNode.put("name", "stringVar");
  variableNode.put("value", "Azerty");
  variableNode.put("operation", "equals");
  assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId());

  // Integer equals
  variableNode.removeAll();
  variableNode.put("name", "intVar");
  variableNode.put("value", 67890);
  variableNode.put("operation", "equals");
  assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId());

  // Boolean equals
  variableNode.removeAll();
  variableNode.put("name", "booleanVar");
  variableNode.put("value", false);
  variableNode.put("operation", "equals");
  assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId());

  // String not equals
  variableNode.removeAll();
  variableNode.put("name", "stringVar");
  variableNode.put("value", "ghijkl");
  variableNode.put("operation", "notEquals");
  assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId());

  // Integer not equals
  variableNode.removeAll();
  variableNode.put("name", "intVar");
  variableNode.put("value", 45678);
  variableNode.put("operation", "notEquals");
  assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId());

  // Boolean not equals
  variableNode.removeAll();
  variableNode.put("name", "booleanVar");
  variableNode.put("value", true);
  variableNode.put("operation", "notEquals");
  assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId());

  // String equals ignore case
  variableNode.removeAll();
  variableNode.put("name", "stringVar");
  variableNode.put("value", "azeRTY");
  variableNode.put("operation", "equalsIgnoreCase");
  assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId());

  // String not equals ignore case
  variableNode.removeAll();
  variableNode.put("name", "stringVar");
  variableNode.put("value", "HIJKLm");
  variableNode.put("operation", "notEqualsIgnoreCase");
  assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId());

  // String equals without value
  variableNode.removeAll();
  variableNode.put("value", "Azerty");
  variableNode.put("operation", "equals");
  assertResultsPresentInPostDataResponse(url, requestNode, processInstance.getId());

  // String equals with non existing value
  variableNode.removeAll();
  variableNode.put("value", "Azerty2");
  variableNode.put("operation", "equals");
  assertResultsPresentInPostDataResponse(url, requestNode);
}
 
Example 4
Source File: HistoricVariableInstanceQueryResourceTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
/**
 * Test querying historic variable instance. POST query/historic-variable-instances
 */
@Deployment
public void testQueryVariableInstances() throws Exception {
  HashMap<String, Object> processVariables = new HashMap<String, Object>();
  processVariables.put("stringVar", "Azerty");
  processVariables.put("intVar", 67890);
  processVariables.put("booleanVar", false);

  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", processVariables);
  Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
  taskService.complete(task.getId());
  task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
  taskService.setVariableLocal(task.getId(), "taskVariable", "test");

  ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("oneTaskProcess", processVariables);

  String url = RestUrls.createRelativeResourceUrl(RestUrls.URL_HISTORIC_VARIABLE_INSTANCE_QUERY);

  ObjectNode requestNode = objectMapper.createObjectNode();
  requestNode.put("variableName", "stringVar");
  assertResultsPresentInDataResponse(url, requestNode, 2, "stringVar", "Azerty");

  requestNode = objectMapper.createObjectNode();
  requestNode.put("variableName", "booleanVar");
  assertResultsPresentInDataResponse(url, requestNode, 2, "booleanVar", false);

  requestNode = objectMapper.createObjectNode();
  requestNode.put("variableName", "booleanVar2");
  assertResultsPresentInDataResponse(url, requestNode, 0, null, null);

  requestNode = objectMapper.createObjectNode();
  requestNode.put("processInstanceId", processInstance.getId());
  assertResultsPresentInDataResponse(url, requestNode, 4, "taskVariable", "test");

  requestNode = objectMapper.createObjectNode();
  requestNode.put("processInstanceId", processInstance.getId());
  requestNode.put("excludeTaskVariables", true);
  assertResultsPresentInDataResponse(url, requestNode, 3, "intVar", 67890);

  requestNode = objectMapper.createObjectNode();
  requestNode.put("processInstanceId", processInstance2.getId());
  assertResultsPresentInDataResponse(url, requestNode, 3, "stringVar", "Azerty");

  requestNode = objectMapper.createObjectNode();
  requestNode.put("taskId", task.getId());
  assertResultsPresentInDataResponse(url, requestNode, 1, "taskVariable", "test");

  requestNode = objectMapper.createObjectNode();
  requestNode.put("taskId", task.getId());
  requestNode.put("variableName", "booleanVar");
  assertResultsPresentInDataResponse(url, requestNode, 0, null, null);

  requestNode = objectMapper.createObjectNode();
  requestNode.put("variableNameLike", "%Var");
  assertResultsPresentInDataResponse(url, requestNode, 6, "stringVar", "Azerty");

  requestNode = objectMapper.createObjectNode();
  requestNode.put("variableNameLike", "%Var2");
  assertResultsPresentInDataResponse(url, requestNode, 0, null, null);

  requestNode = objectMapper.createObjectNode();
  ArrayNode variableArray = objectMapper.createArrayNode();
  ObjectNode variableNode = objectMapper.createObjectNode();
  variableArray.add(variableNode);
  requestNode.put("variables", variableArray);
  variableNode.put("name", "stringVar");
  variableNode.put("value", "Azerty");
  variableNode.put("operation", "equals");
  assertResultsPresentInDataResponse(url, requestNode, 2, "stringVar", "Azerty");

  variableNode.removeAll();
  requestNode.put("variables", variableArray);
  variableNode.put("name", "taskVariable");
  variableNode.put("value", "test");
  variableNode.put("operation", "equals");
  assertResultsPresentInDataResponse(url, requestNode, 1, "taskVariable", "test");

  variableNode.removeAll();
  requestNode.put("variables", variableArray);
  variableNode.put("name", "taskVariable");
  variableNode.put("value", "test");
  variableNode.put("operation", "notEquals");
  assertErrorResult(url, requestNode, HttpStatus.SC_BAD_REQUEST);
}
 
Example 5
Source File: CaseInstanceQueryResourceTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
/**
 * Test querying case instance based on variables. POST query/case-instances
 */
@CmmnDeployment(resources = { "org/flowable/cmmn/rest/service/api/repository/oneHumanTaskCase.cmmn" })
public void testQueryCaseInstancesWithVariables() throws Exception {
    HashMap<String, Object> caseVariables = new HashMap<>();
    caseVariables.put("stringVar", "Azerty");
    caseVariables.put("intVar", 67890);
    caseVariables.put("booleanVar", false);

    CaseInstance caseInstance = runtimeService.createCaseInstanceBuilder().caseDefinitionKey("oneHumanTaskCase").variables(caseVariables).start();

    String url = CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_CASE_INSTANCE_QUERY);

    // Process variables
    ObjectNode requestNode = objectMapper.createObjectNode();
    ArrayNode variableArray = objectMapper.createArrayNode();
    ObjectNode variableNode = objectMapper.createObjectNode();
    variableArray.add(variableNode);
    requestNode.set("variables", variableArray);

    // String equals
    variableNode.put("name", "stringVar");
    variableNode.put("value", "Azerty");
    variableNode.put("operation", "equals");
    assertResultsPresentInPostDataResponse(url, requestNode, caseInstance.getId());

    // Integer equals
    variableNode.removeAll();
    variableNode.put("name", "intVar");
    variableNode.put("value", 67890);
    variableNode.put("operation", "equals");
    assertResultsPresentInPostDataResponse(url, requestNode, caseInstance.getId());

    // Boolean equals
    variableNode.removeAll();
    variableNode.put("name", "booleanVar");
    variableNode.put("value", false);
    variableNode.put("operation", "equals");
    assertResultsPresentInPostDataResponse(url, requestNode, caseInstance.getId());

    // String not equals
    variableNode.removeAll();
    variableNode.put("name", "stringVar");
    variableNode.put("value", "ghijkl");
    variableNode.put("operation", "notEquals");
    assertResultsPresentInPostDataResponse(url, requestNode, caseInstance.getId());

    // Integer not equals
    variableNode.removeAll();
    variableNode.put("name", "intVar");
    variableNode.put("value", 45678);
    variableNode.put("operation", "notEquals");
    assertResultsPresentInPostDataResponse(url, requestNode, caseInstance.getId());

    // Boolean not equals
    variableNode.removeAll();
    variableNode.put("name", "booleanVar");
    variableNode.put("value", true);
    variableNode.put("operation", "notEquals");
    assertResultsPresentInPostDataResponse(url, requestNode, caseInstance.getId());

    // String equals ignore case
    variableNode.removeAll();
    variableNode.put("name", "stringVar");
    variableNode.put("value", "azeRTY");
    variableNode.put("operation", "equalsIgnoreCase");
    assertResultsPresentInPostDataResponse(url, requestNode, caseInstance.getId());

    // String not equals ignore case
    variableNode.removeAll();
    variableNode.put("name", "stringVar");
    variableNode.put("value", "HIJKLm");
    variableNode.put("operation", "notEqualsIgnoreCase");
    assertResultsPresentInPostDataResponse(url, requestNode, caseInstance.getId());

    // String like
    variableNode.put("name", "stringVar");
    variableNode.put("value", "Azer%");
    variableNode.put("operation", "like");
    assertResultsPresentInPostDataResponse(url, requestNode, caseInstance.getId());

    // String liek ignore case
    variableNode.put("name", "stringVar");
    variableNode.put("value", "AzEr%");
    variableNode.put("operation", "likeIgnoreCase");
    assertResultsPresentInPostDataResponse(url, requestNode, caseInstance.getId());

    // String equals without value
    variableNode.removeAll();
    variableNode.put("value", "Azerty");
    variableNode.put("operation", "equals");
    assertResultsPresentInPostDataResponse(url, requestNode, caseInstance.getId());

    // String equals with non existing value
    variableNode.removeAll();
    variableNode.put("value", "Azerty2");
    variableNode.put("operation", "equals");
    assertResultsPresentInPostDataResponse(url, requestNode);
}
 
Example 6
Source File: PlanItemInstanceQueryResourceTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
/**
 * Test querying plan item instance based on variables. POST query/case-instances
 */
@CmmnDeployment(resources = { "org/flowable/cmmn/rest/service/api/repository/oneHumanTaskCase.cmmn" })
public void testQueryPlanItemInstancesWithVariables() throws Exception {
    HashMap<String, Object> caseVariables = new HashMap<>();
    caseVariables.put("stringVar", "Azerty");
    caseVariables.put("intVar", 67890);
    caseVariables.put("booleanVar", false);

    CaseInstance caseInstance = runtimeService.createCaseInstanceBuilder().caseDefinitionKey("oneHumanTaskCase").variables(caseVariables).start();

    PlanItemInstance planItem = runtimeService.createPlanItemInstanceQuery().caseInstanceId(caseInstance.getId()).singleResult();

    String url = CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_PLAN_ITEM_INSTANCE_QUERY);

    // Process variables
    ObjectNode requestNode = objectMapper.createObjectNode();
    ArrayNode variableArray = objectMapper.createArrayNode();
    ObjectNode variableNode = objectMapper.createObjectNode();
    variableArray.add(variableNode);
    requestNode.set("caseInstanceVariables", variableArray);

    // String equals
    variableNode.put("name", "stringVar");
    variableNode.put("value", "Azerty");
    variableNode.put("operation", "equals");
    assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

    // Integer equals
    variableNode.removeAll();
    variableNode.put("name", "intVar");
    variableNode.put("value", 67890);
    variableNode.put("operation", "equals");
    assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

    // Boolean equals
    variableNode.removeAll();
    variableNode.put("name", "booleanVar");
    variableNode.put("value", false);
    variableNode.put("operation", "equals");
    assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

    // String not equals
    variableNode.removeAll();
    variableNode.put("name", "stringVar");
    variableNode.put("value", "ghijkl");
    variableNode.put("operation", "notEquals");
    assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

    // Integer not equals
    variableNode.removeAll();
    variableNode.put("name", "intVar");
    variableNode.put("value", 45678);
    variableNode.put("operation", "notEquals");
    assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

    // Boolean not equals
    variableNode.removeAll();
    variableNode.put("name", "booleanVar");
    variableNode.put("value", true);
    variableNode.put("operation", "notEquals");
    assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

    // String equals ignore case
    variableNode.removeAll();
    variableNode.put("name", "stringVar");
    variableNode.put("value", "azeRTY");
    variableNode.put("operation", "equalsIgnoreCase");
    assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

    // String not equals ignore case
    variableNode.removeAll();
    variableNode.put("name", "stringVar");
    variableNode.put("value", "HIJKLm");
    variableNode.put("operation", "notEqualsIgnoreCase");
    assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

    // String equals without value
    variableNode.removeAll();
    variableNode.put("value", "Azerty");
    variableNode.put("operation", "equals");
    assertResultsPresentInPostDataResponse(url, requestNode, planItem.getId());

    // String equals with non existing value
    variableNode.removeAll();
    variableNode.put("value", "Azerty2");
    variableNode.put("operation", "equals");
    assertResultsPresentInPostDataResponse(url, requestNode);
}
 
Example 7
Source File: HistoricVariableInstanceQueryResourceTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
/**
 * Test querying historic variable instance. POST cmmn-query/historic-variable-instances
 */
@CmmnDeployment(resources = { "org/flowable/cmmn/rest/service/api/repository/twoHumanTaskCase.cmmn" })
public void testQueryVariableInstances() throws Exception {
    HashMap<String, Object> caseVariables = new HashMap<>();
    caseVariables.put("stringVar", "Azerty");
    caseVariables.put("intVar", 67890);
    caseVariables.put("booleanVar", false);

    CaseInstance caseInstance = runtimeService.createCaseInstanceBuilder().caseDefinitionKey("myCase").variables(caseVariables).start();
    Task task = taskService.createTaskQuery().caseInstanceId(caseInstance.getId()).singleResult();
    taskService.complete(task.getId());
    task = taskService.createTaskQuery().caseInstanceId(caseInstance.getId()).singleResult();
    taskService.setVariableLocal(task.getId(), "taskVariable", "test");

    CaseInstance caseInstance2 = runtimeService.createCaseInstanceBuilder().caseDefinitionKey("myCase").variables(caseVariables).start();

    String url = CmmnRestUrls.createRelativeResourceUrl(CmmnRestUrls.URL_HISTORIC_VARIABLE_INSTANCE_QUERY);

    ObjectNode requestNode = objectMapper.createObjectNode();
    requestNode.put("variableName", "stringVar");
    assertResultsPresentInDataResponse(url, requestNode, 2, "stringVar", "Azerty");

    requestNode = objectMapper.createObjectNode();
    requestNode.put("variableName", "booleanVar");
    assertResultsPresentInDataResponse(url, requestNode, 2, "booleanVar", false);

    requestNode = objectMapper.createObjectNode();
    requestNode.put("variableName", "booleanVar2");
    assertResultsPresentInDataResponse(url, requestNode, 0, null, null);

    requestNode = objectMapper.createObjectNode();
    requestNode.put("caseInstanceId", caseInstance.getId());
    assertResultsPresentInDataResponse(url, requestNode, 4, "taskVariable", "test");

    requestNode = objectMapper.createObjectNode();
    requestNode.put("caseInstanceId", caseInstance.getId());
    requestNode.put("excludeTaskVariables", true);
    assertResultsPresentInDataResponse(url, requestNode, 3, "intVar", 67890);

    requestNode = objectMapper.createObjectNode();
    requestNode.put("caseInstanceId", caseInstance2.getId());
    assertResultsPresentInDataResponse(url, requestNode, 3, "stringVar", "Azerty");

    requestNode = objectMapper.createObjectNode();
    requestNode.put("taskId", task.getId());
    assertResultsPresentInDataResponse(url, requestNode, 1, "taskVariable", "test");

    requestNode = objectMapper.createObjectNode();
    requestNode.put("taskId", task.getId());
    requestNode.put("variableName", "booleanVar");
    assertResultsPresentInDataResponse(url, requestNode, 0, null, null);

    requestNode = objectMapper.createObjectNode();
    requestNode.put("variableNameLike", "%Var");
    assertResultsPresentInDataResponse(url, requestNode, 6, "stringVar", "Azerty");

    requestNode = objectMapper.createObjectNode();
    requestNode.put("variableNameLike", "%Var2");
    assertResultsPresentInDataResponse(url, requestNode, 0, null, null);

    requestNode = objectMapper.createObjectNode();
    ArrayNode variableArray = objectMapper.createArrayNode();
    ObjectNode variableNode = objectMapper.createObjectNode();
    variableArray.add(variableNode);
    requestNode.set("variables", variableArray);
    variableNode.put("name", "stringVar");
    variableNode.put("value", "Azerty");
    variableNode.put("operation", "equals");
    assertResultsPresentInDataResponse(url, requestNode, 2, "stringVar", "Azerty");

    variableNode.removeAll();
    requestNode.set("variables", variableArray);
    variableNode.put("name", "taskVariable");
    variableNode.put("value", "test");
    variableNode.put("operation", "equals");
    assertResultsPresentInDataResponse(url, requestNode, 1, "taskVariable", "test");

    variableNode.removeAll();
    requestNode.set("variables", variableArray);
    variableNode.put("name", "taskVariable");
    variableNode.put("value", "test");
    variableNode.put("operation", "notEquals");
    assertErrorResult(url, requestNode, HttpStatus.SC_BAD_REQUEST);
}
 
Example 8
Source File: HistoricVariableInstanceQueryResourceTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
/**
 * Test querying historic variable instance. POST query/historic-variable-instances
 */
@Test
@Deployment
public void testQueryVariableInstances() throws Exception {
    HashMap<String, Object> processVariables = new HashMap<>();
    processVariables.put("stringVar", "Azerty");
    processVariables.put("intVar", 67890);
    processVariables.put("booleanVar", false);

    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", processVariables);
    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    taskService.complete(task.getId());
    task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    taskService.setVariableLocal(task.getId(), "taskVariable", "test");

    ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("oneTaskProcess", processVariables);

    String url = RestUrls.createRelativeResourceUrl(RestUrls.URL_HISTORIC_VARIABLE_INSTANCE_QUERY);

    ObjectNode requestNode = objectMapper.createObjectNode();
    requestNode.put("variableName", "stringVar");
    assertResultsPresentInDataResponse(url, requestNode, 2, "stringVar", "Azerty");

    requestNode = objectMapper.createObjectNode();
    requestNode.put("variableName", "booleanVar");
    assertResultsPresentInDataResponse(url, requestNode, 2, "booleanVar", false);

    requestNode = objectMapper.createObjectNode();
    requestNode.put("variableName", "booleanVar2");
    assertResultsPresentInDataResponse(url, requestNode, 0, null, null);

    requestNode = objectMapper.createObjectNode();
    requestNode.put("processInstanceId", processInstance.getId());
    assertResultsPresentInDataResponse(url, requestNode, 4, "taskVariable", "test");

    requestNode = objectMapper.createObjectNode();
    requestNode.put("processInstanceId", processInstance.getId());
    requestNode.put("excludeTaskVariables", true);
    assertResultsPresentInDataResponse(url, requestNode, 3, "intVar", 67890);

    requestNode = objectMapper.createObjectNode();
    requestNode.put("processInstanceId", processInstance2.getId());
    assertResultsPresentInDataResponse(url, requestNode, 3, "stringVar", "Azerty");

    requestNode = objectMapper.createObjectNode();
    requestNode.put("taskId", task.getId());
    assertResultsPresentInDataResponse(url, requestNode, 1, "taskVariable", "test");

    requestNode = objectMapper.createObjectNode();
    requestNode.put("taskId", task.getId());
    requestNode.put("variableName", "booleanVar");
    assertResultsPresentInDataResponse(url, requestNode, 0, null, null);

    requestNode = objectMapper.createObjectNode();
    requestNode.put("variableNameLike", "%Var");
    assertResultsPresentInDataResponse(url, requestNode, 6, "stringVar", "Azerty");

    requestNode = objectMapper.createObjectNode();
    requestNode.put("variableNameLike", "%Var2");
    assertResultsPresentInDataResponse(url, requestNode, 0, null, null);

    requestNode = objectMapper.createObjectNode();
    ArrayNode variableArray = objectMapper.createArrayNode();
    ObjectNode variableNode = objectMapper.createObjectNode();
    variableArray.add(variableNode);
    requestNode.set("variables", variableArray);
    variableNode.put("name", "stringVar");
    variableNode.put("value", "Azerty");
    variableNode.put("operation", "equals");
    assertResultsPresentInDataResponse(url, requestNode, 2, "stringVar", "Azerty");

    variableNode.removeAll();
    requestNode.set("variables", variableArray);
    variableNode.put("name", "taskVariable");
    variableNode.put("value", "test");
    variableNode.put("operation", "equals");
    assertResultsPresentInDataResponse(url, requestNode, 1, "taskVariable", "test");

    variableNode.removeAll();
    requestNode.set("variables", variableArray);
    variableNode.put("name", "taskVariable");
    variableNode.put("value", "test");
    variableNode.put("operation", "notEquals");
    assertErrorResult(url, requestNode, HttpStatus.SC_BAD_REQUEST);
}