Search in sources :

Example 11 with Parameters

use of junitparams.Parameters in project geode by apache.

the class LuceneIndexCreationDUnitTest method verifyDifferentFieldAnalyzersFails2.

@Test
@Parameters({ "PARTITION" })
public void verifyDifferentFieldAnalyzersFails2(RegionTestableType regionType) {
    SerializableRunnableIF createIndex1 = getAnalyzersIndexWithNullField1();
    dataStore1.invoke(() -> initDataStore(createIndex1, regionType));
    SerializableRunnableIF createIndex2 = getAnalyzersIndexWithNullField2();
    dataStore2.invoke(() -> initDataStore(createIndex2, regionType, CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_ANALYZERS));
}
Also used : SerializableRunnableIF(org.apache.geode.test.dunit.SerializableRunnableIF) Parameters(junitparams.Parameters) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 12 with Parameters

use of junitparams.Parameters in project geode by apache.

the class LuceneIndexCreationDUnitTest method verifyDifferentIndexNamesFails.

@Test
@Parameters({ "PARTITION" })
public void verifyDifferentIndexNamesFails(RegionTestableType regionType) {
    SerializableRunnableIF createIndex1 = () -> {
        LuceneService luceneService = LuceneServiceProvider.get(getCache());
        luceneService.createIndexFactory().addField("field1").create(INDEX_NAME + "1", REGION_NAME);
    };
    dataStore1.invoke(() -> initDataStore(createIndex1, regionType));
    SerializableRunnableIF createIndex2 = () -> {
        LuceneService luceneService = LuceneServiceProvider.get(getCache());
        luceneService.createIndexFactory().addField("field1").create(INDEX_NAME + "2", REGION_NAME);
    };
    dataStore2.invoke(() -> initDataStore(createIndex2, regionType, CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_NAMES));
}
Also used : SerializableRunnableIF(org.apache.geode.test.dunit.SerializableRunnableIF) Parameters(junitparams.Parameters) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 13 with Parameters

use of junitparams.Parameters in project geode by apache.

the class LuceneIndexCreationIntegrationTest method shouldUseRedundancyForInternalRegionsWhenUserRegionHasRedundancy.

@Test
@Parameters({ "0", "1", "2" })
public void shouldUseRedundancyForInternalRegionsWhenUserRegionHasRedundancy(int redundancy) {
    createIndex("text");
    PartitionAttributesFactory paf = new PartitionAttributesFactory();
    paf.setRedundantCopies(redundancy);
    cache.createRegionFactory(RegionShortcut.PARTITION_REDUNDANT).setPartitionAttributes(paf.create()).create(REGION_NAME);
    verifyInternalRegions(region -> {
        assertEquals(redundancy, region.getAttributes().getPartitionAttributes().getRedundantCopies());
    });
}
Also used : PartitionAttributesFactory(org.apache.geode.cache.PartitionAttributesFactory) Parameters(junitparams.Parameters) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 14 with Parameters

use of junitparams.Parameters in project geode by apache.

the class LuceneIndexDestroyDUnitTest method verifyDestroyAllIndexesWhileDoingPuts.

@Test
@Parameters(method = "getListOfRegionTestTypes")
public void verifyDestroyAllIndexesWhileDoingPuts(RegionTestableType regionType) throws Exception {
    // Add ignored exceptions to ignore RegionDestroyExceptions
    IgnoredException.addIgnoredException(RegionDestroyedException.class.getSimpleName());
    // Create indexes and region
    dataStore1.invoke(() -> initDataStore(createIndexes(), regionType));
    dataStore2.invoke(() -> initDataStore(createIndexes(), regionType));
    // Verify indexes created
    dataStore1.invoke(() -> verifyIndexesCreated());
    dataStore2.invoke(() -> verifyIndexesCreated());
    // Start puts
    AsyncInvocation putter = dataStore1.invokeAsync(() -> doPutsUntilStopped());
    // Wait until puts have started
    dataStore1.invoke(() -> waitUntilPutsHaveStarted());
    // Destroy indexes (only needs to be done on one member)
    dataStore1.invoke(() -> destroyIndexes());
    // Verify indexes destroyed
    dataStore1.invoke(() -> verifyIndexesDestroyed());
    dataStore2.invoke(() -> verifyIndexesDestroyed());
    // End puts
    dataStore1.invoke(() -> stopPuts());
    // Wait for the putter to complete and verify no unexpected exception has occurred
    ThreadUtils.join(putter, 60 * 1000);
    if (putter.exceptionOccurred()) {
        fail(putter.getException());
    }
    // Verify region size
    dataStore1.invoke(() -> verifyRegionSize());
}
Also used : RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) AsyncInvocation(org.apache.geode.test.dunit.AsyncInvocation) Parameters(junitparams.Parameters) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 15 with Parameters

use of junitparams.Parameters in project geode by apache.

the class LuceneQueriesDUnitTest method canQueryWithCustomLuceneQueryObject.

@Test
@Parameters(method = "getListOfRegionTestTypes")
public void canQueryWithCustomLuceneQueryObject(RegionTestableType regionTestType) {
    SerializableRunnableIF createIndex = () -> {
        LuceneService luceneService = LuceneServiceProvider.get(getCache());
        luceneService.createIndexFactory().addField("text").create(INDEX_NAME, REGION_NAME);
    };
    dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
    dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
    accessor.invoke(() -> initAccessor(createIndex, regionTestType));
    putDataInRegion(accessor);
    assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 60000));
    assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
    // Execute a query with a custom lucene query object
    accessor.invoke(() -> {
        Cache cache = getCache();
        LuceneService service = LuceneServiceProvider.get(cache);
        LuceneQuery query = service.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME, index -> {
            return new TermQuery(new Term("text", "world"));
        });
        final PageableLuceneQueryResults results = query.findPages();
        assertEquals(3, results.size());
    });
}
Also used : TermQuery(org.apache.lucene.search.TermQuery) Term(org.apache.lucene.index.Term) SerializableRunnableIF(org.apache.geode.test.dunit.SerializableRunnableIF) Cache(org.apache.geode.cache.Cache) Parameters(junitparams.Parameters) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Aggregations

Parameters (junitparams.Parameters)311 Test (org.junit.Test)311 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)55 DescriptorSet (com.spotify.protoman.descriptor.DescriptorSet)43 ValidationViolation (com.spotify.protoman.validation.ValidationViolation)43 SerializableRunnableIF (org.apache.geode.test.dunit.SerializableRunnableIF)41 QueryDataSource (org.apache.druid.query.QueryDataSource)30 TableDataSource (org.apache.druid.query.TableDataSource)30 GlobalTableDataSource (org.apache.druid.query.GlobalTableDataSource)26 DefaultDimensionSpec (org.apache.druid.query.dimension.DefaultDimensionSpec)26 CountAggregatorFactory (org.apache.druid.query.aggregation.CountAggregatorFactory)24 Method (java.lang.reflect.Method)19 LookupDataSource (org.apache.druid.query.LookupDataSource)19 IByteArrayKeyValueDatabase (org.aion.base.db.IByteArrayKeyValueDatabase)18 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)17 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)13 MapTableField (com.hazelcast.sql.impl.schema.map.MapTableField)12 Owner (org.candlepin.model.Owner)12 Product (org.candlepin.model.Product)12 CommandResult (org.apache.geode.management.internal.cli.result.CommandResult)11