RequestListPresenter extends AbstractMultiGridPresenter<RequestSummary, RequestListPresenter.RequestListView> { @Override public void setupActiveSearchFilters() { final Optional<String> processInstIdSearch = getSearchParameter(PerspectiveIds.SEARCH_PARAMETER_PROCESS_INSTANCE_ID); if (processInstIdSearch.isPresent()) { final String processInstId = processInstIdSearch.get(); addActiveFilter( equalsTo(COLUMN_PROCESS_INSTANCE_ID, Integer.valueOf(processInstId)), constants.Process_Instance_Id(), processInstId, Integer.valueOf(processInstId), v -> removeActiveFilter(equalsTo(COLUMN_PROCESS_INSTANCE_ID, v)) ); } else { final Optional<String> jobSearch = getSearchParameter(PerspectiveIds.SEARCH_PARAMETER_JOB_ID); if (jobSearch.isPresent()) { final String jobId = jobSearch.get(); addActiveFilter(equalsTo(COLUMN_ID, Integer.valueOf(jobId)), constants.JobId(), jobId, Integer.valueOf(jobId), v -> removeActiveFilter(equalsTo(COLUMN_ID, v)) ); } } } RequestListPresenter();  RequestListPresenter(RequestListViewImpl view,
                                Caller<ExecutorService> executorServices,
                                DataSetQueryHelper dataSetQueryHelper,
                                Event<RequestChangedEvent> requestChangedEvent,
                                Event<JobSelectedEvent> jobSelectedEvent,
                                PlaceManager placeManager); @Inject void setFilterSettingsManager(final JobListFilterSettingsManager filterSettingsManager); @Override void createListBreadcrumb(); void setupDetailBreadcrumb(String detailLabel); void cancelRequest(final String deploymentId,
                              final Long requestId); void requeueRequest(final String deploymentId,
                               final Long requestId); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @Override void selectSummaryItem(final RequestSummary job); void requestCreated(@Observes RequestChangedEvent event); @Override void setupActiveSearchFilters(); @Override boolean existActiveSearchFilters(); @Override ActiveFilterItem getActiveFilterFromColumnFilter(ColumnFilter columnFilter); String getStatusColumnFilterDescription(ColumnFilter columnFilter); void openProcessInstanceView(final String processInstanceId); Predicate<RequestSummary> getCancelActionCondition(); Predicate<RequestSummary> getRequeueActionCondition(); Predicate<RequestSummary> getViewProcessActionCondition(); void bulkCancel(List<RequestSummary> jobsSelected); void bulkRequeue(List<RequestSummary> jobsSelected);  }
@Test public void testDefaultActiveSearchFiltersWithProcessId() { final PlaceRequest place = mock(PlaceRequest.class); final String processInstanceId = "1"; 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.Process_Instance_Id(), captor.getValue().getKey()); assertEquals(Constants.INSTANCE.Process_Instance_Id() + ": " + processInstanceId, captor.getValue().getLabelValue()); assertEquals(Integer.valueOf(processInstanceId), (captor.getValue().getValue())); }