use of junitparams.Parameters in project geode by apache.
the class MixedObjectIndexDUnitTest method luceneMustIndexFieldsWithTheSameNameDifferentDataTypeInARegionWithMixedObjects.
@Test
@Parameters(method = "getPartitionRegionTypes")
public void luceneMustIndexFieldsWithTheSameNameDifferentDataTypeInARegionWithMixedObjects(RegionTestableType regionTestableType) {
SerializableRunnableIF createIndexOnTextField = getSerializableRunnableIFCreateIndexOnFieldText();
dataStore1.invoke(() -> initDataStore(createIndexOnTextField, regionTestableType));
dataStore2.invoke(() -> initDataStore(createIndexOnTextField, regionTestableType));
accessor.invoke(() -> initDataStore(createIndexOnTextField, regionTestableType));
accessor.invoke(() -> {
Region region = getCache().getRegion(REGION_NAME);
IntStream.range(2 * NUM_BUCKETS, 3 * NUM_BUCKETS).forEach(i -> region.put(i, new TestObjectSameFieldNameButDifferentDataTypeInteger(new Integer(1000))));
IntStream.range(0, NUM_BUCKETS).forEach(i -> region.put(i, new TestObject("hello world")));
IntStream.range(NUM_BUCKETS, 2 * NUM_BUCKETS).forEach(i -> region.put(i, new TestObjectSameFieldNameButDifferentDataTypeFloat(new Float(999.1f))));
});
assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 60000));
accessor.invoke(() -> {
LuceneService luceneService = LuceneServiceProvider.get(getCache());
LuceneQuery luceneQueryForTextField = luceneService.createLuceneQueryFactory().setLimit(100).create(INDEX_NAME, REGION_NAME, "world", "text");
List luceneResults = luceneQueryForTextField.findResults();
validateObjectResultCounts(luceneResults, TestObject.class, NUM_BUCKETS, TestObjectSameFieldNameButDifferentDataTypeFloat.class, 0, TestObjectSameFieldNameButDifferentDataTypeInteger.class, 0);
FloatRangeQueryProvider floatRangeQueryProvider = new FloatRangeQueryProvider("text", 999.0f, 999.2f);
luceneQueryForTextField = luceneService.createLuceneQueryFactory().setLimit(100).create(INDEX_NAME, REGION_NAME, floatRangeQueryProvider);
luceneResults = luceneQueryForTextField.findResults();
validateObjectResultCounts(luceneResults, TestObject.class, 0, TestObjectSameFieldNameButDifferentDataTypeFloat.class, NUM_BUCKETS, TestObjectSameFieldNameButDifferentDataTypeInteger.class, 0);
IntRangeQueryProvider intRangeQueryProvider = new IntRangeQueryProvider("text", 1000, 1000);
luceneQueryForTextField = luceneService.createLuceneQueryFactory().setLimit(100).create(INDEX_NAME, REGION_NAME, intRangeQueryProvider);
luceneResults = luceneQueryForTextField.findResults();
validateObjectResultCounts(luceneResults, TestObject.class, 0, TestObjectSameFieldNameButDifferentDataTypeFloat.class, 0, TestObjectSameFieldNameButDifferentDataTypeInteger.class, NUM_BUCKETS);
});
}
use of junitparams.Parameters in project geode by apache.
the class RebalanceWithRedundancyDUnitTest method returnCorrectResultsWhenCloseCacheHappensOnIndexUpdate.
@Test
@Parameters(method = "getListOfRegionTestTypes")
public void returnCorrectResultsWhenCloseCacheHappensOnIndexUpdate(RegionTestableType regionTestType) throws InterruptedException {
dataStore1.invoke(() -> {
IndexRepositorySpy spy = IndexRepositorySpy.injectSpy();
spy.beforeWriteIndexRepository(doAfterN(key -> getCache().close(), 2));
});
final String expectedExceptions = CacheClosedException.class.getName();
dataStore1.invoke(addExceptionTag1(expectedExceptions));
putEntriesAndValidateResultsWithRedundancy(regionTestType);
// Wait until the cache is closed in datastore1
dataStore1.invoke(() -> Awaitility.await().atMost(60, TimeUnit.SECONDS).until(basicGetCache()::isClosed));
}
use of junitparams.Parameters in project geode by apache.
the class RebalanceWithRedundancyDUnitTest method returnCorrectResultsWhenMovePrimaryHappensOnIndexUpdate.
@Test
@Parameters(method = "getListOfRegionTestTypes")
public void returnCorrectResultsWhenMovePrimaryHappensOnIndexUpdate(RegionTestableType regionTestType) throws InterruptedException {
final DistributedMember member2 = dataStore2.invoke(() -> getCache().getDistributedSystem().getDistributedMember());
addCallbackToMovePrimary(dataStore1, member2);
putEntriesAndValidateResultsWithRedundancy(regionTestType);
}
use of junitparams.Parameters in project geode by apache.
the class RebalanceWithRedundancyDUnitTest method returnCorrectResultsWhenCloseCacheHappensOnPartialIndexWrite.
@Test
@Parameters(method = "getListOfRegionTestTypes")
public void returnCorrectResultsWhenCloseCacheHappensOnPartialIndexWrite(RegionTestableType regionTestType) throws InterruptedException {
final DistributedMember member2 = dataStore2.invoke(() -> getCache().getDistributedSystem().getDistributedMember());
dataStore1.invoke(() -> {
IndexRegionSpy.beforeWrite(getCache(), doAfterN(key -> getCache().close(), 100));
});
putEntriesAndValidateResultsWithRedundancy(regionTestType);
// Wait until the cache is closed in datastore1
dataStore1.invoke(() -> Awaitility.await().atMost(60, TimeUnit.SECONDS).until(basicGetCache()::isClosed));
}
use of junitparams.Parameters in project geode by apache.
the class LuceneIndexCreationPersistenceIntegrationTest method shouldHandleMultipleIndexes.
@Test
@Parameters(method = "getRegionShortcuts")
public void shouldHandleMultipleIndexes(RegionShortcut shortcut) throws Exception {
LuceneServiceProvider.get(this.cache).createIndexFactory().setFields("field1").create(INDEX_NAME + "_1", REGION_NAME);
LuceneServiceProvider.get(this.cache).createIndexFactory().setFields("field2").create(INDEX_NAME + "_2", REGION_NAME);
Region region = cache.createRegionFactory(shortcut).create(REGION_NAME);
region.put("key1", new TestObject());
verifyQueryResultSize(INDEX_NAME + "_1", REGION_NAME, "field1:world", DEFAULT_FIELD, 1);
verifyQueryResultSize(INDEX_NAME + "_2", REGION_NAME, "field2:field", DEFAULT_FIELD, 1);
}
Aggregations