Search in sources :

Example 21 with Parameters

use of junitparams.Parameters in project geode by apache.

the class LuceneIndexDestroyDUnitTest method verifyDestroyRecreateIndexDifferentName.

@Test
@Parameters(method = "getListOfRegionTestTypes")
public void verifyDestroyRecreateIndexDifferentName(RegionTestableType regionType) {
    // Create index and region
    SerializableRunnableIF createIndex = createIndex();
    dataStore1.invoke(() -> initDataStore(createIndex, regionType));
    dataStore2.invoke(() -> initDataStore(createIndex, regionType));
    accessor.invoke(() -> initAccessor(createIndex, regionType));
    // Verify index created
    dataStore1.invoke(() -> verifyIndexCreated());
    dataStore2.invoke(() -> verifyIndexCreated());
    accessor.invoke(() -> verifyIndexCreated());
    // Do puts to cause IndexRepositories to be created
    int numPuts = 100;
    accessor.invoke(() -> doPuts(numPuts));
    // Wait until queue is flushed
    accessor.invoke(() -> waitUntilFlushed(INDEX_NAME));
    // Execute query and verify results
    accessor.invoke(() -> executeQuery(INDEX_NAME, "field1Value", "field1", numPuts));
    // Export entries from region
    accessor.invoke(() -> exportData(regionType));
    // Destroy indexes (only needs to be done on one member)
    dataStore1.invoke(() -> destroyIndexes());
    // Verify indexes destroyed
    dataStore1.invoke(() -> verifyIndexesDestroyed());
    dataStore2.invoke(() -> verifyIndexesDestroyed());
    // Destroy data region
    dataStore1.invoke(() -> destroyDataRegion(true));
    // Recreate index and region
    String newIndexName = INDEX_NAME + "+_1";
    SerializableRunnableIF createIndexNewName = createIndex(newIndexName, REGION_NAME, "field1");
    dataStore1.invoke(() -> initDataStore(createIndexNewName, regionType));
    dataStore2.invoke(() -> initDataStore(createIndexNewName, regionType));
    accessor.invoke(() -> initAccessor(createIndexNewName, regionType));
    // Import entries into region
    accessor.invoke(() -> importData(regionType, numPuts));
    // Wait until queue is flushed
    // This verifies there are no deadlocks
    dataStore1.invoke(() -> waitUntilFlushed(newIndexName));
    dataStore2.invoke(() -> waitUntilFlushed(newIndexName));
    // re-execute query and verify results
    accessor.invoke(() -> executeQuery(newIndexName, "field1Value", "field1", numPuts));
}
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 22 with Parameters

use of junitparams.Parameters in project geode by apache.

the class LuceneIndexDestroyDUnitTest method verifyDestroyRecreateIndexSameName.

@Test
@Parameters(method = "getListOfRegionTestTypes")
public void verifyDestroyRecreateIndexSameName(RegionTestableType regionType) {
    // Create index and region
    SerializableRunnableIF createIndex = createIndex();
    dataStore1.invoke(() -> initDataStore(createIndex, regionType));
    dataStore2.invoke(() -> initDataStore(createIndex, regionType));
    accessor.invoke(() -> initAccessor(createIndex, regionType));
    // Verify index created
    dataStore1.invoke(() -> verifyIndexCreated());
    dataStore2.invoke(() -> verifyIndexCreated());
    accessor.invoke(() -> verifyIndexCreated());
    // Do puts to cause IndexRepositories to be created
    int numPuts = 100;
    accessor.invoke(() -> doPuts(numPuts));
    // Wait until queue is flushed
    accessor.invoke(() -> waitUntilFlushed(INDEX_NAME));
    // Execute query and verify results
    accessor.invoke(() -> executeQuery(INDEX_NAME, "field1Value", "field1", numPuts));
    // Export entries from region
    accessor.invoke(() -> exportData(regionType));
    // Destroy indexes (only needs to be done on one member)
    dataStore1.invoke(() -> destroyIndexes());
    // Verify indexes destroyed
    dataStore1.invoke(() -> verifyIndexesDestroyed());
    dataStore2.invoke(() -> verifyIndexesDestroyed());
    // Destroy data region
    dataStore1.invoke(() -> destroyDataRegion(true));
    // Recreate index and region
    dataStore1.invoke(() -> initDataStore(createIndex, regionType));
    dataStore2.invoke(() -> initDataStore(createIndex, regionType));
    accessor.invoke(() -> initAccessor(createIndex, regionType));
    // Import entries into region
    accessor.invoke(() -> importData(regionType, numPuts));
    // Wait until queue is flushed
    // This verifies there are no deadlocks
    dataStore1.invoke(() -> waitUntilFlushed(INDEX_NAME));
    dataStore2.invoke(() -> waitUntilFlushed(INDEX_NAME));
    // re-execute query and verify results
    accessor.invoke(() -> executeQuery(INDEX_NAME, "field1Value", "field1", numPuts));
}
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 23 with Parameters

use of junitparams.Parameters in project geode by apache.

the class RebalanceWithRedundancyDUnitTest method returnCorrectResultsWhenIndexUpdateHappensIntheMiddleofGII.

