use of ddf.catalog.cache.SolrCacheMBean in project ddf by codice.
the class RemoveAllCommandTest method testExecuteWithSubjectWithCache.
/**
* Checks the forced (-f) generic case with (--cache) option
*
* @throws Exception
*/
@Test
public void testExecuteWithSubjectWithCache() throws Exception {
// given
final SolrCacheMBean mbean = mock(SolrCacheMBean.class);
RemoveAllCommand removeAllCommand = new RemoveAllCommand() {
@Override
protected SolrCacheMBean getCacheProxy() {
return mbean;
}
};
removeAllCommand.force = true;
removeAllCommand.cache = true;
// when
removeAllCommand.executeWithSubject();
// then
verify(mbean, times(1)).removeAll();
}
use of ddf.catalog.cache.SolrCacheMBean in project ddf by codice.
the class RemoveCommandTest method testNullList.
/**
* Tests the {@Link RemoveCommand} when passed
* a null list of ids
*
* @throws Exception
*/
@Test
public void testNullList() throws Exception {
final SolrCacheMBean mbean = mock(SolrCacheMBean.class);
RemoveCommand removeCommand = new RemoveCommand() {
@Override
protected SolrCacheMBean getCacheProxy() {
return mbean;
}
};
removeCommand.ids = null;
removeCommand.executeWithSubject();
assertThat(consoleOutput.getOutput(), containsString("Nothing to remove."));
}
use of ddf.catalog.cache.SolrCacheMBean in project ddf by codice.
the class RemoveCommandTest method testMultipleItemList.
@Test
public void testMultipleItemList() throws Exception {
final SolrCacheMBean mbean = mock(SolrCacheMBean.class);
RemoveCommand removeCommand = new RemoveCommand() {
@Override
protected SolrCacheMBean getCacheProxy() {
return mbean;
}
};
List<String> ids = new ArrayList<>();
ids.add(metacardList.get(0).getId());
ids.add(metacardList.get(1).getId());
ids.add(metacardList.get(2).getId());
removeCommand.ids = ids;
removeCommand.cache = true;
removeCommand.executeWithSubject();
String[] idsArray = new String[ids.size()];
idsArray = ids.toArray(idsArray);
verify(mbean, times(1)).removeById(idsArray);
}
use of ddf.catalog.cache.SolrCacheMBean in project ddf by codice.
the class RemoveCommandTest method testSingleItemList.
@Test
public void testSingleItemList() throws Exception {
final SolrCacheMBean mbean = mock(SolrCacheMBean.class);
RemoveCommand removeCommand = new RemoveCommand() {
@Override
protected SolrCacheMBean getCacheProxy() {
return mbean;
}
};
List<String> ids = new ArrayList<>();
ids.add(metacardList.get(0).getId());
removeCommand.ids = ids;
removeCommand.cache = true;
removeCommand.executeWithSubject();
String[] idsArray = new String[ids.size()];
idsArray = ids.toArray(idsArray);
verify(mbean, times(1)).removeById(idsArray);
}
Aggregations