@Test public void testGetStartFormVariables() { given().pathParam("id", EXAMPLE_PROCESS_DEFINITION_ID) .then().expect() .statusCode(Status.OK.getStatusCode()).contentType(ContentType.JSON) .body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".value", equalTo(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getValue())) .body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".type", equalTo(VariableTypeHelper.toExpectedValueTypeName(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getType()))) .when().get(START_FORM_VARIABLES_URL) .body(); verify(formServiceMock, times(1)).getStartFormVariables(EXAMPLE_PROCESS_DEFINITION_ID, null, true); }
@Test public void testGetTaskFormVariables() { given().pathParam("id", EXAMPLE_TASK_ID) .header("accept", MediaType.APPLICATION_JSON) .then().expect() .statusCode(Status.OK.getStatusCode()).contentType(ContentType.JSON) .body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".type", equalTo(VariableTypeHelper.toExpectedValueTypeName(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getType()))) .body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".value", equalTo(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getValue())) .when().get(FORM_VARIABLES_URL) .body(); verify(formServiceMock, times(1)).getTaskFormVariables(EXAMPLE_TASK_ID, null, true); }
@Test public void testGetStartFormVariablesAndDoNotDeserializeVariables() { given() .pathParam("id", EXAMPLE_PROCESS_DEFINITION_ID) .queryParam("deserializeValues", false) .then() .expect() .statusCode(Status.OK.getStatusCode()).contentType(ContentType.JSON) .body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".value", equalTo(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getValue())) .body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".type", equalTo(VariableTypeHelper.toExpectedValueTypeName(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getType()))) .when().get(START_FORM_VARIABLES_URL) .body(); verify(formServiceMock, times(1)).getStartFormVariables(EXAMPLE_PROCESS_DEFINITION_ID, null, false); }
protected void verifyStringValue(Map<String, Object> stringValue) { StringValue exampleValue = MockProvider.EXAMPLE_HISTORIC_DECISION_STRING_VALUE; assertThat(stringValue, hasEntry("type", (Object) VariableValueDto.toRestApiTypeName(exampleValue.getType().getName()))); assertThat(stringValue, hasEntry("value", (Object) exampleValue.getValue())); assertThat(stringValue, hasEntry("valueInfo", (Object) Collections.emptyMap())); }
@Test public void testGetTaskFormVariablesAndDoNotDeserializeVariables() { given() .pathParam("id", EXAMPLE_TASK_ID) .queryParam("deserializeValues", false) .header("accept", MediaType.APPLICATION_JSON) .then().expect() .statusCode(Status.OK.getStatusCode()).contentType(ContentType.JSON) .body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".type", equalTo(VariableTypeHelper.toExpectedValueTypeName(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getType()))) .body(MockProvider.EXAMPLE_VARIABLE_INSTANCE_NAME+".value", equalTo(MockProvider.EXAMPLE_PRIMITIVE_VARIABLE_VALUE.getValue())) .when().get(FORM_VARIABLES_URL) .body(); verify(formServiceMock, times(1)).getTaskFormVariables(EXAMPLE_TASK_ID, null, false); }