use of org.apache.geode.cache.lucene.internal.cli.LuceneDestroyIndexInfo in project geode by apache.
the class LuceneDestroyIndexFunctionJUnitTest method testDestroyIndexFailure.
@Test
@SuppressWarnings("unchecked")
public void testDestroyIndexFailure() throws Throwable {
String indexName = "index1";
String regionPath = "/region1";
LuceneDestroyIndexInfo indexInfo = new LuceneDestroyIndexInfo(indexName, regionPath, false);
when(this.context.getArguments()).thenReturn(indexInfo);
LuceneDestroyIndexFunction function = new LuceneDestroyIndexFunction();
function = spy(function);
doReturn(this.cache).when(function).getCache();
doThrow(new IllegalStateException()).when(this.service).destroyIndex(eq(indexName), eq(regionPath));
function.execute(this.context);
verifyFunctionResult(false);
}
use of org.apache.geode.cache.lucene.internal.cli.LuceneDestroyIndexInfo in project geode by apache.
the class LuceneDestroyIndexFunctionJUnitTest method testDestroyDefinedIndexFailure.
@Test
@SuppressWarnings("unchecked")
public void testDestroyDefinedIndexFailure() throws Throwable {
String indexName = "index1";
String regionPath = "/region1";
LuceneDestroyIndexInfo indexInfo = new LuceneDestroyIndexInfo(indexName, regionPath, true);
when(this.context.getArguments()).thenReturn(indexInfo);
LuceneDestroyIndexFunction function = new LuceneDestroyIndexFunction();
function = spy(function);
doReturn(this.cache).when(function).getCache();
doThrow(new IllegalStateException()).when(this.service).destroyDefinedIndex(eq(indexName), eq(regionPath));
function.execute(this.context);
verifyFunctionResult(false);
}
use of org.apache.geode.cache.lucene.internal.cli.LuceneDestroyIndexInfo in project geode by apache.
the class LuceneDestroyIndexFunctionJUnitTest method testDestroyDefinedIndexes.
@Test
@SuppressWarnings("unchecked")
public void testDestroyDefinedIndexes() throws Throwable {
String regionPath = "/region1";
LuceneDestroyIndexInfo indexInfo = new LuceneDestroyIndexInfo(null, regionPath, true);
when(this.context.getArguments()).thenReturn(indexInfo);
LuceneDestroyIndexFunction function = new LuceneDestroyIndexFunction();
function = spy(function);
doReturn(this.cache).when(function).getCache();
function.execute(this.context);
verify(this.service).destroyDefinedIndexes(eq(regionPath));
verify(this.service, never()).destroyIndexes(eq(regionPath));
verify(this.service, never()).destroyIndex(any(), eq(regionPath));
verify(function, never()).getXmlEntity(eq("index1"), eq(regionPath));
verifyFunctionResult(true);
}
use of org.apache.geode.cache.lucene.internal.cli.LuceneDestroyIndexInfo in project geode by apache.
the class LuceneDestroyIndexFunctionJUnitTest method testDestroyDefinedIndexesFailure.
@Test
@SuppressWarnings("unchecked")
public void testDestroyDefinedIndexesFailure() throws Throwable {
String regionPath = "/region1";
LuceneDestroyIndexInfo indexInfo = new LuceneDestroyIndexInfo(null, regionPath, true);
when(this.context.getArguments()).thenReturn(indexInfo);
LuceneDestroyIndexFunction function = new LuceneDestroyIndexFunction();
function = spy(function);
doReturn(this.cache).when(function).getCache();
doThrow(new IllegalStateException()).when(this.service).destroyDefinedIndexes(eq(regionPath));
function.execute(this.context);
verifyFunctionResult(false);
}
use of org.apache.geode.cache.lucene.internal.cli.LuceneDestroyIndexInfo in project geode by apache.
the class LuceneDestroyIndexFunctionJUnitTest method testDestroyIndexes.
@Test
@SuppressWarnings("unchecked")
public void testDestroyIndexes() throws Throwable {
String regionPath = "/region1";
LuceneDestroyIndexInfo indexInfo = new LuceneDestroyIndexInfo(null, regionPath, false);
when(this.context.getArguments()).thenReturn(indexInfo);
LuceneDestroyIndexFunction function = new LuceneDestroyIndexFunction();
function = spy(function);
doReturn(this.cache).when(function).getCache();
function.execute(this.context);
verify(this.service).destroyIndexes(eq(regionPath));
verify(function).getXmlEntity(eq(null), eq(regionPath));
verify(this.service, never()).destroyDefinedIndexes(eq(regionPath));
verify(this.service, never()).destroyIndex(any(), eq(regionPath));
verifyFunctionResult(true);
}
Aggregations