@Test
@Parameters(method = "getListOfRegionTestTypes")
public void returnCorrectResultsWhenIndexUpdateHappensIntheMiddleofGII(RegionTestableType regionTestType) throws InterruptedException {
    SerializableRunnableIF createIndex = () -> {
        LuceneService luceneService = LuceneServiceProvider.get(getCache());
        luceneService.createIndexFactory().setFields("text").create(INDEX_NAME, REGION_NAME);
    };
    dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
    accessor.invoke(() -> initAccessor(createIndex, regionTestType));
    dataStore1.invoke(() -> LuceneTestUtilities.pauseSender(getCache()));
    putEntryInEachBucket();
    dataStore2.invoke(() -> {
        InitialImageOperation.setGIITestHook(new GIITestHook(GIITestHookType.AfterSentRequestImage, "Do puts during request") {

            @Override
            public void reset() {
            }

            @Override
            public String getRegionName() {
                return "_B__index#__region.files_0";
            }

            @Override
            public void run() {
                dataStore1.invoke(() -> LuceneTestUtilities.resumeSender(getCache()));
                waitForFlushBeforeExecuteTextSearch(dataStore1, 30000);
            }
        });
    });
    dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
    assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 30000));
    dataStore2.invoke(() -> {
        PartitionedRegion region = (PartitionedRegion) getCache().getRegion(REGION_NAME);
        Awaitility.await().atMost(1, TimeUnit.MINUTES).until(() -> assertEquals(0, region.getPrStats().getLowRedundancyBucketCount()));
    });
    dataStore1.invoke(() -> getCache().close());
    assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore2, 30000));
    executeTextSearch(accessor, "world", "text", NUM_BUCKETS);
}
Also used : GIITestHook(org.apache.geode.internal.cache.InitialImageOperation.GIITestHook) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) SerializableRunnableIF(org.apache.geode.test.dunit.SerializableRunnableIF) Parameters(junitparams.Parameters) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 24 with Parameters

use of junitparams.Parameters in project geode by apache.

the class PaginationDUnitTest method noExceptionWhenOneDataStoreIsClosedButOneIsStillUpWhilePagination.

@Test
@Parameters(method = "getListOfRegionTestTypes")
public void noExceptionWhenOneDataStoreIsClosedButOneIsStillUpWhilePagination(RegionTestableType regionTestType) {
    SerializableRunnableIF createIndex = () -> {
        LuceneService luceneService = LuceneServiceProvider.get(getCache());
        luceneService.createIndexFactory().setFields("text").create(INDEX_NAME, REGION_NAME);
    };
    dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
    dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
    accessor.invoke(() -> initAccessor(createIndex, regionTestType));
    putEntryInEachBucket();
    assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, FLUSH_WAIT_TIME_MS));
    accessor.invoke(() -> {
        List<LuceneResultStruct<Integer, TestObject>> combinedResult = new ArrayList<>();
        Cache cache = getCache();
        LuceneService service = LuceneServiceProvider.get(cache);
        LuceneQuery<Integer, TestObject> query;
        query = service.createLuceneQueryFactory().setLimit(1000).setPageSize(PAGE_SIZE).create(INDEX_NAME, REGION_NAME, "world", "text");
        PageableLuceneQueryResults<Integer, TestObject> pages = query.findPages();
        assertTrue(pages.hasNext());
        List<LuceneResultStruct<Integer, TestObject>> page = pages.next();
        combinedResult.addAll(page);
        assertEquals(PAGE_SIZE, page.size());
        dataStore1.invoke(() -> closeCache());
        for (int i = 0; i < ((NUM_BUCKETS / PAGE_SIZE) - 1); i++) {
            page = pages.next();
            assertEquals(PAGE_SIZE, page.size());
            combinedResult.addAll(page);
        }
        validateTheCombinedResult(combinedResult);
    });
}
Also used : ArrayList(java.util.ArrayList) 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)

Example 25 with Parameters

use of junitparams.Parameters in project geode by apache.

the class RebalanceDUnitTest method returnCorrectResultsWhenRebalanceHappensWhileSenderIsPaused.

@Test
@Parameters(method = "getListOfRegionTestTypes")
public void returnCorrectResultsWhenRebalanceHappensWhileSenderIsPaused(RegionTestableType regionTestType) throws InterruptedException {
    SerializableRunnableIF createIndex = () -> {
        LuceneService luceneService = LuceneServiceProvider.get(getCache());
        luceneService.createIndexFactory().setFields("text").create(INDEX_NAME, REGION_NAME);
    };
    dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
    accessor.invoke(() -> initAccessor(createIndex, regionTestType));
    dataStore1.invoke(() -> LuceneTestUtilities.pauseSender(getCache()));
    putEntryInEachBucket();
    dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
    rebalanceRegion(dataStore2);
    dataStore1.invoke(() -> LuceneTestUtilities.resumeSender(getCache()));
    assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 60000));
    assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
    executeTextSearch(accessor, "world", "text", NUM_BUCKETS);
}
Also used : SerializableRunnableIF(org.apache.geode.test.dunit.SerializableRunnableIF) 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