use of org.apache.ignite.configuration.ClientConnectorConfiguration in project ignite by apache.
the class ClientConnectorConfigurationValidationSelfTest method testIgnoreOdbcAndSqlWhenClientSet.
/**
* Test SQL connector conversion.
*
* @throws Exception If failed.
*/
public void testIgnoreOdbcAndSqlWhenClientSet() throws Exception {
int cliPort = ClientConnectorConfiguration.DFLT_PORT - 1;
int sqlPort = ClientConnectorConfiguration.DFLT_PORT - 2;
int odbcPort = ClientConnectorConfiguration.DFLT_PORT - 3;
IgniteConfiguration cfg = baseConfiguration();
cfg.setClientConnectorConfiguration(new ClientConnectorConfiguration().setPort(cliPort));
cfg.setSqlConnectorConfiguration(new SqlConnectorConfiguration().setPort(sqlPort));
cfg.setOdbcConfiguration(new OdbcConfiguration().setEndpointAddress("127.0.0.1:" + odbcPort));
Ignition.start(cfg);
checkJdbc(null, cliPort);
}
use of org.apache.ignite.configuration.ClientConnectorConfiguration in project ignite by apache.
the class ClientConnectorConfigurationValidationSelfTest method testJdbcConnectionDisabled.
/**
* Checks if JDBC connection disabled and others are enabled, JDBC doesn't work.
*
* @throws Exception If failed.
*/
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public void testJdbcConnectionDisabled() throws Exception {
IgniteConfiguration cfg = baseConfiguration();
cfg.setClientConnectorConfiguration(new ClientConnectorConfiguration().setJdbcEnabled(false).setOdbcEnabled(true).setThinClientEnabled(true));
Ignition.start(cfg);
GridTestUtils.assertThrows(log, new Callable<Void>() {
@Override
public Void call() throws Exception {
checkJdbc(null, ClientConnectorConfiguration.DFLT_PORT);
return null;
}
}, SQLException.class, "JDBC connection is not allowed, see ClientConnectorConfiguration.jdbcEnabled");
}
use of org.apache.ignite.configuration.ClientConnectorConfiguration in project ignite by apache.
the class JdbcThinConnectionMultipleAddressesTest method getConfiguration.
/**
* {@inheritDoc}
*/
@SuppressWarnings("deprecation")
@Override
protected IgniteConfiguration getConfiguration(String name) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(name);
cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME));
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
cfg.setMarshaller(new BinaryMarshaller());
cfg.setClientConnectorConfiguration(new ClientConnectorConfiguration().setPort(jdbcPorts.get(getTestIgniteInstanceIndex(name))));
return cfg;
}
use of org.apache.ignite.configuration.ClientConnectorConfiguration in project ignite by apache.
the class JdbcThinConnectionSSLTest method getConfiguration.
/**
* {@inheritDoc}
*/
@SuppressWarnings("deprecation")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
cfg.setMarshaller(new BinaryMarshaller());
cfg.setClientConnectorConfiguration(new ClientConnectorConfiguration().setSslEnabled(true).setUseIgniteSslContextFactory(setSslCtxFactoryToIgnite).setSslClientAuth(true).setSslContextFactory(setSslCtxFactoryToCli ? sslCtxFactory : null));
cfg.setSslContextFactory(setSslCtxFactoryToIgnite ? sslCtxFactory : null);
return cfg;
}
use of org.apache.ignite.configuration.ClientConnectorConfiguration in project ignite by apache.
the class IgniteCache150ClientsTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setLocalHost("127.0.0.1");
cfg.setNetworkTimeout(30_000);
cfg.setConnectorConfiguration(null);
cfg.setPeerClassLoadingEnabled(false);
cfg.setTimeServerPortRange(200);
((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSocketWriteTimeout(200);
((TcpCommunicationSpi) cfg.getCommunicationSpi()).setLocalPortRange(200);
((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setJoinTimeout(0);
cfg.setClientFailureDetectionTimeout(200000);
cfg.setClientMode(!igniteInstanceName.equals(getTestIgniteInstanceName(0)));
cfg.setClientConnectorConfiguration(new ClientConnectorConfiguration().setPortRange(1000));
CacheConfiguration[] ccfgs = new CacheConfiguration[CACHES];
for (int i = 0; i < ccfgs.length; i++) {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(PARTITIONED);
ccfg.setAtomicityMode(i % 2 == 0 ? ATOMIC : TRANSACTIONAL);
ccfg.setWriteSynchronizationMode(PRIMARY_SYNC);
ccfg.setBackups(1);
ccfg.setName("cache-" + i);
ccfgs[i] = ccfg;
}
cfg.setCacheConfiguration(ccfgs);
return cfg;
}
Aggregations