use of org.camunda.bpm.engine.impl.persistence.entity.FilterEntity in project camunda-bpm-platform by camunda.
the class TaskQueryDisabledStoredExpressionsTest method testCannotExecuteStoredFilter.
public void testCannotExecuteStoredFilter() {
final TaskQuery filterQuery = taskService.createTaskQuery().dueAfterExpression(STATE_MANIPULATING_EXPRESSION);
// store a filter bypassing validation
// the API way of doing this would be by reconfiguring the engine
String filterId = processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command<String>() {
public String execute(CommandContext commandContext) {
FilterEntity filter = new FilterEntity(EntityTypes.TASK);
filter.setQuery(filterQuery);
filter.setName("filter");
commandContext.getDbEntityManager().insert(filter);
return filter.getId();
}
});
extendFilterAndValidateFailingQuery(filterId, null);
// cleanup
filterService.deleteFilter(filterId);
}
use of org.camunda.bpm.engine.impl.persistence.entity.FilterEntity in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithVariableValueTypeSorting.
@Test
public void testGetFilterWithVariableValueTypeSorting() {
TaskQuery query = new TaskQueryImpl().orderByExecutionVariable("foo", ValueType.STRING).asc().orderByExecutionVariable("foo", ValueType.INTEGER).asc().orderByExecutionVariable("foo", ValueType.SHORT).asc().orderByExecutionVariable("foo", ValueType.DATE).asc().orderByExecutionVariable("foo", ValueType.BOOLEAN).asc().orderByExecutionVariable("foo", ValueType.LONG).asc().orderByExecutionVariable("foo", ValueType.DOUBLE).asc();
Filter filter = new FilterEntity("Task").setName("test").setQuery(query);
when(filterServiceMock.getFilter(EXAMPLE_FILTER_ID)).thenReturn(filter);
Response response = given().pathParam("id", EXAMPLE_FILTER_ID).then().expect().statusCode(Status.OK.getStatusCode()).when().get(SINGLE_FILTER_URL);
// validate sorting content
String content = response.asString();
List<Map<String, Object>> sortings = from(content).getJsonObject("query.sorting");
assertThat(sortings).hasSize(7);
assertSorting(sortings.get(0), SORT_BY_EXECUTION_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.STRING);
assertSorting(sortings.get(1), SORT_BY_EXECUTION_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.INTEGER);
assertSorting(sortings.get(2), SORT_BY_EXECUTION_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.SHORT);
assertSorting(sortings.get(3), SORT_BY_EXECUTION_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.DATE);
assertSorting(sortings.get(4), SORT_BY_EXECUTION_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.BOOLEAN);
assertSorting(sortings.get(5), SORT_BY_EXECUTION_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.LONG);
assertSorting(sortings.get(6), SORT_BY_EXECUTION_VARIABLE, SORT_ORDER_ASC_VALUE, "foo", ValueType.DOUBLE);
}
use of org.camunda.bpm.engine.impl.persistence.entity.FilterEntity in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithoutTenantIdQuery.
@Test
public void testGetFilterWithoutTenantIdQuery() {
TaskQueryImpl query = new TaskQueryImpl();
query.withoutTenantId();
Filter filter = new FilterEntity("Task").setName("test").setQuery(query);
when(filterServiceMock.getFilter(EXAMPLE_FILTER_ID)).thenReturn(filter);
given().pathParam("id", EXAMPLE_FILTER_ID).then().expect().statusCode(Status.OK.getStatusCode()).body("query.withoutTenantId", is(true)).when().get(SINGLE_FILTER_URL);
}
use of org.camunda.bpm.engine.impl.persistence.entity.FilterEntity in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithFollowUpBeforeOrNotExistentExpression.
@Test
public void testGetFilterWithFollowUpBeforeOrNotExistentExpression() {
TaskQueryImpl query = new TaskQueryImpl();
query.followUpBeforeOrNotExistentExpression("#{now()}");
Filter filter = new FilterEntity("Task").setName("test").setQuery(query);
when(filterServiceMock.getFilter(EXAMPLE_FILTER_ID)).thenReturn(filter);
given().pathParam("id", EXAMPLE_FILTER_ID).then().expect().statusCode(Status.OK.getStatusCode()).body("query.followUpBeforeOrNotExistentExpression", equalTo("#{now()}")).when().get(SINGLE_FILTER_URL);
}
use of org.camunda.bpm.engine.impl.persistence.entity.FilterEntity in project camunda-bpm-platform by camunda.
the class FilterRestServiceInteractionTest method testGetFilterWithSingleSorting.
@Test
public void testGetFilterWithSingleSorting() {
TaskQuery query = new TaskQueryImpl().orderByTaskName().desc();
Filter filter = new FilterEntity("Task").setName("test").setQuery(query);
when(filterServiceMock.getFilter(EXAMPLE_FILTER_ID)).thenReturn(filter);
Response response = given().pathParam("id", EXAMPLE_FILTER_ID).then().expect().statusCode(Status.OK.getStatusCode()).when().get(SINGLE_FILTER_URL);
// validate sorting content
String content = response.asString();
List<Map<String, Object>> sortings = from(content).getJsonObject("query.sorting");
assertThat(sortings).hasSize(1);
assertSorting(sortings.get(0), SORT_BY_NAME_VALUE, SORT_ORDER_DESC_VALUE);
}
Aggregations