Search in sources :

Example 1 with ClientConnectorConfiguration

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);
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) ClientConnectorConfiguration(org.apache.ignite.configuration.ClientConnectorConfiguration) OdbcConfiguration(org.apache.ignite.configuration.OdbcConfiguration) SqlConnectorConfiguration(org.apache.ignite.configuration.SqlConnectorConfiguration)

Example 2 with ClientConnectorConfiguration

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");
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) ClientConnectorConfiguration(org.apache.ignite.configuration.ClientConnectorConfiguration) IgniteException(org.apache.ignite.IgniteException) SQLException(java.sql.SQLException)

Example 3 with ClientConnectorConfiguration

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) ClientConnectorConfiguration(org.apache.ignite.configuration.ClientConnectorConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 4 with ClientConnectorConfiguration

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) ClientConnectorConfiguration(org.apache.ignite.configuration.ClientConnectorConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 5 with ClientConnectorConfiguration

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) ClientConnectorConfiguration(org.apache.ignite.configuration.ClientConnectorConfiguration) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

ClientConnectorConfiguration (org.apache.ignite.configuration.ClientConnectorConfiguration)13 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)11 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)4 OdbcConfiguration (org.apache.ignite.configuration.OdbcConfiguration)3 SqlConnectorConfiguration (org.apache.ignite.configuration.SqlConnectorConfiguration)3 SQLException (java.sql.SQLException)2 IgniteException (org.apache.ignite.IgniteException)2 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)2 InetAddress (java.net.InetAddress)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1 HostAndPortRange (org.apache.ignite.internal.util.HostAndPortRange)1 GridNioFilter (org.apache.ignite.internal.util.nio.GridNioFilter)1 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)1 IgniteThreadPoolExecutor (org.apache.ignite.thread.IgniteThreadPoolExecutor)1 Nullable (org.jetbrains.annotations.Nullable)1