Search in sources :

Example 1 with SqlConnectorConfiguration

use of org.apache.ignite.configuration.SqlConnectorConfiguration in project ignite by apache.

the class SqlConnectorConfigurationValidationSelfTest method testDefault.

/**
 * Test host.
 *
 * @throws Exception If failed.
 */
@Test
public void testDefault() throws Exception {
    check(new SqlConnectorConfiguration(), true);
    assertJdbc(null, SqlConnectorConfiguration.DFLT_PORT);
}
Also used : SqlConnectorConfiguration(org.apache.ignite.configuration.SqlConnectorConfiguration) AbstractIndexingCommonTest(org.apache.ignite.internal.processors.cache.index.AbstractIndexingCommonTest) Test(org.junit.Test)

Example 2 with SqlConnectorConfiguration

use of org.apache.ignite.configuration.SqlConnectorConfiguration in project ignite by apache.

the class ClientConnectorConfigurationValidationSelfTest method testIgnoreOdbcAndSqlWhenClientSet.

/**
 * Test SQL connector conversion.
 *
 * @throws Exception If failed.
 */
@Test
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) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 3 with SqlConnectorConfiguration

use of org.apache.ignite.configuration.SqlConnectorConfiguration in project ignite by apache.

the class ClientConnectorConfigurationValidationSelfTest method testIgnoreOdbcWhenSqlSet.

/**
 * Test SQL connector conversion.
 *
 * @throws Exception If failed.
 */
@Test
public void testIgnoreOdbcWhenSqlSet() throws Exception {
    int port = ClientConnectorConfiguration.DFLT_PORT - 1;
    IgniteConfiguration cfg = baseConfiguration();
    cfg.setSqlConnectorConfiguration(new SqlConnectorConfiguration().setPort(port));
    cfg.setOdbcConfiguration(new OdbcConfiguration().setEndpointAddress("127.0.0.1:" + (port - 1)));
    Ignition.start(cfg);
    checkJdbc(null, port);
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) OdbcConfiguration(org.apache.ignite.configuration.OdbcConfiguration) SqlConnectorConfiguration(org.apache.ignite.configuration.SqlConnectorConfiguration) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 4 with SqlConnectorConfiguration

use of org.apache.ignite.configuration.SqlConnectorConfiguration in project ignite by apache.

the class ClientListenerProcessor method prepareConfiguration.

/**
 * Prepare connector configuration.
 *
 * @param cfg Ignite configuration.
 * @return Connector configuration.
 * @throws IgniteCheckedException If failed.
 */
