use of org.apache.ignite.configuration.CollectionConfiguration in project ignite by apache.
the class GridCacheQueueApiSelfAbstractTest method testPrepareQueue.
/**
* JUnit.
*
* @throws Exception If failed.
*/
public void testPrepareQueue() throws Exception {
// Random sequence names.
String queueName1 = UUID.randomUUID().toString();
String queueName2 = UUID.randomUUID().toString();
CollectionConfiguration colCfg = config(false);
IgniteQueue queue1 = grid(0).queue(queueName1, 0, colCfg);
IgniteQueue queue2 = grid(0).queue(queueName2, 0, colCfg);
IgniteQueue queue3 = grid(0).queue(queueName1, 0, colCfg);
assertNotNull(queue1);
assertNotNull(queue2);
assertNotNull(queue3);
assert queue1.equals(queue3);
assert queue3.equals(queue1);
assert !queue3.equals(queue2);
queue1.close();
queue2.close();
queue3.close();
assertNull(grid(0).queue(queueName1, 0, null));
assertNull(grid(0).queue(queueName2, 0, null));
}
use of org.apache.ignite.configuration.CollectionConfiguration in project ignite by apache.
the class GridCacheQueueMultiNodeAbstractSelfTest method testAddMultinode.
/**
* @param collocated Collocation flag.
* @throws Exception If failed.
*/
private void testAddMultinode(final boolean collocated) throws Exception {
final String queueName = UUID.randomUUID().toString();
info("Queue name: " + queueName + ", collocated: " + collocated);
try {
Collection<IgniteInternalFuture> futs = new ArrayList<>();
final int THREADS_PER_NODE = 3;
final int ITEMS_PER_THREAD = 1000;
for (int i = 0; i < GRID_CNT; i++) {
final int idx = i;
futs.add(GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
@Override
public Void call() throws Exception {
CollectionConfiguration colCfg = config(collocated);
IgniteQueue<Integer> queue = grid(idx).queue(queueName, 0, colCfg);
for (int i = 0; i < ITEMS_PER_THREAD; i++) assertTrue(queue.add(i));
return null;
}
}, THREADS_PER_NODE, "testPutMultiNode"));
}
for (IgniteInternalFuture fut : futs) fut.get();
IgniteQueue<Integer> queue = grid(0).queue(queueName, 0, null);
assertEquals(THREADS_PER_NODE * ITEMS_PER_THREAD * GRID_CNT, queue.size());
int[] items = new int[ITEMS_PER_THREAD];
Integer item;
while ((item = queue.poll()) != null) items[item]++;
for (int i = 0; i < ITEMS_PER_THREAD; i++) assertEquals(THREADS_PER_NODE * GRID_CNT, items[i]);
} finally {
grid(0).queue(queueName, 0, null).close();
}
}
use of org.apache.ignite.configuration.CollectionConfiguration in project ignite by apache.
the class IgniteClientReconnectCollectionsTest method testQueueReconnectRemoved.
/**
* @throws Exception If failed.
*/
public void testQueueReconnectRemoved() throws Exception {
CollectionConfiguration colCfg = new CollectionConfiguration();
colCfg.setCacheMode(PARTITIONED);
colCfg.setAtomicityMode(TRANSACTIONAL);
queueReconnectRemoved(colCfg);
colCfg = new CollectionConfiguration();
colCfg.setCacheMode(PARTITIONED);
colCfg.setAtomicityMode(ATOMIC);
queueReconnectRemoved(colCfg);
}
use of org.apache.ignite.configuration.CollectionConfiguration in project ignite by apache.
the class IgniteClientReconnectCollectionsTest method testSetReconnect.
/**
* @throws Exception If failed.
*/
public void testSetReconnect() throws Exception {
CollectionConfiguration colCfg = new CollectionConfiguration();
colCfg.setCacheMode(PARTITIONED);
colCfg.setAtomicityMode(TRANSACTIONAL);
setReconnect(colCfg);
colCfg = new CollectionConfiguration();
colCfg.setCacheMode(PARTITIONED);
colCfg.setAtomicityMode(ATOMIC);
setReconnect(colCfg);
}
use of org.apache.ignite.configuration.CollectionConfiguration in project ignite by apache.
the class IgniteClientReconnectCollectionsTest method testSetReconnectInProgress.
/**
* @throws Exception If failed.
*/
public void testSetReconnectInProgress() throws Exception {
CollectionConfiguration colCfg = new CollectionConfiguration();
colCfg.setCacheMode(PARTITIONED);
colCfg.setAtomicityMode(ATOMIC);
setReconnectInProgress(colCfg);
colCfg = new CollectionConfiguration();
colCfg.setCacheMode(PARTITIONED);
colCfg.setAtomicityMode(TRANSACTIONAL);
setReconnectInProgress(colCfg);
}
Aggregations