List of usage examples for org.springframework.data.gemfire.function.execution GemfireOnRegionFunctionTemplate GemfireOnRegionFunctionTemplate
public GemfireOnRegionFunctionTemplate(Region<?, ?> region)
From source file:org.spring.data.gemfire.cache.PeerCacheFunctionServiceIntegrationTest.java
@Test public void factorialFunctionComputation() { for (int index = 0; index < 10; index++) { assertEquals(0, factorials.get(index).intValue()); }// w w w .ja va2 s .c o m GemfireOnRegionFunctionTemplate functionTemplate = new GemfireOnRegionFunctionTemplate(factorials); functionTemplate.execute(FactorialFunction.ID); assertEquals(1, factorials.get(0).intValue()); assertEquals(1, factorials.get(1).intValue()); assertEquals(2, factorials.get(2).intValue()); assertEquals(6, factorials.get(3).intValue()); assertEquals(24, factorials.get(4).intValue()); assertEquals(120, factorials.get(5).intValue()); assertEquals(720, factorials.get(6).intValue()); assertEquals(5040, factorials.get(7).intValue()); assertEquals(40320, factorials.get(8).intValue()); assertEquals(362880, factorials.get(9).intValue()); }
From source file:org.spring.data.gemfire.cache.ClientCacheFunctionExecutionWithStreamingTest.java
@Test public void testClientServerFunctionExecution() { GemfireOnRegionFunctionTemplate onNumbersFunctionTemplate = new GemfireOnRegionFunctionTemplate(numbers); assertThat(onNumbersFunctionTemplate.executeAndextract("addition", Collections.emptySet(), "one", "two"), is(equalTo(3)));//from w w w . j a v a 2s .c o m GemfireOnRegionFunctionTemplate onCollectionsFunctionTemplate = new GemfireOnRegionFunctionTemplate( collections); List<Object> integers = onCollectionsFunctionTemplate.executeAndextract("streaming", Collections.emptySet(), "one"); assertNotNull(integers); //assertEquals(10, integers.size()); //assertTrue(integers.containsAll(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))); assertEquals(2, integers.size()); assertTrue(integers.containsAll(Arrays.asList(0, 1))); assertThat(onNumbersFunctionTemplate.executeAndextract("addition", Collections.emptySet(), "four", "five"), is(equalTo(9))); List<Object> strings = onCollectionsFunctionTemplate.executeAndextract("streaming", Collections.emptySet(), "two"); assertNotNull(strings); //assertEquals(3, strings.size()); //assertTrue(strings.containsAll(Arrays.asList("assert", "mock", "test"))); assertEquals(2, strings.size()); assertTrue(strings.containsAll(Arrays.asList("assert", "mock"))); }
From source file:org.spring.data.gemfire.cache.ClientCacheFunctionExecutionTest.java
@Test public void testRegionSizeOnRegionUsingSpringGemfireOnRegionFunctionTemplate() { GemfireOnRegionFunctionTemplate template = new GemfireOnRegionFunctionTemplate(appDataProxy); assertThat(template.executeAndextract("regionSize", Collections.emptySet(), "AppData"), is(equalTo(EXPECTED_REGION_SIZE))); }
From source file:org.spring.data.gemfire.cache.PeerCacheFunctionCreationExecutionTest.java
@Test public void testRegionSizeOnRegionUsingSpringGemfireOnRegionFunctionTemplate() { GemfireOnRegionFunctionTemplate template = new GemfireOnRegionFunctionTemplate(appData); assertThat(template.executeAndextract("regionSize", Collections.emptySet(), appData.getName()), is(equalTo(EXPECTED_REGION_SIZE))); }