use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.
the class IgniteAtomicLongChangingTopologySelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi).setNetworkTimeout(30_000);
AtomicConfiguration atomicCfg = new AtomicConfiguration();
atomicCfg.setCacheMode(PARTITIONED);
atomicCfg.setBackups(1);
cfg.setAtomicConfiguration(atomicCfg);
((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
cfg.setClientMode(client);
cfg.setPeerClassLoadingEnabled(false);
return cfg;
}
use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.
the class IgniteCachePutRetryAbstractSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setIncludeEventTypes();
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
AtomicConfiguration acfg = new AtomicConfiguration();
acfg.setBackups(1);
cfg.setAtomicConfiguration(acfg);
cfg.setIncludeEventTypes(new int[0]);
return cfg;
}
use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.
the class GridCachePartitionedSequenceMultiNodeSelfTest method atomicConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected AtomicConfiguration atomicConfiguration() {
AtomicConfiguration atomicCfg = super.atomicConfiguration();
atomicCfg.setBackups(1);
atomicCfg.setAtomicSequenceReserveSize(BATCH_SIZE);
return atomicCfg;
}
use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.
the class GridCacheAtomicReferenceApiSelfAbstractTest method testMultipleStructuresInDifferentGroups.
/**
* Tests that basic API works correctly when there are multiple structures in multiple groups.
*
* @throws Exception If failed.
*/
public void testMultipleStructuresInDifferentGroups() throws Exception {
Ignite ignite = grid(0);
IgniteAtomicReference<String> ref1 = ignite.atomicReference("ref1", "a", true);
IgniteAtomicReference<String> ref2 = ignite.atomicReference("ref2", "b", true);
IgniteAtomicReference<String> ref3 = ignite.atomicReference("ref3", "c", true);
AtomicConfiguration cfg = new AtomicConfiguration().setGroupName("grp1");
IgniteAtomicReference<String> ref4 = ignite.atomicReference("ref4", cfg, "d", true);
IgniteAtomicReference<String> ref5 = ignite.atomicReference("ref5", cfg, "e", true);
IgniteAtomicReference<String> ref6 = ignite.atomicReference("ref6", cfg, "f", true);
assertNull(ignite.atomicReference("ref4", "a", false));
assertNull(ignite.atomicReference("ref5", "a", false));
assertNull(ignite.atomicReference("ref6", "a", false));
assertNull(ignite.atomicReference("ref1", cfg, "a", false));
assertNull(ignite.atomicReference("ref2", cfg, "a", false));
assertNull(ignite.atomicReference("ref3", cfg, "a", false));
assertTrue(ref1.compareAndSet("a", "A"));
assertTrue(ref2.compareAndSet("b", "B"));
assertTrue(ref3.compareAndSet("c", "C"));
assertTrue(ref4.compareAndSet("d", "D"));
assertTrue(ref5.compareAndSet("e", "E"));
assertTrue(ref6.compareAndSet("f", "F"));
assertFalse(ref1.compareAndSet("a", "Z"));
assertFalse(ref2.compareAndSet("b", "Z"));
assertFalse(ref3.compareAndSet("c", "Z"));
assertFalse(ref4.compareAndSet("d", "Z"));
assertFalse(ref5.compareAndSet("e", "Z"));
assertFalse(ref6.compareAndSet("f", "Z"));
assertEquals("A", ref1.get());
assertEquals("B", ref2.get());
assertEquals("C", ref3.get());
assertEquals("D", ref4.get());
assertEquals("E", ref5.get());
assertEquals("F", ref6.get());
ref2.close();
ref5.close();
assertTrue(ref2.removed());
assertTrue(ref5.removed());
assertNull(ignite.atomicReference("ref2", "b", false));
assertNull(ignite.atomicReference("ref5", cfg, "e", false));
assertFalse(ref1.removed());
assertFalse(ref3.removed());
assertFalse(ref4.removed());
assertFalse(ref6.removed());
assertNotNull(ignite.atomicReference("ref1", "a", false));
assertNotNull(ignite.atomicReference("ref3", "c", false));
assertNotNull(ignite.atomicReference("ref4", cfg, "d", false));
assertNotNull(ignite.atomicReference("ref6", cfg, "f", false));
}
use of org.apache.ignite.configuration.AtomicConfiguration in project ignite by apache.
the class GridCachePartitionedAtomicReferenceApiSelfTest method atomicConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected AtomicConfiguration atomicConfiguration() {
AtomicConfiguration cfg = super.atomicConfiguration();
cfg.setBackups(1);
return cfg;
}
Aggregations