/** * Ensure we can start with default configuration. * * @throws Exception If failed. */ @Test public void testAddressDefault() throws Exception { check(new OdbcConfiguration(), true); }
/** * Test address with both host and port. * * @throws Exception If failed. */ @Test public void testAddressHostAndPort() throws Exception { check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9999"), true); // Shouldn't fit into range. check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9999"), false); }
/** * Test address with host and port range. * * @throws Exception If failed. */ @Test public void testAddressHostAndPortRange() throws Exception { check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9999..10000"), true); check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9999..10000"), true); // Shouldn't fit into range. check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9999..10000"), false); }
/** * Test thread pool size. * * @throws Exception If failed. */ @Test public void testThreadPoolSize() throws Exception { check(new OdbcConfiguration().setThreadPoolSize(0), false); check(new OdbcConfiguration().setThreadPoolSize(-1), false); check(new OdbcConfiguration().setThreadPoolSize(4), true); }
/** * Test start with invalid address format. * * @throws Exception If failed. */ @Test public void testAddressInvalidFormat() throws Exception { check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:"), false); check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:0"), false); check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:-1"), false); check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:111111"), false); check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9999.."), false); check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9999..9998"), false); check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:a"), false); check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:a.."), false); check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:a..b"), false); check(new OdbcConfiguration().setEndpointAddress(":9999"), false); check(new OdbcConfiguration().setEndpointAddress(":9999..10000"), false); }
/** * Test address where only host is provided. * * @throws Exception If failed. */ @Test public void testAddressHostOnly() throws Exception { check(new OdbcConfiguration().setEndpointAddress("127.0.0.1"), true); }
/** * Test start with invalid host. * * @throws Exception If failed. */ @Test public void testAddressInvalidHost() throws Exception { check(new OdbcConfiguration().setEndpointAddress("126.0.0.1"), false); }
/** * Test connection parameters: sendBufferSize, receiveBufferSize, connectionTimeout. * * @throws Exception If failed. */ @Test public void testConnectionParams() throws Exception { check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9998..10000") .setSocketSendBufferSize(4 * 1024), true); check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9998..10000") .setSocketReceiveBufferSize(4 * 1024), true); check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9998..10000") .setSocketSendBufferSize(-64 * 1024), false); check(new OdbcConfiguration().setEndpointAddress("127.0.0.1:9998..10000") .setSocketReceiveBufferSize(-64 * 1024), false); }
/** * Test ODBC connector conversion. * * @throws Exception If failed. */ @Test public void testOdbcConnectorConversion() throws Exception { int port = ClientConnectorConfiguration.DFLT_PORT - 1; IgniteConfiguration cfg = baseConfiguration(); cfg.setOdbcConfiguration(new OdbcConfiguration().setEndpointAddress("127.0.0.1:" + port)); Ignition.start(cfg); checkJdbc(null, port); }
/** * 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); }
/** * Test SQL connector conversion. * * @throws Exception If failed. */ @Test public void testIgnoreOdbcWhenClientSet() throws Exception { int cliPort = ClientConnectorConfiguration.DFLT_PORT - 1; int odbcPort = ClientConnectorConfiguration.DFLT_PORT - 2; IgniteConfiguration cfg = baseConfiguration(); cfg.setClientConnectorConfiguration(new ClientConnectorConfiguration().setPort(cliPort)); cfg.setOdbcConfiguration(new OdbcConfiguration().setEndpointAddress("127.0.0.1:" + odbcPort)); Ignition.start(cfg); checkJdbc(null, cliPort); }
/** * 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); }