use of ddf.catalog.source.CatalogProvider in project ddf by codice.
the class RemoteSolrCatalogProviderTest method testAvailability.
@Test
public void testAvailability() throws IngestException {
CatalogProvider provider = new MockedRemoteSolrCatalogProvider(null);
assertThat(provider.isAvailable(), is(false));
}
use of ddf.catalog.source.CatalogProvider in project ddf by codice.
the class RemoteSolrCatalogProviderTest method testUnconfiguredCreateSolrException.
/**
* Tests what happens when a {@link SolrException} is thrown when Solr is pinged
*
* @throws IngestException
* @throws SolrServerException
* @throws IOException
*/
@Test
public void testUnconfiguredCreateSolrException() throws IngestException, SolrServerException, IOException {
// given
SolrClient givenClient = mock(SolrClient.class);
when(givenClient.ping()).thenThrow(SolrException.class);
CatalogProvider provider = new MockedRemoteSolrCatalogProvider(givenClient);
// when
String message = null;
try {
provider.create(mock(CreateRequest.class));
} catch (IllegalStateException e) {
message = e.getMessage();
}
// then
assertThat(message, containsString("Solr client is not connected"));
verify(givenClient, times(1)).ping();
}
use of ddf.catalog.source.CatalogProvider in project ddf by codice.
the class TestQueryMonitor method testActiveSearchConstructorNullQueryString.
@Test
public void testActiveSearchConstructorNullQueryString() {
CatalogProvider mockSource = mock(CatalogProvider.class);
uuid = UUID.randomUUID();
as = new ActiveSearch(null, mockSource, uuid, CLIENT_TEXT);
assertThat(as.getSource(), is(mockSource));
assertThat(as.getUniqueID(), is(uuid));
assertThat(as.getClientInfo(), is(CLIENT_TEXT));
}
use of ddf.catalog.source.CatalogProvider in project ddf by codice.
the class CachingFederationStrategyTest method testCatalogProviderSource.
@Test
public void testCatalogProviderSource() throws Exception {
CatalogProvider catalogProviderSource = mock(CatalogProvider.class);
when(catalogProviderSource.getId()).thenReturn(SystemInfo.getSiteName());
QueryRequest fedQueryRequest = new QueryRequestImpl(mockQuery, properties);
strategy.federate(Arrays.asList(catalogProviderSource), fedQueryRequest);
verify(validationQueryFactory).getQueryRequestWithValidationFilter(any(QueryRequest.class), any(Boolean.class), any(Boolean.class));
}
use of ddf.catalog.source.CatalogProvider in project ddf by codice.
the class TagsFilterQueryPluginTest method setup.
@Before
public void setup() {
CatalogProvider catProvider1 = mock(CatalogProvider.class);
CatalogProvider catProvider2 = mock(CatalogProvider.class);
CatalogProvider catProvider3 = mock(CatalogProvider.class);
when(catProvider1.getId()).thenReturn("cat1");
when(catProvider2.getId()).thenReturn("cat2");
when(catProvider3.getId()).thenReturn("cat3");
ImmutableList<CatalogProvider> catalogProviders = ImmutableList.of(catProvider1, catProvider2, catProvider3);
filterAdapter = mock(FilterAdapter.class);
filterBuilder = mock(FilterBuilder.class);
plugin = new TagsFilterQueryPlugin(catalogProviders, filterAdapter, filterBuilder);
source = mock(CatalogProvider.class);
when(source.getId()).thenReturn("cat2");
cache = mock(SourceCache.class);
when(cache.getId()).thenReturn("cache");
queryRequest = mock(QueryRequest.class);
query = mock(Query.class);
when(queryRequest.getQuery()).thenReturn(query);
}
Aggregations