Search in sources :

Example 6 with HazelcastInstanceProxy

use of com.hazelcast.instance.impl.HazelcastInstanceProxy in project hazelcast by hazelcast.

the class IndexCreateTest method checkIndex.

private void checkIndex(IndexConfig... indexConfigs) {
    List<HazelcastInstanceProxy> members = handler.initialize(hazelcastFactory, indexConfigs);
    for (HazelcastInstanceProxy member : members) {
        MapService service = member.getOriginal().node.nodeEngine.getService(MapService.SERVICE_NAME);
        MapServiceContext mapServiceContext = service.getMapServiceContext();
        MapContainer mapContainer = mapServiceContext.getMapContainer(MAP_NAME);
        Indexes indexes = mapContainer.getIndexes();
        assertEquals(indexConfigs.length, indexes.getIndexes().length);
        for (IndexConfig indexConfig : indexConfigs) {
            String expectedName = getExpectedName(indexConfig);
            InternalIndex index = indexes.getIndex(expectedName);
            assertNotNull("Index not found: " + expectedName, index);
            assertEquals(type == IndexType.SORTED, index.isOrdered());
            assertEquals(type, index.getConfig().getType());
            assertEquals(indexConfig.getAttributes().size(), index.getComponents().length);
            for (int i = 0; i < indexConfig.getAttributes().size(); i++) {
                String expAttributeName = indexConfig.getAttributes().get(i);
                String componentName = index.getComponents()[i];
                assertEquals(IndexUtils.canonicalizeAttribute(expAttributeName), componentName);
            }
        }
    }
}
Also used : InternalIndex(com.hazelcast.query.impl.InternalIndex) IndexConfig(com.hazelcast.config.IndexConfig) MapService(com.hazelcast.map.impl.MapService) Indexes(com.hazelcast.query.impl.Indexes) HazelcastInstanceProxy(com.hazelcast.instance.impl.HazelcastInstanceProxy) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) MapContainer(com.hazelcast.map.impl.MapContainer)

Aggregations

HazelcastInstanceProxy (com.hazelcast.instance.impl.HazelcastInstanceProxy)6 HazelcastInstanceImpl (com.hazelcast.instance.impl.HazelcastInstanceImpl)2 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)2 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)2 QuickTest (com.hazelcast.test.annotation.QuickTest)2 Test (org.junit.Test)2 CacheTestSupport.createServerCachingProvider (com.hazelcast.cache.CacheTestSupport.createServerCachingProvider)1 CachePartitionEventData (com.hazelcast.cache.impl.CachePartitionEventData)1 CachePartitionSegment (com.hazelcast.cache.impl.CachePartitionSegment)1 CacheService (com.hazelcast.cache.impl.CacheService)1 CacheReplicationOperation (com.hazelcast.cache.impl.operation.CacheReplicationOperation)1 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)1 IndexConfig (com.hazelcast.config.IndexConfig)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 Data (com.hazelcast.internal.serialization.Data)1 ServiceNamespace (com.hazelcast.internal.services.ServiceNamespace)1 MapContainer (com.hazelcast.map.impl.MapContainer)1 MapService (com.hazelcast.map.impl.MapService)1 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)1 Indexes (com.hazelcast.query.impl.Indexes)1