use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class IgniteCacheAbstractQuerySelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
c.setDiscoverySpi(new TcpDiscoverySpi().setForceServerMode(true).setIpFinder(ipFinder));
if (igniteInstanceName.startsWith("client"))
c.setClientMode(true);
return c;
}
use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class IgniteCacheAbstractSqlDmlQuerySelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setPeerClassLoadingEnabled(false);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
return cfg;
}
use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class IgniteCacheDistributedJoinCollocatedAndNotTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(PersonKey.class.getName(), "affKey");
cfg.setCacheKeyConfiguration(keyCfg);
TcpDiscoverySpi spi = ((TcpDiscoverySpi) cfg.getDiscoverySpi());
spi.setIpFinder(IP_FINDER);
List<CacheConfiguration> ccfgs = new ArrayList<>();
{
CacheConfiguration ccfg = configuration(PERSON_CACHE);
QueryEntity entity = new QueryEntity();
entity.setKeyType(PersonKey.class.getName());
entity.setValueType(Person.class.getName());
entity.addQueryField("id", Integer.class.getName(), null);
entity.addQueryField("affKey", Integer.class.getName(), null);
entity.addQueryField("name", String.class.getName(), null);
ccfg.setQueryEntities(F.asList(entity));
ccfgs.add(ccfg);
}
{
CacheConfiguration ccfg = configuration(ORG_CACHE);
QueryEntity entity = new QueryEntity();
entity.setKeyType(Integer.class.getName());
entity.setValueType(Organization.class.getName());
entity.addQueryField("name", String.class.getName(), null);
entity.setIndexes(F.asList(new QueryIndex("name")));
ccfg.setQueryEntities(F.asList(entity));
ccfgs.add(ccfg);
}
{
CacheConfiguration ccfg = configuration(ACCOUNT_CACHE);
QueryEntity entity = new QueryEntity();
entity.setKeyType(Integer.class.getName());
entity.setValueType(Account.class.getName());
entity.addQueryField("personId", Integer.class.getName(), null);
entity.addQueryField("name", String.class.getName(), null);
entity.setIndexes(F.asList(new QueryIndex("personId"), new QueryIndex("name")));
ccfg.setQueryEntities(F.asList(entity));
ccfgs.add(ccfg);
}
cfg.setCacheConfiguration(ccfgs.toArray(new CacheConfiguration[ccfgs.size()]));
cfg.setClientMode(client);
return cfg;
}
use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class IgniteCacheDistributedJoinCustomAffinityMapper method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
List<CacheConfiguration> ccfgs = new ArrayList<>();
{
CacheConfiguration ccfg = configuration(PERSON_CACHE);
QueryEntity entity = new QueryEntity();
entity.setKeyType(Integer.class.getName());
entity.setValueType(Person.class.getName());
entity.addQueryField("orgId", Integer.class.getName(), null);
entity.setIndexes(F.asList(new QueryIndex("orgId")));
ccfg.setQueryEntities(F.asList(entity));
ccfgs.add(ccfg);
}
{
CacheConfiguration ccfg = configuration(PERSON_CACHE_CUSTOM_AFF);
ccfg.setAffinityMapper(new TestMapper());
QueryEntity entity = new QueryEntity();
entity.setKeyType(Integer.class.getName());
entity.setValueType(Person.class.getName());
entity.addQueryField("orgId", Integer.class.getName(), null);
entity.setIndexes(F.asList(new QueryIndex("orgId")));
ccfg.setQueryEntities(F.asList(entity));
ccfgs.add(ccfg);
}
{
CacheConfiguration ccfg = configuration(ORG_CACHE);
QueryEntity entity = new QueryEntity();
entity.setKeyType(Integer.class.getName());
entity.setValueType(Organization.class.getName());
ccfg.setQueryEntities(F.asList(entity));
ccfgs.add(ccfg);
}
{
CacheConfiguration ccfg = configuration(ORG_CACHE_REPL_CUSTOM);
ccfg.setCacheMode(REPLICATED);
ccfg.setAffinityMapper(new TestMapper());
QueryEntity entity = new QueryEntity();
entity.setKeyType(Integer.class.getName());
entity.setValueType(Organization.class.getName());
ccfg.setQueryEntities(F.asList(entity));
ccfgs.add(ccfg);
}
cfg.setCacheConfiguration(ccfgs.toArray(new CacheConfiguration[ccfgs.size()]));
return cfg;
}
use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.
the class IgniteCacheDistributedJoinNoIndexTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi spi = ((TcpDiscoverySpi) cfg.getDiscoverySpi());
spi.setIpFinder(IP_FINDER);
List<CacheConfiguration> ccfgs = new ArrayList<>();
{
CacheConfiguration ccfg = configuration(PERSON_CACHE);
QueryEntity entity = new QueryEntity();
entity.setKeyType(Integer.class.getName());
entity.setValueType(Person.class.getName());
entity.addQueryField("orgId", Integer.class.getName(), null);
entity.addQueryField("orgName", String.class.getName(), null);
ccfg.setQueryEntities(F.asList(entity));
ccfgs.add(ccfg);
}
{
CacheConfiguration ccfg = configuration(ORG_CACHE);
QueryEntity entity = new QueryEntity();
entity.setKeyType(Integer.class.getName());
entity.setValueType(Organization.class.getName());
entity.addQueryField("name", String.class.getName(), null);
ccfg.setQueryEntities(F.asList(entity));
ccfgs.add(ccfg);
}
cfg.setCacheConfiguration(ccfgs.toArray(new CacheConfiguration[ccfgs.size()]));
cfg.setClientMode(client);
return cfg;
}
Aggregations