use of org.codice.ddf.ui.searchui.query.model.SearchRequest in project ddf by codice.
the class SearchControllerTest method testExecuteQueryCacheDisabled.
/**
* Verify that the CatalogFramework does not use the cache (i.e. the CatalogFramework
* is called WITHOUT the query request property mode=cache).
*/
@Test
public void testExecuteQueryCacheDisabled() throws Exception {
// Setup
final String ID = "id";
Set<String> srcIds = new HashSet<>(1);
srcIds.add(ID);
SearchRequest request = new SearchRequest(srcIds, getQueryRequest("title LIKE 'Meta*'"), ID);
BayeuxServer bayeuxServer = mock(BayeuxServer.class);
ServerChannel channel = mock(ServerChannel.class);
when(bayeuxServer.getChannel(any(String.class))).thenReturn(channel);
ArgumentCaptor<QueryRequest> queryRequestCaptor = ArgumentCaptor.forClass(QueryRequest.class);
// Enable Cache
searchController.setCacheDisabled(true);
searchController.setBayeuxServer(bayeuxServer);
// Perform Test
searchController.executeQuery(request, mockServerSession, null);
// Verify
verify(framework).query(queryRequestCaptor.capture());
assertThat(queryRequestCaptor.getValue().getProperties().size(), is(0));
}
Aggregations