public VariableRecordStream withName(final String name) { return valueFilter(v -> v.getName().equals(name)); }
public VariableRecordStream withValue(final String value) { return valueFilter(v -> v.getValue().equals(value)); } }
public VariableRecordStream withScopeInstanceKey(final long scopeInstanceKey) { return valueFilter(v -> v.getScopeInstanceKey() == scopeInstanceKey); }
@Test public void shouldCreateMultipleVariablesFromPayload() { // given testClient.deploy(WORKFLOW); // when testClient.createWorkflowInstance(PROCESS_ID, "{'x':1, 'y':2}"); // then assertThat(RecordingExporter.variableRecords(VariableIntent.CREATED).limit(2)) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(2) .contains(tuple("x", "1"), tuple("y", "2")); }
public VariableRecordStream withScopeKey(final long scopeKey) { return valueFilter(v -> v.getScopeKey() == scopeKey); }
@Test public void shouldCreateMultipleVariablesFromPayload() { // given testClient.deploy(WORKFLOW); // when testClient.createWorkflowInstance(PROCESS_ID, "{'x':1, 'y':2}"); // then assertThat(RecordingExporter.variableRecords(VariableIntent.CREATED).limit(2)) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(2) .contains(tuple("x", "1"), tuple("y", "2")); }
@Test public void shouldUpdateMultipleVariablesFromPayload() { // given testClient.deploy(WORKFLOW); testClient.createWorkflowInstance(PROCESS_ID, "{'x':1, 'y':2, 'z':3}"); // when testClient.completeJobOfType("test", "{'x':1, 'y':4, 'z':5}"); // then assertThat(RecordingExporter.variableRecords(VariableIntent.UPDATED).limit(2)) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(2) .contains(tuple("y", "4"), tuple("z", "5")); }
public VariableRecordStream withValue(final String value) { return valueFilter(v -> v.getValue().equals(value)); } }
public VariableRecordStream withName(final String name) { return valueFilter(v -> v.getName().equals(name)); }
/** * Verifies that the actual VariableRecordValue's scopeInstanceKey is equal to the given one. * @param scopeInstanceKey the given scopeInstanceKey to compare the actual VariableRecordValue's scopeInstanceKey to. * @return this assertion object. * @throws AssertionError - if the actual VariableRecordValue's scopeInstanceKey is not equal to the given one. */ public S hasScopeInstanceKey(long scopeInstanceKey) { // check that actual VariableRecordValue we want to make assertions on is not null. isNotNull(); // overrides the default error message with a more explicit one String assertjErrorMessage = "\nExpecting scopeInstanceKey of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>"; // check long actualScopeInstanceKey = actual.getScopeInstanceKey(); if (actualScopeInstanceKey != scopeInstanceKey) { failWithMessage(assertjErrorMessage, actual, scopeInstanceKey, actualScopeInstanceKey); } // return the current assertion for method chaining return myself; }
@Test public void shouldUpdateMultipleVariablesFromPayload() { // given testClient.deploy(WORKFLOW); testClient.createWorkflowInstance(PROCESS_ID, "{'x':1, 'y':2, 'z':3}"); // when testClient.completeJobOfType("test", "{'x':1, 'y':4, 'z':5}"); // then assertThat(RecordingExporter.variableRecords(VariableIntent.UPDATED).limit(2)) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(2) .contains(tuple("y", "4"), tuple("z", "5")); }
/** * Verifies that the actual VariableRecordValue's value is equal to the given one. * @param value the given value to compare the actual VariableRecordValue's value to. * @return this assertion object. * @throws AssertionError - if the actual VariableRecordValue's value is not equal to the given one. */ public S hasValue(String value) { // check that actual VariableRecordValue we want to make assertions on is not null. isNotNull(); // overrides the default error message with a more explicit one String assertjErrorMessage = "\nExpecting value of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>"; // null safe check String actualValue = actual.getValue(); if (!Objects.areEqual(actualValue, value)) { failWithMessage(assertjErrorMessage, actual, value, actualValue); } // return the current assertion for method chaining return myself; }
/** * Verifies that the actual VariableRecordValue's name is equal to the given one. * @param name the given name to compare the actual VariableRecordValue's name to. * @return this assertion object. * @throws AssertionError - if the actual VariableRecordValue's name is not equal to the given one. */ public S hasName(String name) { // check that actual VariableRecordValue we want to make assertions on is not null. isNotNull(); // overrides the default error message with a more explicit one String assertjErrorMessage = "\nExpecting name of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>"; // null safe check String actualName = actual.getName(); if (!Objects.areEqual(actualName, name)) { failWithMessage(assertjErrorMessage, actual, name, actualName); } // return the current assertion for method chaining return myself; }
.limit(expectedActivityVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedActivityVariables.size()) .containsAll(expectedActivityVariables); .limit(expectedScopeVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedScopeVariables.size()) .containsAll(expectedScopeVariables);
.limit(expectedActivtyVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedActivtyVariables.size()) .containsAll(expectedActivtyVariables); .limit(expectedScopeVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedScopeVariables.size()) .containsAll(expectedScopeVariables);
.limit(expectedActivtyVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedActivtyVariables.size()) .containsAll(expectedActivtyVariables); .limit(expectedScopeVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedScopeVariables.size()) .containsAll(expectedScopeVariables);
.limit(expectedActivtyVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedActivtyVariables.size()) .containsAll(expectedActivtyVariables); .limit(expectedScopeVariables.size())) .extracting(Record::getValue) .extracting(v -> tuple(v.getName(), v.getValue())) .hasSize(expectedScopeVariables.size()) .containsAll(expectedScopeVariables);
@Test public void shouldCreateAndUpdateVariablesFromPayload() { // given testClient.deploy(WORKFLOW); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, "{'x':1}"); final Record<VariableRecordValue> variableCreated = RecordingExporter.variableRecords(VariableIntent.CREATED).getFirst(); // when testClient.updatePayload(workflowInstanceKey, "{'x':2, 'y':3}"); // then assertThat( RecordingExporter.variableRecords() .skipUntil(r -> r.getPosition() > variableCreated.getPosition()) .limit(2)) .extracting( record -> tuple( record.getMetadata().getIntent(), record.getValue().getName(), record.getValue().getValue())) .hasSize(2) .contains(tuple(VariableIntent.UPDATED, "x", "2"), tuple(VariableIntent.CREATED, "y", "3")); } }