use of org.apache.ignite.configuration.CollectionConfiguration in project ignite by apache.
the class GridCacheQueueApiSelfAbstractTest method testReuseCache.
/**
* @throws Exception If failed.
*/
public void testReuseCache() throws Exception {
CollectionConfiguration colCfg = collectionConfiguration();
IgniteQueue queue1 = grid(0).queue("Queue1", 0, colCfg);
IgniteQueue queue2 = grid(0).queue("Queue2", 0, colCfg);
assertEquals(getQueueCache(queue1), getQueueCache(queue2));
}
use of org.apache.ignite.configuration.CollectionConfiguration in project ignite by apache.
the class GridCacheQueueCleanupSelfTest method collectionConfiguration.
/** {@inheritDoc} */
@Override
protected CollectionConfiguration collectionConfiguration() {
CollectionConfiguration colCfg = super.collectionConfiguration();
colCfg.setBackups(0);
return colCfg;
}
use of org.apache.ignite.configuration.CollectionConfiguration in project ignite by apache.
the class GridCacheQueueMultiNodeConsistencySelfTest method collectionConfiguration.
/** {@inheritDoc} */
@Override
protected CollectionConfiguration collectionConfiguration() {
CollectionConfiguration colCfg = super.collectionConfiguration();
colCfg.setBackups(backups);
return colCfg;
}
use of org.apache.ignite.configuration.CollectionConfiguration in project ignite by apache.
the class IgniteDataStructureWithJobTest method testJobWithRestart.
/**
* @throws Exception If failed.
*/
public void testJobWithRestart() throws Exception {
Ignite ignite = startGrid(0);
final AtomicBoolean stop = new AtomicBoolean();
final long endTime = System.currentTimeMillis() + 60_000;
IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Object>() {
@Override
public Object call() throws Exception {
while (!Thread.currentThread().isInterrupted() && !stop.get() && U.currentTimeMillis() < endTime) {
try (Ignite ignored = startGrid(1)) {
Thread.sleep(500);
}
}
return null;
}
});
try {
int iter = 0;
while (System.currentTimeMillis() < endTime) {
try {
ignite.compute().broadcast(new IgniteClosure<IgniteSet, Integer>() {
@Override
public Integer apply(IgniteSet set) {
assertNotNull(set);
return 1;
}
}, ignite.set("set", new CollectionConfiguration()));
} catch (IgniteException ignore) {
// No-op.
}
if (iter++ % 1000 == 0)
log.info("Iteration: " + iter);
}
} finally {
stop.set(true);
}
fut.get();
}
use of org.apache.ignite.configuration.CollectionConfiguration in project ignite by apache.
the class IgniteClientDataStructuresAbstractTest method testSet.
/**
* @param creator Creator node.
* @param other Other node.
* @throws Exception If failed.
*/
private void testSet(Ignite creator, Ignite other) throws Exception {
assertNull(creator.set("set1", null));
assertNull(other.set("set1", null));
CollectionConfiguration colCfg = new CollectionConfiguration();
try (IgniteSet<Integer> set = creator.set("set1", colCfg)) {
assertNotNull(set);
assertEquals(0, set.size());
assertFalse(set.contains(1));
assertTrue(set.add(1));
assertTrue(set.contains(1));
IgniteSet<Integer> set0 = other.set("set1", null);
assertTrue(set0.contains(1));
assertEquals(1, set0.size());
assertTrue(set0.remove(1));
assertFalse(set.contains(1));
}
assertNull(creator.set("set1", null));
assertNull(other.set("set1", null));
}
Aggregations