@SuppressWarnings("deprecation")
@Nullable
private ClientConnectorConfiguration prepareConfiguration(IgniteConfiguration cfg) throws IgniteCheckedException {
    OdbcConfiguration odbcCfg = cfg.getOdbcConfiguration();
    SqlConnectorConfiguration sqlConnCfg = cfg.getSqlConnectorConfiguration();
    ClientConnectorConfiguration cliConnCfg = cfg.getClientConnectorConfiguration();
    if (cliConnCfg == null && sqlConnCfg == null && odbcCfg == null)
        return null;
    if (isNotDefault(cliConnCfg)) {
        // User set configuration explicitly. User it, but print a warning about ignored SQL/ODBC configs.
        if (odbcCfg != null) {
            U.warn(log, "Deprecated " + OdbcConfiguration.class.getSimpleName() + " will be ignored because " + ClientConnectorConfiguration.class.getSimpleName() + " is set.");
        }
        if (sqlConnCfg != null) {
            U.warn(log, "Deprecated " + SqlConnectorConfiguration.class.getSimpleName() + " will be ignored " + "because " + ClientConnectorConfiguration.class.getSimpleName() + " is set.");
        }
    } else {
        cliConnCfg = new ClientConnectorConfiguration();
        if (sqlConnCfg != null) {
            // Migrate from SQL configuration.
            cliConnCfg.setHost(sqlConnCfg.getHost());
            cliConnCfg.setMaxOpenCursorsPerConnection(sqlConnCfg.getMaxOpenCursorsPerConnection());
            cliConnCfg.setPort(sqlConnCfg.getPort());
            cliConnCfg.setPortRange(sqlConnCfg.getPortRange());
            cliConnCfg.setSocketSendBufferSize(sqlConnCfg.getSocketSendBufferSize());
            cliConnCfg.setSocketReceiveBufferSize(sqlConnCfg.getSocketReceiveBufferSize());
            cliConnCfg.setTcpNoDelay(sqlConnCfg.isTcpNoDelay());
            cliConnCfg.setThreadPoolSize(sqlConnCfg.getThreadPoolSize());
            U.warn(log, "Automatically converted deprecated " + SqlConnectorConfiguration.class.getSimpleName() + " to " + ClientConnectorConfiguration.class.getSimpleName() + ".");
            if (odbcCfg != null) {
                U.warn(log, "Deprecated " + OdbcConfiguration.class.getSimpleName() + " will be ignored because " + SqlConnectorConfiguration.class.getSimpleName() + " is set.");
            }
        } else if (odbcCfg != null) {
            // Migrate from ODBC configuration.
            HostAndPortRange hostAndPort = parseOdbcEndpoint(odbcCfg);
            cliConnCfg.setHost(hostAndPort.host());
            cliConnCfg.setPort(hostAndPort.portFrom());
            cliConnCfg.setPortRange(hostAndPort.portTo() - hostAndPort.portFrom());
            cliConnCfg.setThreadPoolSize(odbcCfg.getThreadPoolSize());
            cliConnCfg.setSocketSendBufferSize(odbcCfg.getSocketSendBufferSize());
            cliConnCfg.setSocketReceiveBufferSize(odbcCfg.getSocketReceiveBufferSize());
            cliConnCfg.setMaxOpenCursorsPerConnection(odbcCfg.getMaxOpenCursors());
            U.warn(log, "Automatically converted deprecated " + OdbcConfiguration.class.getSimpleName() + " to " + ClientConnectorConfiguration.class.getSimpleName() + ".");
        }
    }
    return cliConnCfg;
}
Also used : ClientConnectorConfiguration(org.apache.ignite.configuration.ClientConnectorConfiguration) HostAndPortRange(org.apache.ignite.internal.util.HostAndPortRange) OdbcConfiguration(org.apache.ignite.configuration.OdbcConfiguration) SqlConnectorConfiguration(org.apache.ignite.configuration.SqlConnectorConfiguration) Nullable(org.jetbrains.annotations.Nullable)

Example 5 with SqlConnectorConfiguration

use of org.apache.ignite.configuration.SqlConnectorConfiguration in project ignite by apache.

the class ClientConnectorConfigurationValidationSelfTest method testSqlConnectorConversion.

/**
 * Test SQL connector conversion.
 *
 * @throws Exception If failed.
 */
@Test
public void testSqlConnectorConversion() throws Exception {
    int port = ClientConnectorConfiguration.DFLT_PORT - 1;
    IgniteConfiguration cfg = baseConfiguration();
    cfg.setSqlConnectorConfiguration(new SqlConnectorConfiguration().setPort(port));
    Ignition.start(cfg);
    checkJdbc(null, port);
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) SqlConnectorConfiguration(org.apache.ignite.configuration.SqlConnectorConfiguration) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

SqlConnectorConfiguration (org.apache.ignite.configuration.SqlConnectorConfiguration)6 Test (org.junit.Test)5 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)4 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)4 ClientConnectorConfiguration (org.apache.ignite.configuration.ClientConnectorConfiguration)3 OdbcConfiguration (org.apache.ignite.configuration.OdbcConfiguration)3 AbstractIndexingCommonTest (org.apache.ignite.internal.processors.cache.index.AbstractIndexingCommonTest)1 HostAndPortRange (org.apache.ignite.internal.util.HostAndPortRange)1 Nullable (org.jetbrains.annotations.Nullable)1