Search in sources :

Example 56 with Parameters

use of junitparams.Parameters in project geode by apache.

the class EvictionDUnitTest method regionWithEvictionWithLocalDestroyMustNotbeAbleToCreateLuceneIndexes.

@Test
@Parameters(method = "getPartitionRedundantLocalDestroyEvictionRegionType")
public void regionWithEvictionWithLocalDestroyMustNotbeAbleToCreateLuceneIndexes(RegionTestableType regionTestType) {
    SerializableRunnableIF createIndex = getSerializableRunnableIFCreateIndex();
    dataStore1.invoke(() -> {
        try {
            initDataStore(createIndex, regionTestType);
        } catch (UnsupportedOperationException e) {
            assertEquals("Lucene indexes on regions with eviction and action local destroy are not supported", e.getMessage());
            assertNull(getCache().getRegion(REGION_NAME));
        }
    });
}
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 57 with Parameters

use of junitparams.Parameters in project geode by apache.

the class ExpirationDUnitTest method regionWithExpirationSetMustAlsoRemoveLuceneIndexEntries.

@Test
@Parameters(method = "getPartitionRegionsWithExpirationSet")
public void regionWithExpirationSetMustAlsoRemoveLuceneIndexEntries(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(() -> initDataStore(createIndex, regionTestType));
    accessor.invoke(() -> {
        Cache cache = getCache();
        Region region = cache.getRegion(REGION_NAME);
        IntStream.range(0, NUM_BUCKETS).forEach(i -> region.put(i, new TestObject("hello world")));
    });
    assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 60000));
    accessor.invoke(() -> Awaitility.await().atMost(EXPIRATION_TIMEOUT_SEC + EXTRA_WAIT_TIME_SEC, TimeUnit.SECONDS).until(() -> {
        LuceneService luceneService = LuceneServiceProvider.get(getCache());
        LuceneQuery<Integer, TestObject> luceneQuery = luceneService.createLuceneQueryFactory().setLimit(100).create(INDEX_NAME, REGION_NAME, "world", "text");
        Collection luceneResultList = null;
        try {
            luceneResultList = luceneQuery.findKeys();
        } catch (LuceneQueryException e) {
            e.printStackTrace();
            fail();
        }
        assertEquals(0, luceneResultList.size());
    }));
}
Also used : Region(org.apache.geode.cache.Region) Collection(java.util.Collection) 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 58 with Parameters

use of junitparams.Parameters in project geode by apache.

the class LuceneIndexCreationDUnitTest method verifyDifferentFieldAnalyzerSizesFails2.

@Test
@Parameters({ "PARTITION" })
public void verifyDifferentFieldAnalyzerSizesFails2(RegionTestableType regionType) {
    SerializableRunnableIF createIndex1 = getAnalyzersIndexWithOneField();
    dataStore1.invoke(() -> initDataStore(createIndex1, regionType));
    SerializableRunnableIF createIndex2 = getAnalyzersIndexWithTwoFields();
    dataStore2.invoke(() -> initDataStore(createIndex2, regionType, CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_FIELDS));
}
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 59 with Parameters

use of junitparams.Parameters in project geode by apache.

the class LuceneIndexCreationDUnitTest method verifyThatIndexObjectsAreListedWhenPresentInTheSystem.

@Test
@Parameters(method = "parametersForMultipleIndexCreates")
public void verifyThatIndexObjectsAreListedWhenPresentInTheSystem(int numberOfIndexes, RegionTestableType regionType) {
    SerializableRunnableIF createIndex = getMultipleIndexes(numberOfIndexes);
    dataStore1.invoke(() -> initDataStore(createIndex, regionType));
    dataStore1.invoke(() -> verifyIndexList(numberOfIndexes));
    dataStore2.invoke(() -> initDataStore(createIndex, regionType));
    dataStore2.invoke(() -> verifyIndexList(numberOfIndexes));
}
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 60 with Parameters

use of junitparams.Parameters in project geode by apache.

the class LuceneIndexCreationDUnitTest method verifyDifferentIndexesFails1.

@Test
@Parameters({ "PARTITION" })
public void verifyDifferentIndexesFails1(RegionTestableType regionType) {
    SerializableRunnableIF createIndex1 = getFieldsIndexWithOneField();
    dataStore1.invoke(() -> initDataStore(createIndex1, regionType));
    SerializableRunnableIF createIndex2 = () -> {
    /* Do nothing */
    };
    dataStore2.invoke(() -> initDataStore(createIndex2, regionType, CANNOT_CREATE_LUCENE_INDEX_DIFFERENT_INDEXES_1));
}
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)121 Test (org.junit.Test)121 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 CommandResult (org.apache.geode.management.internal.cli.result.CommandResult)11 Region (org.apache.geode.cache.Region)10 Cache (org.apache.geode.cache.Cache)9 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)9 DistributedMember (org.apache.geode.distributed.DistributedMember)8 UnitTest (org.apache.geode.test.junit.categories.UnitTest)7 ArrayList (java.util.ArrayList)6 SecurityTest (org.apache.geode.test.junit.categories.SecurityTest)5 List (java.util.List)4 ResultCollector (org.apache.geode.cache.execute.ResultCollector)4 LuceneDestroyIndexFunction (org.apache.geode.cache.lucene.internal.cli.functions.LuceneDestroyIndexFunction)4 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)4 CliFunctionResult (org.apache.geode.management.internal.cli.functions.CliFunctionResult)4 AsyncInvocation (org.apache.geode.test.dunit.AsyncInvocation)4