Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setSqlConnectorConfiguration()

The following examples show how to use org.apache.ignite.configuration.IgniteConfiguration#setSqlConnectorConfiguration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientConnectorConfigurationValidationSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 2
Source File: ClientConnectorConfigurationValidationSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source File: ClientConnectorConfigurationValidationSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Test SQL connector conversion.
 *
 * @throws Exception If failed.
 */
@Test
public void testIgnoreSqlWhenClientSet() throws Exception {
    int cliPort = ClientConnectorConfiguration.DFLT_PORT - 1;
    int sqlPort = ClientConnectorConfiguration.DFLT_PORT - 2;

    IgniteConfiguration cfg = baseConfiguration();

    cfg.setClientConnectorConfiguration(new ClientConnectorConfiguration().setPort(cliPort));
    cfg.setSqlConnectorConfiguration(new SqlConnectorConfiguration().setPort(sqlPort));

    Ignition.start(cfg);

    checkJdbc(null, cliPort);
}
 
Example 4
Source File: SqlConnectorConfigurationValidationSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Perform check.
 *
 * @param sqlCfg SQL configuration.
 * @param success Success flag. * @throws Exception If failed.
 */
@SuppressWarnings({"unchecked"})
private void check(SqlConnectorConfiguration sqlCfg, boolean success) throws Exception {
    final IgniteConfiguration cfg = super.getConfiguration();

    cfg.setIgniteInstanceName(SqlConnectorConfigurationValidationSelfTest.class.getName() + "-" +
        NODE_IDX_GEN.incrementAndGet());

    cfg.setLocalHost("127.0.0.1");
    cfg.setSqlConnectorConfiguration(sqlCfg);
    cfg.setMarshaller(new BinaryMarshaller());

    TcpDiscoverySpi spi = new TcpDiscoverySpi();
    spi.setIpFinder(new TcpDiscoveryVmIpFinder(true));

    cfg.setDiscoverySpi(spi);

    CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME)
        .setIndexedTypes(SqlConnectorKey.class, SqlConnectorValue.class);

    cfg.setCacheConfiguration(ccfg);

    if (success)
        startGrid(cfg.getIgniteInstanceName(), cfg);
    else {
        GridTestUtils.assertThrows(log, new Callable<Void>() {
            @Override public Void call() throws Exception {
                startGrid(cfg.getIgniteInstanceName(), cfg);

                return null;
            }
        }, IgniteException.class, null);
    }
}
 
Example 5
Source File: ClientConnectorConfigurationValidationSelfTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/**
 * 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);
}