@Ignore("Unable to appropriately mock out Autobean factory") @Test public void testQueryTemplateListCallbackConverter_Case1() { unitUnderTest.getSavedQueryTemplates(asyncQtListMock); verify(deServiceFacadeMock).getServiceData(any(ServiceCallWrapper.class), asyncStringCaptor.capture()); DiskResourceQueryTemplate qtMock1 = mock(DiskResourceQueryTemplate.class); DiskResourceQueryTemplate qtMock2 = mock(DiskResourceQueryTemplate.class); DiskResourceQueryTemplate qtMock3 = mock(DiskResourceQueryTemplate.class); when(qtMock1.isDirty()).thenReturn(true); when(qtMock1.isDirty()).thenReturn(false); when(qtMock1.isDirty()).thenReturn(true); final DiskResourceQueryTemplateList qtListMock = mock(DiskResourceQueryTemplateList.class); when(qtListMock.getQueryTemplateList()).thenReturn(Lists.newArrayList(qtMock1, qtMock2, qtMock3)); when(qtlistAbMock.as()).thenReturn(qtListMock); when(searchAbFactoryMock.create(DiskResourceQueryTemplateList.class)).thenReturn(qtlistAbMock); final String endpointResponse = "{\"fileSizeRange\":{},\"total\":22,\"files\":[],\"modifiedWithin\":{},\"fileQuery\":\"and nudda \",\"permissions\":{\"write\":true,\"read\":true,\"own\":true},\"path\":\"/savedFilters/\",\"folders\":[],\"label\":\"T3\",\"createdWithin\":{}},{\"fileSizeRange\":{},\"files\":[],\"modifiedWithin\":{},\"fileQuery\":\"asdf\",\"permissions\":{\"write\":true,\"read\":true,\"own\":true},\"path\":\"/savedFilters/\",\"folders\":[],\"label\":\"asdf\",\"createdWithin\":{}},{\"fileSizeRange\":{},\"files\":[],\"modifiedWithin\":{},\"fileQuery\":\"asdf\",\"permissions\":{\"write\":true,\"read\":true,\"own\":true},\"path\":\"/savedFilters/\",\"folders\":[],\"label\":\"TwoNEW\",\"createdWithin\":{}},{\"fileSizeRange\":{},\"files\":[],\"modifiedWithin\":{},\"fileQuery\":\"asdf\",\"permissions\":{\"write\":true,\"read\":true,\"own\":true},\"path\":\"/savedFilters/\",\"folders\":[],\"label\":\"Freeeee\",\"createdWithin\":{}}]"; asyncStringCaptor.getValue().onSuccess(endpointResponse); verify(asyncQtListMock).onSuccess(qtListCaptor.capture()); for (DiskResourceQueryTemplate qt : qtListCaptor.getValue()) { verify(qt).setDirty(eq(false)); } }
@Override public void getSavedQueryTemplates(AsyncCallback<List<DiskResourceQueryTemplate>> callback) { String address = deProperties.getMuleServiceBaseUrl() + "saved-searches"; ServiceCallWrapper wrapper = new ServiceCallWrapper(GET, address); deServiceFacade.getServiceData(wrapper, new QueryTemplateListCallbackConverter(callback, searchAbFactory)); }
SearchServiceFacadeImpl implements SearchServiceFacade { @Override public void getSavedQueryTemplates(AsyncCallback<List<DiskResourceQueryTemplate>> callback) { String address = deProperties.getMuleServiceBaseUrl() + "saved-searches"; ServiceCallWrapper wrapper = new ServiceCallWrapper(GET, address); deServiceFacade.getServiceData(wrapper, new QueryTemplateListCallbackConverter(callback, searchAbFactory)); } }
SearchServiceFacadeImpl implements SearchServiceFacade { @Override public void getSavedQueryTemplates(AsyncCallback<List<DiskResourceQueryTemplate>> callback) { String address = deProperties.getMuleServiceBaseUrl() + "saved-searches"; ServiceCallWrapper wrapper = new ServiceCallWrapper(GET, address); deServiceFacade.getServiceData(wrapper, new QueryTemplateListCallbackConverter(callback, searchAbFactory)); } @Inject  SearchServiceFacadeImpl(final DiscEnvApiService deServiceFacade,
                                   final DEProperties deProperties,
                                   final SearchAutoBeanFactory searchAbFactory,
                                   final DiskResourceAutoBeanFactory drFactory,
                                   final UserInfo userInfo); }
SearchServiceFacadeImpl implements SearchServiceFacade { @Override public void getSavedQueryTemplates(AsyncCallback<List<DiskResourceQueryTemplate>> callback) { String address = deProperties.getMuleServiceBaseUrl() + "saved-searches"; ServiceCallWrapper wrapper = new ServiceCallWrapper(GET, address); deServiceFacade.getServiceData(wrapper, new QueryTemplateListCallbackConverter(callback, searchAbFactory)); } @Inject  SearchServiceFacadeImpl(final DiscEnvApiService deServiceFacade,
                                   final DEProperties deProperties,
                                   final SearchAutoBeanFactory searchAbFactory,
                                   final DiskResourceAutoBeanFactory drFactory,
                                   final UserInfo userInfo); @Override List<DiskResourceQueryTemplate> createFrozenList(List<DiskResourceQueryTemplate> queryTemplates); @Override void getSavedQueryTemplates(AsyncCallback<List<DiskResourceQueryTemplate>> callback); @Override void saveQueryTemplates(List<DiskResourceQueryTemplate> queryTemplates, AsyncCallback<List<DiskResourceQueryTemplate>> callback); @Override void deleteQueryTemplates(List<DiskResourceQueryTemplate> queryTemplates,
                                     AsyncCallback<List<DiskResourceQueryTemplate>> callback); @Override void submitSearchFromQueryTemplate(DiskResourceQueryTemplate queryTemplate, FilterPagingLoadConfigBean loadConfig, TYPE searchType, AsyncCallback<List<DiskResource>> callback); }
SearchServiceFacadeImpl implements SearchServiceFacade { @Override public void getSavedQueryTemplates(AsyncCallback<List<DiskResourceQueryTemplate>> callback) { String address = deProperties.getMuleServiceBaseUrl() + "saved-searches"; ServiceCallWrapper wrapper = new ServiceCallWrapper(GET, address); deServiceFacade.getServiceData(wrapper, new QueryTemplateListCallbackConverter(callback, searchAbFactory)); } @Inject  SearchServiceFacadeImpl(final DiscEnvApiService deServiceFacade,
                                   final DEProperties deProperties,
                                   final SearchAutoBeanFactory searchAbFactory,
                                   final DiskResourceAutoBeanFactory drFactory,
                                   final UserInfo userInfo); @Override List<DiskResourceQueryTemplate> createFrozenList(List<DiskResourceQueryTemplate> queryTemplates); @Override void getSavedQueryTemplates(AsyncCallback<List<DiskResourceQueryTemplate>> callback); @Override void saveQueryTemplates(List<DiskResourceQueryTemplate> queryTemplates, AsyncCallback<List<DiskResourceQueryTemplate>> callback); @Override void deleteQueryTemplates(List<DiskResourceQueryTemplate> queryTemplates,
                                     AsyncCallback<List<DiskResourceQueryTemplate>> callback); @Override void submitSearchFromQueryTemplate(DiskResourceQueryTemplate queryTemplate, FilterPagingLoadConfigBean loadConfig, TYPE searchType, AsyncCallback<List<DiskResource>> callback);  }