Search in sources :

Example 1 with SearchMapping

use of org.infinispan.search.mapper.mapping.SearchMapping in project infinispan by infinispan.

the class RemoteQueryDslConditionsTunedTest method testIndexPresence.

@Override
public void testIndexPresence() {
    SearchMapping searchMapping = TestingUtil.extractComponent(cache, SearchMapping.class);
    // we have indexing for remote query!
    assertNotNull(searchMapping.indexedEntity("sample_bank_account.User"));
    assertNotNull(searchMapping.indexedEntity("sample_bank_account.Account"));
    assertNotNull(searchMapping.indexedEntity("sample_bank_account.Transaction"));
    // we have some indexes for this cache
    assertEquals(3, searchMapping.allIndexedEntities().size());
}
Also used : SearchMapping(org.infinispan.search.mapper.mapping.SearchMapping)

Example 2 with SearchMapping

use of org.infinispan.search.mapper.mapping.SearchMapping in project infinispan by infinispan.

the class RemoteQueryDisableIndexingTest method testEmptyIndexIsPresent.

public void testEmptyIndexIsPresent() {
    SearchMapping searchMapping = TestingUtil.extractComponent(cache, SearchMapping.class);
    // we have indexing for remote query!
    assertNotNull(searchMapping.indexedEntity("sample_bank_account.User"));
    assertNotNull(searchMapping.indexedEntity("sample_bank_account.Account"));
    assertNotNull(searchMapping.indexedEntity("sample_bank_account.Transaction"));
    // we have some indexes for this cache
    assertEquals(3, searchMapping.allIndexedEntities().size());
}
Also used : SearchMapping(org.infinispan.search.mapper.mapping.SearchMapping)

Example 3 with SearchMapping

use of org.infinispan.search.mapper.mapping.SearchMapping in project infinispan by infinispan.

the class DefaultCacheInheritancePreventedTest method assertIndexingEnabled.

/**
 * Verifies that the SearchIntegrator is or is not registered as expected
 * @param expected true if you expect indexing to be enabled
 * @param cache the cache to extract indexing from
 */
private void assertIndexingEnabled(Cache<Object, Object> cache, boolean expected) {
    SearchMapping searchMapping = null;
    try {
        searchMapping = ComponentRegistryUtils.getSearchMapping(cache);
    } catch (IllegalStateException e) {
    // ignored here, we deal with it later
    }
    if (expected && searchMapping == null) {
        Assert.fail("SearchIntegrator not found but expected for cache " + cache.getName());
    }
    if (!expected && searchMapping != null) {
        Assert.fail("SearchIntegrator not expected but found for cache " + cache.getName());
    }
    // verify as well that the indexing interceptor is (not) there:
    QueryInterceptor queryInterceptor = null;
    try {
        queryInterceptor = ComponentRegistryUtils.getQueryInterceptor(cache);
    } catch (IllegalStateException e) {
    // ignored here, we deal with it later
    }
    if (expected && queryInterceptor == null) {
        Assert.fail("QueryInterceptor not found but expected for cache " + cache.getName());
    }
    if (!expected && queryInterceptor != null) {
        Assert.fail("QueryInterceptor not expected but found for cache " + cache.getName());
    }
}
Also used : SearchMapping(org.infinispan.search.mapper.mapping.SearchMapping) QueryInterceptor(org.infinispan.query.backend.QueryInterceptor)

Example 4 with SearchMapping

use of org.infinispan.search.mapper.mapping.SearchMapping in project infinispan by infinispan.

the class TestQueryHelperFactory method extractSearchMapping.

public static SearchMapping extractSearchMapping(Cache<?, ?> cache) {
    ComponentRegistry componentRegistry = cache.getAdvancedCache().getComponentRegistry();
    SearchMapping searchMapping = componentRegistry.getComponent(SearchMapping.class);
    assertNotNull(searchMapping);
    return searchMapping;
}
Also used : ComponentRegistry(org.infinispan.factories.ComponentRegistry) SearchMapping(org.infinispan.search.mapper.mapping.SearchMapping)

Example 5 with SearchMapping

use of org.infinispan.search.mapper.mapping.SearchMapping in project infinispan by infinispan.

the class EntryActivatingTest method recreateCacheManager.

private void recreateCacheManager() {
    ConfigurationBuilder cfg = new ConfigurationBuilder();
    cfg.persistence().passivation(true).addStore(DummyInMemoryStoreConfigurationBuilder.class).preload(true).indexing().enable().storage(LOCAL_HEAP).addIndexedEntity(Country.class);
    cm = TestCacheManagerFactory.createCacheManager(QueryTestSCI.INSTANCE, cfg);
    cache = cm.getCache();
    store = TestingUtil.getFirstStore(cache);
    queryFactory = Search.getQueryFactory(cache);
    searchMapping = TestingUtil.extractComponent(cache, SearchMapping.class);
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) DummyInMemoryStoreConfigurationBuilder(org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder) SearchMapping(org.infinispan.search.mapper.mapping.SearchMapping) DummyInMemoryStoreConfigurationBuilder(org.infinispan.persistence.dummy.DummyInMemoryStoreConfigurationBuilder)

Aggregations

SearchMapping (org.infinispan.search.mapper.mapping.SearchMapping)20 AdvancedCache (org.infinispan.AdvancedCache)4 Cache (org.infinispan.Cache)3 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)3 BasicComponentRegistry (org.infinispan.factories.impl.BasicComponentRegistry)3 QueryInterceptor (org.infinispan.query.backend.QueryInterceptor)3 HashSet (java.util.HashSet)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 MediaType (org.infinispan.commons.dataconversion.MediaType)2 IndexingConfiguration (org.infinispan.configuration.cache.IndexingConfiguration)2 GlobalConfiguration (org.infinispan.configuration.global.GlobalConfiguration)2 DataConversion (org.infinispan.encoding.DataConversion)2 ComponentRegistry (org.infinispan.factories.ComponentRegistry)2 ReflectionEntityNamesResolver (org.infinispan.objectfilter.impl.syntax.parser.ReflectionEntityNamesResolver)2 SerializationContext (org.infinispan.protostream.SerializationContext)2 Indexer (org.infinispan.query.Indexer)2 KeyTransformationHandler (org.infinispan.query.backend.KeyTransformationHandler)2 QueryCache (org.infinispan.query.core.impl.QueryCache)2 IndexStatistics (org.infinispan.query.core.stats.IndexStatistics)2