use of org.apache.ignite.client.ClientCompute in project ignite by apache.
the class ComputeTaskTest method testTaskWithNoResultCache.
/**
*/
@Test
public void testTaskWithNoResultCache() throws Exception {
try (IgniteClient client = startClient(0)) {
ClientCompute computeWithCache = client.compute();
ClientCompute computeWithNoCache = client.compute().withNoResultCache();
assertTrue(computeWithCache.execute(TestResultCacheTask.class.getName(), null));
assertFalse(computeWithNoCache.execute(TestResultCacheTask.class.getName(), null));
}
}
use of org.apache.ignite.client.ClientCompute in project ignite by apache.
the class ComputeTaskTest method testComputeWithMixedModificators.
/**
*/
@Test
public void testComputeWithMixedModificators() throws Exception {
try (IgniteClient client = startClient(0)) {
ClientClusterGroup grp = client.cluster().forNodeId(nodeId(1), nodeId(2));
ClientCompute compute = client.compute(grp).withNoFailover().withNoResultCache().withTimeout(TIMEOUT / 5);
T2<UUID, List<UUID>> val = client.compute(grp).execute(TestTask.class.getName(), null);
assertEquals(nodeIds(1, 2), val.get2());
assertFalse(compute.execute(TestFailoverTask.class.getName(), null));
assertFalse(compute.execute(TestResultCacheTask.class.getName(), null));
GridTestUtils.assertThrowsAnyCause(null, () -> compute.execute(TestTask.class.getName(), TIMEOUT), ClientException.class, null);
}
}
use of org.apache.ignite.client.ClientCompute in project ignite by apache.
the class ComputeTaskTest method testExecuteTwoTasksMisorderedResults.
/**
*/
@Test
public void testExecuteTwoTasksMisorderedResults() throws Exception {
try (IgniteClient client = startClient(0)) {
ClientCompute compute1 = client.compute(client.cluster().forNodeId(nodeId(1)));
ClientCompute compute2 = client.compute(client.cluster().forNodeId(nodeId(2)));
CountDownLatch latch1 = TestLatchTask.latch = new CountDownLatch(2);
TestLatchTask.startLatch = new CountDownLatch(1);
Future<T2<UUID, Set<UUID>>> fut1 = compute1.executeAsync(TestLatchTask.class.getName(), null);
TestLatchTask.startLatch.await(TIMEOUT, TimeUnit.MILLISECONDS);
CountDownLatch latch2 = TestLatchTask.latch = new CountDownLatch(1);
TestLatchTask.startLatch = new CountDownLatch(1);
Future<T2<UUID, Set<UUID>>> fut2 = compute2.executeAsync(TestLatchTask.class.getName(), null);
TestLatchTask.startLatch.await(TIMEOUT, TimeUnit.MILLISECONDS);
latch2.countDown();
assertEquals(nodeIds(2), fut2.get().get2());
assertFalse(fut1.isDone());
latch1.countDown();
assertEquals(nodeIds(1), fut1.get().get2());
}
}
Aggregations