ProcessInstanceListPresenter extends AbstractMultiGridPresenter<ProcessInstanceSummary, ProcessInstanceListPresenter.ProcessInstanceListView> { @Override public void setupActiveSearchFilters() { final Optional<String> processDefinitionSearch = getSearchParameter(SEARCH_PARAMETER_PROCESS_DEFINITION_ID); if (processDefinitionSearch.isPresent()) { final String processDefinitionId = processDefinitionSearch.get(); addActiveFilter(equalsTo(COLUMN_PROCESS_ID, processDefinitionId), constants.Process_Definition_Id(), processDefinitionId, processDefinitionId, v -> removeActiveFilter(equalsTo(COLUMN_PROCESS_ID, v)) ); } final Optional<String> processInstanceSearch = getSearchParameter(SEARCH_PARAMETER_PROCESS_INSTANCE_ID); if (processInstanceSearch.isPresent()) { final String processInstanceId = processInstanceSearch.get(); addActiveFilter(equalsTo(COLUMN_PROCESS_INSTANCE_ID, Integer.valueOf(processInstanceId)), constants.Id(), processInstanceId, Integer.valueOf(processInstanceId), v -> removeActiveFilter(equalsTo(COLUMN_PROCESS_INSTANCE_ID, v)) ); } }  @Inject void setProcessInstanceSelectedEvent(final Event<ProcessInstanceSelectionEvent> processInstanceSelectionEvent); @Override void createListBreadcrumb(); void setupDetailBreadcrumb(String detailLabel); void getDomainSpecifDataForProcessInstances(final Integer startRange,
                                                       final List<ProcessInstanceSummary> instancesFromDataSet,
                                                       final Boolean lastPage); void newInstanceCreated(@Observes final NewProcessInstanceEvent pi); void newInstanceCreated(@Observes final ProcessInstancesUpdateEvent pis); void abortProcessInstance(String containerId,
                                     long processInstanceId); void abortProcessInstances(Map<String, List<Long>> containerInstances); void bulkSignal(List<ProcessInstanceSummary> processInstances); void bulkAbort(List<ProcessInstanceSummary> processInstances); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); void signalProcessInstance(final ProcessInstanceSummary processInstance); @Override void selectSummaryItem(final ProcessInstanceSummary summary); void refreshDetailBreadcrumb(@Observes ProcessInstanceSelectionEvent event); void formClosed(@Observes BeforeClosePlaceEvent closed); @Inject void setFilterSettingsManager(final ProcessInstanceListFilterSettingsManager filterSettingsManager); @Inject void setProcessService(final Caller<ProcessService> processService); @Override void setupActiveSearchFilters(); @Override boolean existActiveSearchFilters(); @Override ActiveFilterItem getActiveFilterFromColumnFilter(ColumnFilter columnFilter); String getStatusColumnFilterDescription(ColumnFilter columnFilter); void openJobsView(final String pid); void openTaskView(final String pid); @Override void openErrorView(final String pid); Predicate<ProcessInstanceSummary> getSignalActionCondition(); Predicate<ProcessInstanceSummary> getAbortActionCondition(); Predicate<ProcessInstanceSummary> getViewJobsActionCondition(); Predicate<ProcessInstanceSummary> getViewTasksActionCondition(); @Override Predicate<ProcessInstanceSummary> getViewErrorsActionCondition();  }
@Test public void testActiveSearchFiltersProcessDefinitionId() { final PlaceRequest place = mock(PlaceRequest.class); final String processDefinitionId = "defId"; when(place.getParameter(SEARCH_PARAMETER_PROCESS_DEFINITION_ID, null)).thenReturn(processDefinitionId); presenter.onStartup(place); presenter.setupActiveSearchFilters(); ArgumentCaptor<ActiveFilterItem> captor = ArgumentCaptor.forClass(ActiveFilterItem.class); verify(viewMock).addActiveFilter(captor.capture()); assertEquals(1, captor.getAllValues().size()); assertEquals(Constants.INSTANCE.Process_Definition_Id(), captor.getValue().getKey()); assertEquals(Constants.INSTANCE.Process_Definition_Id() + ": " + processDefinitionId, captor.getValue().getLabelValue()); assertEquals(processDefinitionId, (captor.getValue().getValue())); }
@Test public void testActiveSearchFiltersProcessInstanceId() { final PlaceRequest place = mock(PlaceRequest.class); final String processInstanceId = "1"; when(place.getParameter(SEARCH_PARAMETER_PROCESS_DEFINITION_ID, null)).thenReturn(null); when(place.getParameter(SEARCH_PARAMETER_PROCESS_INSTANCE_ID, null)).thenReturn(processInstanceId); presenter.onStartup(place); presenter.setupActiveSearchFilters(); ArgumentCaptor<ActiveFilterItem> captor = ArgumentCaptor.forClass(ActiveFilterItem.class); verify(viewMock).addActiveFilter(captor.capture()); assertEquals(1, captor.getAllValues().size()); assertEquals(Constants.INSTANCE.Id(), captor.getValue().getKey()); assertEquals(Constants.INSTANCE.Id() + ": " + processInstanceId, captor.getValue().getLabelValue()); assertEquals(1, (captor.getValue().getValue())); }