use of com.hazelcast.map.impl.operation.MapFetchIndexOperation.MapFetchIndexOperationResult in project hazelcast by hazelcast.
the class MapFetchIndexOperationTest method testOneSideRange.
@Test
public void testOneSideRange() throws ExecutionException, InterruptedException {
PartitionIdSet partitions = getLocalPartitions(instance);
IndexIterationPointer[] pointers = new IndexIterationPointer[1];
pointers[0] = IndexIterationPointer.create(null, true, 60, false, true, null);
MapOperationProvider operationProvider = getOperationProvider(map);
MapOperation operation = operationProvider.createFetchIndexOperation(mapName, orderedIndexName, pointers, partitions, 10);
Address address = instance.getCluster().getLocalMember().getAddress();
OperationServiceImpl operationService = getOperationService(instance);
MapFetchIndexOperationResult result = operationService.createInvocationBuilder(MapService.SERVICE_NAME, operation, address).<MapFetchIndexOperationResult>invoke().get();
assertResultSorted(result, Arrays.asList(new Person("person11", 45, "Dep5"), new Person("person10", 45, "Dep4"), new Person("person9", 45, "Dep3"), new Person("person4", 45, "Dep2"), new Person("person1", 45, "Dep1"), new Person("person5", 43, "Dep2"), new Person("person2", 39, "Dep1")));
}
use of com.hazelcast.map.impl.operation.MapFetchIndexOperation.MapFetchIndexOperationResult in project hazelcast by hazelcast.
the class MapFetchIndexOperationTest method whenSizeLimitIsSmall_thenFetchInMultipleCalls.
@Test
public void whenSizeLimitIsSmall_thenFetchInMultipleCalls() throws ExecutionException, InterruptedException {
PartitionIdSet partitions = getLocalPartitions(instance);
IndexIterationPointer[] pointers = new IndexIterationPointer[2];
pointers[0] = IndexIterationPointer.create(30, true, 50, false, false, null);
pointers[1] = IndexIterationPointer.create(50, true, 60, true, false, null);
MapOperationProvider operationProvider = getOperationProvider(map);
MapOperation operation = operationProvider.createFetchIndexOperation(mapName, orderedIndexName, pointers, partitions, 5);
Address address = instance.getCluster().getLocalMember().getAddress();
OperationServiceImpl operationService = getOperationService(instance);
MapFetchIndexOperationResult result = operationService.createInvocationBuilder(MapService.SERVICE_NAME, operation, address).<MapFetchIndexOperationResult>invoke().get();
assertResultSorted(result, Arrays.asList(new Person("person2", 39, "Dep1"), new Person("person5", 43, "Dep2"), new Person("person1", 45, "Dep1"), new Person("person4", 45, "Dep2"), new Person("person9", 45, "Dep3")));
// First pointer is not done yet
assertEquals(2, result.getPointers().length);
operation = operationProvider.createFetchIndexOperation(mapName, orderedIndexName, result.getPointers(), partitions, 5);
result = operationService.createInvocationBuilder(MapService.SERVICE_NAME, operation, address).<MapFetchIndexOperationResult>invoke().get();
assertResultSorted(result, Arrays.asList(new Person("person10", 45, "Dep4"), new Person("person11", 45, "Dep5"), new Person("person3", 60, "Dep1")));
assertEquals(0, result.getPointers().length);
}
use of com.hazelcast.map.impl.operation.MapFetchIndexOperation.MapFetchIndexOperationResult in project hazelcast by hazelcast.
the class MapFetchIndexOperationTest method testRange.
@Test
public void testRange() throws ExecutionException, InterruptedException {
PartitionIdSet partitions = getLocalPartitions(instance);
IndexIterationPointer[] pointers = new IndexIterationPointer[1];
pointers[0] = IndexIterationPointer.create(30, true, 60, false, false, null);
MapOperationProvider operationProvider = getOperationProvider(map);
MapOperation operation = operationProvider.createFetchIndexOperation(mapName, orderedIndexName, pointers, partitions, 7);
Address address = instance.getCluster().getLocalMember().getAddress();
OperationServiceImpl operationService = getOperationService(instance);
MapFetchIndexOperationResult result = operationService.createInvocationBuilder(MapService.SERVICE_NAME, operation, address).<MapFetchIndexOperationResult>invoke().get();
assertResultSorted(result, Arrays.asList(new Person("person2", 39, "Dep1"), new Person("person5", 43, "Dep2"), new Person("person1", 45, "Dep1"), new Person("person4", 45, "Dep2"), new Person("person9", 45, "Dep3"), new Person("person10", 45, "Dep4"), new Person("person11", 45, "Dep5")));
}
use of com.hazelcast.map.impl.operation.MapFetchIndexOperation.MapFetchIndexOperationResult in project hazelcast by hazelcast.
the class MapFetchIndexOperationTest method testMultipleLookups.
@Test
public void testMultipleLookups() throws ExecutionException, InterruptedException {
PartitionIdSet partitions = getLocalPartitions(instance);
IndexIterationPointer[] pointers = new IndexIterationPointer[3];
pointers[0] = IndexIterationPointer.create(30, true, 30, true, false, null);
pointers[1] = IndexIterationPointer.create(39, true, 39, true, false, null);
pointers[2] = IndexIterationPointer.create(45, true, 45, true, false, null);
MapOperationProvider operationProvider = getOperationProvider(map);
MapOperation operation = operationProvider.createFetchIndexOperation(mapName, hashIndexName, pointers, partitions, 10);
Address address = instance.getCluster().getLocalMember().getAddress();
OperationServiceImpl operationService = getOperationService(instance);
MapFetchIndexOperationResult result = operationService.createInvocationBuilder(MapService.SERVICE_NAME, operation, address).<MapFetchIndexOperationResult>invoke().get();
assertResult(result, Arrays.asList(new Person("person2", 39, "Dep1"), new Person("person1", 45, "Dep1"), new Person("person4", 45, "Dep2"), new Person("person9", 45, "Dep3"), new Person("person10", 45, "Dep4"), new Person("person11", 45, "Dep5")));
}
use of com.hazelcast.map.impl.operation.MapFetchIndexOperation.MapFetchIndexOperationResult in project hazelcast by hazelcast.
the class MapFetchIndexOperationTest method testMultipleRanges.
@Test
public void testMultipleRanges() throws ExecutionException, InterruptedException {
PartitionIdSet partitions = getLocalPartitions(instance);
IndexIterationPointer[] pointers = new IndexIterationPointer[2];
pointers[0] = IndexIterationPointer.create(30, true, 40, true, false, null);
pointers[1] = IndexIterationPointer.create(50, true, 60, true, false, null);
MapOperationProvider operationProvider = getOperationProvider(map);
MapOperation operation = operationProvider.createFetchIndexOperation(mapName, orderedIndexName, pointers, partitions, 5);
Address address = instance.getCluster().getLocalMember().getAddress();
OperationServiceImpl operationService = getOperationService(instance);
MapFetchIndexOperationResult result = operationService.createInvocationBuilder(MapService.SERVICE_NAME, operation, address).<MapFetchIndexOperationResult>invoke().get();
assertResultSorted(result, Arrays.asList(new Person("person2", 39, "Dep1"), new Person("person3", 60, "Dep1")));
}
Aggregations