IGNITE-6810: Implemented SSL support for ODBC. This closes #3361
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/394019ee Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/394019ee Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/394019ee Branch: refs/heads/master Commit: 394019eef7b840eccb3a4d6cae18e359db6ff68d Parents: a824ba8 Author: Igor Sapego <[email protected]> Authored: Tue Jan 30 15:56:17 2018 +0300 Committer: Igor Sapego <[email protected]> Committed: Tue Jan 30 15:57:30 2018 +0300 ---------------------------------------------------------------------- .../ClientConnectorConfiguration.java | 116 +++++ .../odbc/ClientListenerBufferedParser.java | 6 +- .../odbc/ClientListenerNioListener.java | 8 + .../odbc/ClientListenerNioServerBuffer.java | 12 +- .../odbc/ClientListenerProcessor.java | 71 ++- .../include/ignite/common/platform_utils.h | 17 + .../cpp/common/include/ignite/common/utils.h | 7 + .../os/linux/src/common/platform_utils.cpp | 15 + .../os/win/src/common/dynamic_load_os.cpp | 4 + .../common/os/win/src/common/platform_utils.cpp | 15 + .../platforms/cpp/common/src/common/utils.cpp | 9 + .../cpp/core-test/src/cache_query_test.cpp | 15 +- modules/platforms/cpp/odbc-test/Makefile.am | 1 + .../cpp/odbc-test/config/queries-default.xml | 10 +- .../cpp/odbc-test/config/queries-ssl-32.xml | 77 ++++ .../cpp/odbc-test/config/queries-ssl.xml | 59 +++ .../cpp/odbc-test/config/queries-test-32.xml | 3 +- .../odbc-test/config/queries-test-default.xml | 39 -- .../odbc-test/config/queries-test-noodbc-32.xml | 53 --- .../odbc-test/config/queries-test-noodbc.xml | 35 -- .../cpp/odbc-test/config/queries-test.xml | 3 +- .../platforms/cpp/odbc-test/config/ssl/ca.pem | 24 + .../cpp/odbc-test/config/ssl/client_full.pem | 84 ++++ .../cpp/odbc-test/config/ssl/client_unknown.pem | 50 ++ .../cpp/odbc-test/config/ssl/server.jks | Bin 0 -> 4256 bytes .../cpp/odbc-test/config/ssl/trust.jks | Bin 0 -> 1089 bytes .../cpp/odbc-test/include/odbc_test_suite.h | 8 +- .../cpp/odbc-test/include/test_utils.h | 5 + .../cpp/odbc-test/project/vs/odbc-test.vcxproj | 15 +- .../project/vs/odbc-test.vcxproj.filters | 14 +- .../cpp/odbc-test/src/api_robustness_test.cpp | 101 +--- .../platforms/cpp/odbc-test/src/errors_test.cpp | 90 +--- .../cpp/odbc-test/src/meta_queries_test.cpp | 96 +--- .../cpp/odbc-test/src/odbc_test_suite.cpp | 40 +- .../cpp/odbc-test/src/queries_ssl_test.cpp | 283 ++++++++++++ .../cpp/odbc-test/src/queries_test.cpp | 14 +- .../odbc-test/src/sql_test_suite_fixture.cpp | 4 + .../platforms/cpp/odbc-test/src/test_utils.cpp | 9 + modules/platforms/cpp/odbc/Makefile.am | 5 +- modules/platforms/cpp/odbc/include/Makefile.am | 6 +- .../include/ignite/odbc/config/configuration.h | 110 ++++- .../cpp/odbc/include/ignite/odbc/connection.h | 9 +- .../odbc/include/ignite/odbc/socket_client.h | 109 +++++ .../ignite/odbc/ssl/secure_socket_client.h | 148 ++++++ .../odbc/include/ignite/odbc/ssl/ssl_bindings.h | 303 ++++++++++++ .../odbc/include/ignite/odbc/ssl/ssl_gateway.h | 151 ++++++ .../cpp/odbc/include/ignite/odbc/ssl/ssl_mode.h | 55 +++ .../include/ignite/odbc/system/socket_client.h | 151 ------ .../ignite/odbc/system/tcp_socket_client.h | 151 ++++++ .../odbc/system/ui/dsn_configuration_window.h | 113 ++++- .../odbc/os/linux/src/system/socket_client.cpp | 360 --------------- .../os/linux/src/system/tcp_socket_client.cpp | 384 +++++++++++++++ .../odbc/os/win/src/system/socket_client.cpp | 432 ----------------- .../os/win/src/system/tcp_socket_client.cpp | 462 +++++++++++++++++++ .../src/system/ui/dsn_configuration_window.cpp | 315 +++++++++---- .../cpp/odbc/os/win/src/system/ui/window.cpp | 9 +- .../platforms/cpp/odbc/project/vs/odbc.vcxproj | 36 +- .../cpp/odbc/project/vs/odbc.vcxproj.filters | 39 +- .../cpp/odbc/src/config/configuration.cpp | 8 + modules/platforms/cpp/odbc/src/connection.cpp | 66 ++- modules/platforms/cpp/odbc/src/dsn_config.cpp | 24 +- modules/platforms/cpp/odbc/src/odbc.cpp | 2 +- .../cpp/odbc/src/ssl/secure_socket_client.cpp | 419 +++++++++++++++++ .../platforms/cpp/odbc/src/ssl/ssl_gateway.cpp | 210 +++++++++ modules/platforms/cpp/odbc/src/ssl/ssl_mode.cpp | 43 ++ 65 files changed, 3992 insertions(+), 1540 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/core/src/main/java/org/apache/ignite/configuration/ClientConnectorConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/ClientConnectorConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/ClientConnectorConfiguration.java index 5827333..ed30db3 100644 --- a/modules/core/src/main/java/org/apache/ignite/configuration/ClientConnectorConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/configuration/ClientConnectorConfiguration.java @@ -17,7 +17,10 @@ package org.apache.ignite.configuration; +import javax.cache.configuration.Factory; +import javax.net.ssl.SSLContext; import org.apache.ignite.internal.util.typedef.internal.S; +import org.apache.ignite.ssl.SslContextFactory; import org.jetbrains.annotations.Nullable; /** @@ -45,6 +48,9 @@ public class ClientConnectorConfiguration { /** Default idle timeout. */ public static final int DFLT_IDLE_TIMEOUT = 0; + /** Default value of whether to use Ignite SSL context factory. */ + public static final boolean DFLT_USE_IGNITE_SSL_CTX_FACTORY = true; + /** Host. */ private String host; @@ -81,6 +87,18 @@ public class ClientConnectorConfiguration { /** JDBC connections enabled flag. */ private boolean thinCliEnabled = true; + /** SSL enable flag, default is disabled. */ + private boolean sslEnabled; + + /** If to use SSL context factory from Ignite configuration. */ + private boolean useIgniteSslCtxFactory = DFLT_USE_IGNITE_SSL_CTX_FACTORY; + + /** SSL need client auth flag. */ + private boolean sslClientAuth; + + /** SSL connection factory. */ + private Factory<SSLContext> sslCtxFactory; + /** * Creates SQL connector configuration with all default values. */ @@ -105,6 +123,10 @@ public class ClientConnectorConfiguration { tcpNoDelay = cfg.isTcpNoDelay(); threadPoolSize = cfg.getThreadPoolSize(); idleTimeout = cfg.getIdleTimeout(); + sslEnabled = cfg.isSslEnabled(); + sslClientAuth = cfg.isSslClientAuth(); + useIgniteSslCtxFactory = cfg.isUseIgniteSslContextFactory(); + sslCtxFactory = cfg.getSslContextFactory(); } /** @@ -385,6 +407,100 @@ public class ClientConnectorConfiguration { return this; } + /** + * Whether secure socket layer should be enabled on client connector. + * <p> + * Note that if this flag is set to {@code true}, an instance of {@code Factory<SSLContext>} + * should be provided, otherwise client connector will fail to start. + * + * @return {@code True} if SSL should be enabled. + */ + public boolean isSslEnabled() { + return sslEnabled; + } + + /** + * Sets whether Secure Socket Layer should be enabled for client connector. + * <p/> + * Note that if this flag is set to {@code true}, then a valid instance of {@code Factory<SSLContext>} + * should be provided in {@link IgniteConfiguration}. Otherwise, TCP binary protocol will fail to start. + * + * @param sslEnabled {@code True} if SSL should be enabled. + * @return {@code this} for chaining. + */ + public ClientConnectorConfiguration setSslEnabled(boolean sslEnabled) { + this.sslEnabled = sslEnabled; + + return this; + } + + /** + * Gets whether to use Ignite SSL context factory configured through + * {@link IgniteConfiguration#getSslContextFactory()} if {@link #getSslContextFactory()} is not set. + * + * @return {@code True} if Ignite SSL context factory can be used. + */ + public boolean isUseIgniteSslContextFactory() { + return useIgniteSslCtxFactory; + } + + /** + * Sets whether to use Ignite SSL context factory. See {@link #isUseIgniteSslContextFactory()} for more information. + * + * @param useIgniteSslCtxFactory Whether to use Ignite SSL context factory + * @return {@code this} for chaining. + */ + public ClientConnectorConfiguration setUseIgniteSslContextFactory(boolean useIgniteSslCtxFactory) { + this.useIgniteSslCtxFactory = useIgniteSslCtxFactory; + + return this; + } + + /** + * Gets a flag indicating whether or not remote clients will be required to have a valid SSL certificate which + * validity will be verified with trust manager. + * + * @return Whether or not client authentication is required. + */ + public boolean isSslClientAuth() { + return sslClientAuth; + } + + /** + * Sets flag indicating whether or not SSL client authentication is required. + * + * @param sslClientAuth Whether or not client authentication is required. + * @return {@code this} for chaining. + */ + public ClientConnectorConfiguration setSslClientAuth(boolean sslClientAuth) { + this.sslClientAuth = sslClientAuth; + + return this; + } + + /** + * Sets SSL context factory that will be used for creating a secure socket layer. + * + * @param sslCtxFactory Ssl context factory. + * @see SslContextFactory + * @return {@code this} for chaining. + */ + public ClientConnectorConfiguration setSslContextFactory(Factory<SSLContext> sslCtxFactory) { + this.sslCtxFactory = sslCtxFactory; + + return this; + } + + /** + * Returns SSL context factory that will be used for creating a secure socket layer. + * + * @return SSL connection factory. + * @see SslContextFactory + */ + public Factory<SSLContext> getSslContextFactory() { + return sslCtxFactory; + } + /** {@inheritDoc} */ @Override public String toString() { return S.toString(ClientConnectorConfiguration.class, this); http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerBufferedParser.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerBufferedParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerBufferedParser.java index eb7bfe8..8dd26b6 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerBufferedParser.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerBufferedParser.java @@ -55,7 +55,9 @@ public class ClientListenerBufferedParser implements GridNioParser { assert old == null; } - return nioBuf.read(buf); + boolean checkHandshake = ses.meta(ClientListenerNioListener.CONN_CTX_HANDSHAKE_PASSED) == null; + + return nioBuf.read(buf, checkHandshake); } /** {@inheritDoc} */ @@ -78,4 +80,4 @@ public class ClientListenerBufferedParser implements GridNioParser { @Override public String toString() { return ClientListenerBufferedParser.class.getSimpleName(); } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerNioListener.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerNioListener.java index 43276a5..f472a9f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerNioListener.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerNioListener.java @@ -48,6 +48,12 @@ public class ClientListenerNioListener extends GridNioServerListenerAdapter<byte /** Thin client handshake code. */ public static final byte THIN_CLIENT = 2; + /** Connection handshake passed. */ + public static final int CONN_CTX_HANDSHAKE_PASSED = GridNioSessionMetaKey.nextUniqueKey(); + + /** Maximum size of the handshake message. */ + public static final int MAX_HANDSHAKE_MSG_SIZE = 128; + /** Connection-related metadata key. */ private static final int CONN_CTX_META_KEY = GridNioSessionMetaKey.nextUniqueKey(); @@ -114,6 +120,8 @@ public class ClientListenerNioListener extends GridNioServerListenerAdapter<byte if (connCtx == null) { onHandshake(ses, msg); + ses.addMeta(CONN_CTX_HANDSHAKE_PASSED, true); + return; } http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerNioServerBuffer.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerNioServerBuffer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerNioServerBuffer.java index 30ee69f..6ee6e71 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerNioServerBuffer.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerNioServerBuffer.java @@ -64,10 +64,11 @@ public class ClientListenerNioServerBuffer { /** * @param buf Buffer. + * @param checkHandshake Check handshake. * @return Message bytes or {@code null} if message is not fully read yet. * @throws IgniteCheckedException If failed to parse message. */ - @Nullable public byte[] read(ByteBuffer buf) throws IgniteCheckedException { + @Nullable public byte[] read(ByteBuffer buf, boolean checkHandshake) throws IgniteCheckedException { if (cnt < 0) { for (; cnt < 0 && buf.hasRemaining(); cnt++) msgSize |= (buf.get() & 0xFF) << (8*(4 + cnt)); @@ -108,7 +109,12 @@ public class ClientListenerNioServerBuffer { return data0; } - else + else { + if (checkHandshake && cnt > 0 && (msgSize > ClientListenerNioListener.MAX_HANDSHAKE_MSG_SIZE + || data[0] != ClientListenerRequest.HANDSHAKE)) + throw new IgniteCheckedException("Invalid handshake message"); + return null; + } } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerProcessor.java index a490cfc..eaa9c7a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerProcessor.java @@ -21,6 +21,8 @@ import java.net.InetAddress; import java.nio.ByteOrder; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; +import javax.cache.configuration.Factory; +import javax.net.ssl.SSLContext; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.configuration.ClientConnectorConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; @@ -35,10 +37,12 @@ import org.apache.ignite.internal.util.nio.GridNioCodecFilter; import org.apache.ignite.internal.util.nio.GridNioFilter; import org.apache.ignite.internal.util.nio.GridNioServer; import org.apache.ignite.internal.util.nio.GridNioSession; +import org.apache.ignite.internal.util.nio.ssl.GridNioSslFilter; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.spi.IgnitePortProtocol; import org.apache.ignite.thread.IgniteThreadPoolExecutor; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -110,20 +114,13 @@ public class ClientListenerProcessor extends GridProcessorAdapter { if (portTo <= 0) // Handle int overflow. portTo = Integer.MAX_VALUE; + GridNioFilter[] filters = makeFilters(cliConnCfg); + + int maxOpenCursors = cliConnCfg.getMaxOpenCursorsPerConnection(); + long idleTimeout = cliConnCfg.getIdleTimeout(); + for (int port = cliConnCfg.getPort(); port <= portTo && port <= 65535; port++) { try { - GridNioFilter[] filters = new GridNioFilter[] { - new GridNioAsyncNotifyFilter(ctx.igniteInstanceName(), execSvc, log) { - @Override public void onSessionOpened(GridNioSession ses) - throws IgniteCheckedException { - proceedSessionOpened(ses); - } - }, - new GridNioCodecFilter(new ClientListenerBufferedParser(), log, false) - }; - - long idleTimeout = cliConnCfg.getIdleTimeout(); - GridNioServer<byte[]> srv0 = GridNioServer.<byte[]>builder() .address(hostAddr) .port(port) @@ -173,6 +170,54 @@ public class ClientListenerProcessor extends GridProcessorAdapter { } } + /** + * Make NIO server filters. + * @param cliConnCfg Client configuration. + * @return Array of filters, suitable for the configuration. + * @throws IgniteCheckedException if provided SslContextFactory is null. + */ + @NotNull private GridNioFilter[] makeFilters(@NotNull ClientConnectorConfiguration cliConnCfg) + throws IgniteCheckedException { + GridNioFilter openSesFilter = new GridNioAsyncNotifyFilter(ctx.igniteInstanceName(), execSvc, log) { + @Override public void onSessionOpened(GridNioSession ses) + throws IgniteCheckedException { + proceedSessionOpened(ses); + } + }; + + GridNioFilter codecFilter = new GridNioCodecFilter(new ClientListenerBufferedParser(), log, false); + + if (cliConnCfg.isSslEnabled()) { + Factory<SSLContext> sslCtxFactory = cliConnCfg.isUseIgniteSslContextFactory() ? + ctx.config().getSslContextFactory() : cliConnCfg.getSslContextFactory(); + + if (sslCtxFactory == null) + throw new IgniteCheckedException("Failed to create client listener " + + "(SSL is enabled but factory is null). Check the ClientConnectorConfiguration"); + + GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtxFactory.create(), + true, ByteOrder.nativeOrder(), log); + + sslFilter.directMode(false); + + boolean auth = cliConnCfg.isSslClientAuth(); + + sslFilter.wantClientAuth(auth); + sslFilter.needClientAuth(auth); + + return new GridNioFilter[] { + openSesFilter, + codecFilter, + sslFilter + }; + } else { + return new GridNioFilter[] { + openSesFilter, + codecFilter + }; + } + } + /** {@inheritDoc} */ @Override public void onKernalStop(boolean cancel) { if (srv != null) { @@ -203,7 +248,7 @@ public class ClientListenerProcessor extends GridProcessorAdapter { /** * Prepare connector configuration. * - * @param cfg Ignote configuration. + * @param cfg Ignite configuration. * @return Connector configuration. * @throws IgniteCheckedException If failed. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/common/include/ignite/common/platform_utils.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/common/include/ignite/common/platform_utils.h b/modules/platforms/cpp/common/include/ignite/common/platform_utils.h index b8c6aa6..83da6ec 100644 --- a/modules/platforms/cpp/common/include/ignite/common/platform_utils.h +++ b/modules/platforms/cpp/common/include/ignite/common/platform_utils.h @@ -17,12 +17,15 @@ #ifndef _IGNITE_COMMON_PLATFORM_UTILS #define _IGNITE_COMMON_PLATFORM_UTILS +#include <iostream> #include <ignite/common/common.h> namespace ignite { namespace common { + typedef std::basic_ostream<char, std::char_traits<char> > StdCharOutStream; + /** * Convert struct tm to time_t (UTC). * @@ -87,6 +90,20 @@ namespace ignite * @return @c true if the provided path is the valid directory. */ IGNITE_IMPORT_EXPORT bool IsValidDirectory(const std::string& path); + + /** + * Write file separator to a stream. + * @param ostr Stream. + * @return The same stream for chaining. + */ + IGNITE_IMPORT_EXPORT StdCharOutStream& Fs(StdCharOutStream& ostr); + + /** + * Write dynamic library expansion to a stream. + * @param ostr Stream. + * @return The same stream for chaining. + */ + IGNITE_IMPORT_EXPORT StdCharOutStream& Dle(StdCharOutStream& ostr); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/common/include/ignite/common/utils.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/common/include/ignite/common/utils.h b/modules/platforms/cpp/common/include/ignite/common/utils.h index 5022897..792bd60 100644 --- a/modules/platforms/cpp/common/include/ignite/common/utils.h +++ b/modules/platforms/cpp/common/include/ignite/common/utils.h @@ -476,6 +476,13 @@ namespace ignite { return BoundInstance<R, T>(instance, mfunc); } + + /** + * Get dynamic library full name. + * @param name Name without extension. + * @return Full name. + */ + IGNITE_IMPORT_EXPORT std::string GetDynamicLibraryName(const char* name); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp b/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp index b74f11c..88ba8ed 100644 --- a/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp +++ b/modules/platforms/cpp/common/os/linux/src/common/platform_utils.cpp @@ -89,5 +89,20 @@ namespace ignite return stat(path.c_str(), &pathStat) != -1 && S_ISDIR(pathStat.st_mode); } + + StdCharOutStream& Fs(StdCharOutStream& ostr) + { + ostr.put('/'); + return ostr; + } + + StdCharOutStream& Dle(StdCharOutStream& ostr) + { + static const char expansion[] = ".so"; + + ostr.write(expansion, sizeof(expansion) - 1); + + return ostr; + } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/common/os/win/src/common/dynamic_load_os.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/common/os/win/src/common/dynamic_load_os.cpp b/modules/platforms/cpp/common/os/win/src/common/dynamic_load_os.cpp index f7812cd..76ca28b 100644 --- a/modules/platforms/cpp/common/os/win/src/common/dynamic_load_os.cpp +++ b/modules/platforms/cpp/common/os/win/src/common/dynamic_load_os.cpp @@ -85,7 +85,11 @@ namespace ignite void Module::Unload() { if (IsLoaded()) + { FreeLibrary(handle); + + handle = NULL; + } } Module LoadModule(const char* path) http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp b/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp index a0f4505..057a3d4 100644 --- a/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp +++ b/modules/platforms/cpp/common/os/win/src/common/platform_utils.cpp @@ -91,5 +91,20 @@ namespace ignite return attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY) != 0; } + + StdCharOutStream& Fs(StdCharOutStream& ostr) + { + ostr.put('\\'); + return ostr; + } + + StdCharOutStream& Dle(StdCharOutStream& ostr) + { + static const char expansion[] = ".dll"; + + ostr.write(expansion, sizeof(expansion) - 1); + + return ostr; + } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/common/src/common/utils.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/common/src/common/utils.cpp b/modules/platforms/cpp/common/src/common/utils.cpp index 786d0fb..54a7d03 100644 --- a/modules/platforms/cpp/common/src/common/utils.cpp +++ b/modules/platforms/cpp/common/src/common/utils.cpp @@ -180,5 +180,14 @@ namespace ignite return CTimeToTimestamp(localTime, ns); } + + std::string GetDynamicLibraryName(const char* name) + { + std::stringstream libNameBuffer; + + libNameBuffer << name << Dle; + + return libNameBuffer.str(); + } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/core-test/src/cache_query_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/src/cache_query_test.cpp b/modules/platforms/cpp/core-test/src/cache_query_test.cpp index 4993279..9dfd879 100644 --- a/modules/platforms/cpp/core-test/src/cache_query_test.cpp +++ b/modules/platforms/cpp/core-test/src/cache_query_test.cpp @@ -969,10 +969,11 @@ BOOST_AUTO_TEST_CASE(TestSqlQueryDistributedJoins) // Starting second node. Ignite node2 = StartNode("Node2"); + int firstKey = 0; int entryCnt = 1000; // Filling caches - for (int i = 0; i < entryCnt; i++) + for (int i = firstKey; i < firstKey + entryCnt; i++) { std::stringstream stream; @@ -987,7 +988,8 @@ BOOST_AUTO_TEST_CASE(TestSqlQueryDistributedJoins) // Test query with no results. SqlQuery qry("QueryPerson", "from \"QueryPerson\".QueryPerson, \"QueryRelation\".QueryRelation " - "where \"QueryPerson\".QueryPerson.age = \"QueryRelation\".QueryRelation.someVal"); + "where (\"QueryPerson\".QueryPerson.age = \"QueryRelation\".QueryRelation.someVal) " + "and (\"QueryPerson\".QueryPerson._key < 1000)"); QueryCursor<int, QueryPerson> cursor = cache1.Query(qry); @@ -1245,17 +1247,18 @@ BOOST_AUTO_TEST_CASE(TestSqlFieldsQueryDistributedJoins) // Starting second node. Ignite node2 = StartNode("Node2"); + int firstKey = 2000; int entryCnt = 1000; // Filling caches - for (int i = 0; i < entryCnt; i++) + for (int i = firstKey; i < firstKey + entryCnt; i++) { std::stringstream stream; stream << "A" << i; cache1.Put(i, QueryPerson(stream.str(), i * 10, MakeDateGmt(1970 + i), - MakeTimestampGmt(2016, 1, 1, i / 60, i % 60))); + MakeTimestampGmt(2016, 1, 1, (i / 60) % 24, i % 60))); cache2.Put(i + 1, QueryRelation(i, i * 10)); } @@ -1265,7 +1268,9 @@ BOOST_AUTO_TEST_CASE(TestSqlFieldsQueryDistributedJoins) "select age, name " "from \"QueryPerson\".QueryPerson " "inner join \"QueryRelation\".QueryRelation " - "on \"QueryPerson\".QueryPerson.age = \"QueryRelation\".QueryRelation.someVal"); + "on \"QueryPerson\".QueryPerson.age = \"QueryRelation\".QueryRelation.someVal " + "where (\"QueryPerson\".QueryPerson._key < 3000) and " + "(\"QueryPerson\".QueryPerson._key >= 2000)"); QueryFieldsCursor cursor = cache1.Query(qry); http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/Makefile.am ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/Makefile.am b/modules/platforms/cpp/odbc-test/Makefile.am index b025e2c..3e6467c 100644 --- a/modules/platforms/cpp/odbc-test/Makefile.am +++ b/modules/platforms/cpp/odbc-test/Makefile.am @@ -65,6 +65,7 @@ ignite_odbc_tests_SOURCES = \ src/meta_queries_test.cpp \ src/utility_test.cpp \ src/queries_test.cpp \ + src/queries_ssl_test.cpp \ src/test_utils.cpp \ src/sql_test_suite_fixture.cpp \ src/sql_string_functions_test.cpp \ http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/config/queries-default.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/queries-default.xml b/modules/platforms/cpp/odbc-test/config/queries-default.xml index 56040f1..dbe3a10 100644 --- a/modules/platforms/cpp/odbc-test/config/queries-default.xml +++ b/modules/platforms/cpp/odbc-test/config/queries-default.xml @@ -26,10 +26,18 @@ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> - <bean abstract="true" id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> + <bean abstract="true" id="queries.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> <property name="localHost" value="127.0.0.1"/> <property name="connectorConfiguration"><null/></property> + <property name="clientConnectorConfiguration"> + <bean class="org.apache.ignite.configuration.ClientConnectorConfiguration"> + <property name="host" value="127.0.0.1"/> + <property name="port" value="11110"/> + <property name="portRange" value="10"/> + </bean> + </property> + <property name="cacheConfiguration"> <list> <bean class="org.apache.ignite.configuration.CacheConfiguration"> http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/config/queries-ssl-32.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/queries-ssl-32.xml b/modules/platforms/cpp/odbc-test/config/queries-ssl-32.xml new file mode 100644 index 0000000..3fa2659 --- /dev/null +++ b/modules/platforms/cpp/odbc-test/config/queries-ssl-32.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans.xsd"> + + <import resource="queries-default.xml"/> + + <!-- + Initialize property configurer so we can reference environment variables. + --> + <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> + <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_FALLBACK"/> + <property name="searchSystemEnvironment" value="true"/> + </bean> + + <bean parent="queries.cfg"> + <property name="clientConnectorConfiguration"> + <bean class="org.apache.ignite.configuration.ClientConnectorConfiguration"> + <property name="host" value="127.0.0.1"/> + <property name="port" value="11110"/> + <property name="portRange" value="10"/> + <property name="sslEnabled" value="true"/> + <property name="useIgniteSslContextFactory" value="false"/> + <property name="sslClientAuth" value="true"/> + + <!-- Provide Ssl context. --> + <property name="sslContextFactory"> + <bean class="org.apache.ignite.ssl.SslContextFactory"> + <property name="keyStoreFilePath" value="${IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH}/ssl/server.jks"/> + <property name="keyStorePassword" value="123456"/> + <property name="trustStoreFilePath" value="${IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH}/ssl/trust.jks"/> + <property name="trustStorePassword" value="123456"/> + </bean> + </property> + </bean> + </property> + + <property name="memoryConfiguration"> + <bean class="org.apache.ignite.configuration.MemoryConfiguration"> + <property name="systemCacheInitialSize" value="#{40 * 1024 * 1024}"/> + <property name="systemCacheMaxSize" value="#{40 * 1024 * 1024}"/> + <property name="defaultMemoryPolicyName" value="dfltPlc"/> + + <property name="memoryPolicies"> + <list> + <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration"> + <property name="name" value="dfltPlc"/> + <property name="maxSize" value="#{100 * 1024 * 1024}"/> + <property name="initialSize" value="#{100 * 1024 * 1024}"/> + </bean> + </list> + </property> + </bean> + </property> + </bean> +</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/config/queries-ssl.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/queries-ssl.xml b/modules/platforms/cpp/odbc-test/config/queries-ssl.xml new file mode 100644 index 0000000..8e25b4c --- /dev/null +++ b/modules/platforms/cpp/odbc-test/config/queries-ssl.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:util="http://www.springframework.org/schema/util" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans.xsd"> + + <import resource="queries-default.xml"/> + + <!-- + Initialize property configurer so we can reference environment variables. + --> + <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> + <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_FALLBACK"/> + <property name="searchSystemEnvironment" value="true"/> + </bean> + + <bean parent="queries.cfg"> + <property name="clientConnectorConfiguration"> + <bean class="org.apache.ignite.configuration.ClientConnectorConfiguration"> + <property name="host" value="127.0.0.1"/> + <property name="port" value="11110"/> + <property name="portRange" value="10"/> + <property name="sslEnabled" value="true"/> + <property name="useIgniteSslContextFactory" value="false"/> + <property name="sslClientAuth" value="true"/> + + <!-- Provide Ssl context. --> + <property name="sslContextFactory"> + <bean class="org.apache.ignite.ssl.SslContextFactory"> + <property name="keyStoreFilePath" value="${IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH}/ssl/server.jks"/> + <property name="keyStorePassword" value="123456"/> + <property name="trustStoreFilePath" value="${IGNITE_NATIVE_TEST_ODBC_CONFIG_PATH}/ssl/trust.jks"/> + <property name="trustStorePassword" value="123456"/> + </bean> + </property> + </bean> + </property> + </bean> +</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/config/queries-test-32.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/queries-test-32.xml b/modules/platforms/cpp/odbc-test/config/queries-test-32.xml index f7d9ff4..a2bac82 100644 --- a/modules/platforms/cpp/odbc-test/config/queries-test-32.xml +++ b/modules/platforms/cpp/odbc-test/config/queries-test-32.xml @@ -24,8 +24,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - <!-- Imports no-ODBC Ignite configuration --> - <import resource="queries-test-default.xml"/> + <import resource="queries-default.xml"/> <bean parent="queries.cfg"> <property name="memoryConfiguration"> http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/config/queries-test-default.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/queries-test-default.xml b/modules/platforms/cpp/odbc-test/config/queries-test-default.xml deleted file mode 100644 index 22524d2..0000000 --- a/modules/platforms/cpp/odbc-test/config/queries-test-default.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:util="http://www.springframework.org/schema/util" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd"> - - <!-- Imports no-ODBC Ignite configuration --> - <import resource="queries-default.xml"/> - - <bean abstract="true" id="queries.cfg" parent="ignite.cfg"> - <property name="clientConnectorConfiguration"> - <bean class="org.apache.ignite.configuration.ClientConnectorConfiguration"> - <property name="host" value="127.0.0.1"/> - <property name="port" value="11110"/> - <property name="portRange" value="0"/> - </bean> - </property> - </bean> -</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/config/queries-test-noodbc-32.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/queries-test-noodbc-32.xml b/modules/platforms/cpp/odbc-test/config/queries-test-noodbc-32.xml deleted file mode 100644 index b98d668..0000000 --- a/modules/platforms/cpp/odbc-test/config/queries-test-noodbc-32.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:util="http://www.springframework.org/schema/util" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd"> - - <!-- Imports no-ODBC Ignite configuration --> - <import resource="queries-default.xml"/> - - <bean parent="ignite.cfg"> - <property name="clientConnectorConfiguration"> - <null/> - </property> - - <property name="memoryConfiguration"> - <bean class="org.apache.ignite.configuration.MemoryConfiguration"> - <property name="systemCacheInitialSize" value="#{40 * 1024 * 1024}"/> - <property name="systemCacheMaxSize" value="#{40 * 1024 * 1024}"/> - <property name="defaultMemoryPolicyName" value="dfltPlc"/> - - <property name="memoryPolicies"> - <list> - <bean class="org.apache.ignite.configuration.MemoryPolicyConfiguration"> - <property name="name" value="dfltPlc"/> - <property name="maxSize" value="#{100 * 1024 * 1024}"/> - <property name="initialSize" value="#{100 * 1024 * 1024}"/> - </bean> - </list> - </property> - </bean> - </property> - </bean> -</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/config/queries-test-noodbc.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/queries-test-noodbc.xml b/modules/platforms/cpp/odbc-test/config/queries-test-noodbc.xml deleted file mode 100644 index 29fee23..0000000 --- a/modules/platforms/cpp/odbc-test/config/queries-test-noodbc.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:util="http://www.springframework.org/schema/util" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd"> - - <!-- Imports no-ODBC Ignite configuration --> - <import resource="queries-default.xml"/> - - <bean parent="ignite.cfg"> - <property name="clientConnectorConfiguration"> - <null/> - </property> - </bean> -</beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/config/queries-test.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/queries-test.xml b/modules/platforms/cpp/odbc-test/config/queries-test.xml index 882eb1e..46e89aa 100644 --- a/modules/platforms/cpp/odbc-test/config/queries-test.xml +++ b/modules/platforms/cpp/odbc-test/config/queries-test.xml @@ -24,8 +24,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - <!-- Imports no-ODBC Ignite configuration --> - <import resource="queries-test-default.xml"/> + <import resource="queries-default.xml"/> <bean parent="queries.cfg"/> </beans> http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/config/ssl/ca.pem ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/ssl/ca.pem b/modules/platforms/cpp/odbc-test/config/ssl/ca.pem new file mode 100644 index 0000000..10bf7af --- /dev/null +++ b/modules/platforms/cpp/odbc-test/config/ssl/ca.pem @@ -0,0 +1,24 @@ +-----BEGIN TRUSTED CERTIFICATE----- +MIID8DCCAtgCCQCo436SJYMUcjANBgkqhkiG9w0BAQsFADCBuTELMAkGA1UEBhMC +UlUxGTAXBgNVBAgMEFNhaW50LVBldGVyc2J1cmcxGTAXBgNVBAcMEFNhaW50LVBl +dGVyc2J1cmcxIzAhBgNVBAoMGkFwYWNoZSBTcGZ0d2FyZSBGb3VuZGF0aW9uMRYw +FAYDVQQLDA1BcGFjaGUgSWduaXRlMRQwEgYDVQQDDAtJZ29yIFNhcGVnbzEhMB8G +CSqGSIb3DQEJARYSaXNhcGVnb0BhcGFjaGUub3JnMB4XDTE3MTEyODE3MzExNloX +DTI3MTEyNjE3MzExNlowgbkxCzAJBgNVBAYTAlJVMRkwFwYDVQQIDBBTYWludC1Q +ZXRlcnNidXJnMRkwFwYDVQQHDBBTYWludC1QZXRlcnNidXJnMSMwIQYDVQQKDBpB +cGFjaGUgU3BmdHdhcmUgRm91bmRhdGlvbjEWMBQGA1UECwwNQXBhY2hlIElnbml0 +ZTEUMBIGA1UEAwwLSWdvciBTYXBlZ28xITAfBgkqhkiG9w0BCQEWEmlzYXBlZ29A +YXBhY2hlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALMcDfYN +Ixc0o4bLX/3T5MQE4pk+Bv9Dfr7vBYNPJKSr/GKQJN+5QA/tr1uxTsMSBoE19y5e +N1vXFtlWMJ2um3ojNbGeqSGuzuDKk0htbgmisyctvEFTqtiYI7D+f7dalEM2KnLj +f0jIV6NJVilkFKmgsfuZpbZFRkqJDEx74ZqNAYQQ0qJ+zGv7diEak8FwWa4n6xe7 +VHt7VZIbKIkMgTljJLULbExxCRvTHpSeXPP5IMr5x1RGuSavCu4GDl+HmrXac7ot +L7sqIFHL9JGXTWO16accOQnQIdLQmhj6qh2Em8z41udabzUyIQmOSP6mmwnJEIdz +jNyWLA8XtYZOgcsCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAT6jBgiQjCdQ02cxe +H9YDFw5+cfb6YQJcjJW94BspySftUGfJ6GQm/Ybcc/ZqW7lhEILKfifdpHPfWby/ +sqhwA0nsLt5hNCjMsDcBq5onggy9ymZYak0VVWT/XkHiK27sQLK6BXo6wqRDwT4h +F9CgUWNcLGDVAaVpjLaR8itZZgx98q9MAZ680oERUZWTsj17oO0RK/x9TBWUm7OR +f9g9VNRz3mwT5dTtuqrSq4NlF1nVD7BN3lRddZUW4KnU6et2mXtIKMnUT/+XyIW3 +g+f6LuhR+Q6yhmVdfBVa8opJQIR5trb0eKnQf4pEQcvT/EX+vWkThNJkdZ4qm0mY +eIl/jQ== +-----END TRUSTED CERTIFICATE----- http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/config/ssl/client_full.pem ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/ssl/client_full.pem b/modules/platforms/cpp/odbc-test/config/ssl/client_full.pem new file mode 100644 index 0000000..9a54f43 --- /dev/null +++ b/modules/platforms/cpp/odbc-test/config/ssl/client_full.pem @@ -0,0 +1,84 @@ +Bag Attributes + friendlyName: client + localKeyID: 54 69 6D 65 20 31 35 31 31 39 36 35 31 38 31 32 33 37 +Key Attributes: <No Attributes> +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAmm+QSwc1yvJWjTG8L4rAiHOg38rM1AtOFInzYizT/B6wzsmx +3Ql4fb+aHm3dPt5kjhQLZToq1QCUsS9B/47ZFd0waDHGgLiSNKn1WdX7Q+4GgplY +wznc5j+GM65F2aI3tRnn2Jorfss9OElzU5vLh0aD3e5cEpgYSAGEFl1O9t8b6dHq +YMERtdTCNQVeBUQPiaNNTwOXixtdsPvGKNgMZtVpvV+AMlgVmV+VTYUqQhlX+ro4 +9E4n00+iDIk/REwAiQi/Kb08kovLY9sF2pqC24zU5swyIopEijoa6Z2WYekq1fyL +P9NknOiMOmWaKqu5ThVbP6c2xGeCdAGbNi+74wIDAQABAoIBAH2oALPLbg1vGNVR +flkAgJ+F1YPBst9lQ2aayBk9eE5PenUGz12V8x/94hyYL8iTkyW3UX5P0cH18wYn ++X9Cb4fGrThaJ7VceDm5gBRUc1lWNp3Uv9A5KG9/iGZMijEGOGV2appm9rT4ERvX +R6rjvLqYuXq+EtReRINyGFNKIJHkuwM7Ycy9Rk7O6SrcjjUEj1Z5gEUP0B7Z0jVI +bsOGqghRflRVqnFT61+koFWBn8taemWmXNa835beN2lRIWezNqfd+9kL72UUt6sl +VmkqBydDQ+IXCOgLZDYUu3N0bfrKuYmilsRg9XuKTUv+jvwtfGUWTO1+6eSrFD+B +3j0YeKECgYEA0XrsUOGVl2O4JWBOa36TRHMz0tRBrZUJMK7apEEiGx7jc7q22PI+ +RyPrf9TR7JOLN1AdXoHrJsKCadnTr6g/CAOZSV1V+lUeQkcDmG4OkY814fESxlBA +jHg7FnJdjzs6VfA1Cv0eT2KxU0ld461AN77WBgG21E2Gw3AGSddbflcCgYEAvLtV +fhy3+WOUutFsLv1uTz/y+Emih6pmgwsuRG7WgQD9s2KZS+ejh5TQAq4sD+9MSkKk +XnvdbwGQkHppdtVP5wMeSfY6tG/9YmY7X5rTG9PTsrzAzNJwrnE9hFv7Xnj3SMnC +0D9eBnA8XWq49vsair7gxBWwhGYR/5WDicGn31UCgYEAgJb6lbPEhkgadCcoPGhY +sn4dY+AT6SBBofbUFFw/OXK+oP4O3CHoBPeRysizjIwNu4icXrVVyldAgwXKIlwf +RSYgZJ689oxlpL2/AUUeAFBu/SFlKwN8fD4Z12+g6xmqd7KafQJgJs8olz3EOszR +TOcCrnFC8BQfE72ivpVKfsUCgYBBZw3maR9cHiUxZFeAJTTv47JYVnQrXWKu8NX0 +wxA0nlpMqtOC2V/zIR/Afgko8H1YkqWRVI1U5Y7qcnFPy/YnkQ4TBXAsjU6apeDX +bbjQwORw4TZTBG4mFXoC/zkp8POI1tpa/kqgIo7YtJ4qgLQe9qy/ZuDH0PNVxcNS +nriFDQKBgF70vrmuYEobLpBD/whcOqMDjn3Zj+xx3TSRmjmjc4w5eRR4+9iquKs5 +lhY1NsAcq3SYA8P5rNDV39FpiPErFqDTjsf0AaOXbpaqo2jOANmvyT15CKW8325R +yEcxaA8sSbBaz8QRkydzpoKT+4WFJnYzCZtG+kUU+Pgu6uahAs4N +-----END RSA PRIVATE KEY----- +Bag Attributes + friendlyName: client + localKeyID: 54 69 6D 65 20 31 35 31 31 39 36 35 31 38 31 32 33 37 +subject=/CN=ODBC +issuer=/C=RU/ST=Saint-Petersburg/L=Saint-Petersburg/O=Apache Spftware Foundation/OU=Apache Ignite/CN=Igor Sapego/[email protected] +-----BEGIN CERTIFICATE----- +MIIDPTCCAiUCAQIwDQYJKoZIhvcNAQEFBQAwgbkxCzAJBgNVBAYTAlJVMRkwFwYD +VQQIDBBTYWludC1QZXRlcnNidXJnMRkwFwYDVQQHDBBTYWludC1QZXRlcnNidXJn +MSMwIQYDVQQKDBpBcGFjaGUgU3BmdHdhcmUgRm91bmRhdGlvbjEWMBQGA1UECwwN +QXBhY2hlIElnbml0ZTEUMBIGA1UEAwwLSWdvciBTYXBlZ28xITAfBgkqhkiG9w0B +CQEWEmlzYXBlZ29AYXBhY2hlLm9yZzAeFw0xNzExMjkxNDAwNDhaFw0yNzExMjcx +NDAwNDhaMA8xDTALBgNVBAMTBE9EQkMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQCab5BLBzXK8laNMbwvisCIc6DfyszUC04UifNiLNP8HrDOybHdCXh9 +v5oebd0+3mSOFAtlOirVAJSxL0H/jtkV3TBoMcaAuJI0qfVZ1ftD7gaCmVjDOdzm +P4YzrkXZoje1GefYmit+yz04SXNTm8uHRoPd7lwSmBhIAYQWXU723xvp0epgwRG1 +1MI1BV4FRA+Jo01PA5eLG12w+8Yo2Axm1Wm9X4AyWBWZX5VNhSpCGVf6ujj0TifT +T6IMiT9ETACJCL8pvTySi8tj2wXamoLbjNTmzDIiikSKOhrpnZZh6SrV/Is/02Sc +6Iw6ZZoqq7lOFVs/pzbEZ4J0AZs2L7vjAgMBAAEwDQYJKoZIhvcNAQEFBQADggEB +AH8heMPYkC/abqg9xtC5WFgYxnXWA6jwjKVuCSnrEhZGQem9HFvFXmZckJr25RXc +9i8WIehN5oeJgmPioK6j8ylwCJxo9lRii4NFBVpS6IjmqMdYHa+4K1R9Y7XdDEBL +nVzlL8Hjlv4ESjg+1LW4nSt8f4oBdAvfds4uNTtAwABqmfqXWaOKYdh9OJs84QJa +pA4PQvxqUz6c4tyPi/VucVAV8uKxR7P+uoy6qKKZK6NkY3RuXwHXxJ5lDr6ET1mb +St0BbAt4KSktPonCu0qoHWqcynw79KcoPhmQWpzbijVs+y/SlHmZje+H4R7j7xt7 +aw7dWxUa096x4vsi1WvlMOY= +-----END CERTIFICATE----- +Bag Attributes + friendlyName: 1.2.840.113549.1.9.1=#16126973617065676f406170616368652e6f7267,CN=Igor Sapego,OU=Apache Ignite,O=Apache Spftware Foundation,L=Saint-Petersburg,ST=Saint-Petersburg,C=RU +subject=/C=RU/ST=Saint-Petersburg/L=Saint-Petersburg/O=Apache Spftware Foundation/OU=Apache Ignite/CN=Igor Sapego/[email protected] +issuer=/C=RU/ST=Saint-Petersburg/L=Saint-Petersburg/O=Apache Spftware Foundation/OU=Apache Ignite/CN=Igor Sapego/[email protected] +-----BEGIN CERTIFICATE----- +MIID8DCCAtgCCQCo436SJYMUcjANBgkqhkiG9w0BAQsFADCBuTELMAkGA1UEBhMC +UlUxGTAXBgNVBAgMEFNhaW50LVBldGVyc2J1cmcxGTAXBgNVBAcMEFNhaW50LVBl +dGVyc2J1cmcxIzAhBgNVBAoMGkFwYWNoZSBTcGZ0d2FyZSBGb3VuZGF0aW9uMRYw +FAYDVQQLDA1BcGFjaGUgSWduaXRlMRQwEgYDVQQDDAtJZ29yIFNhcGVnbzEhMB8G +CSqGSIb3DQEJARYSaXNhcGVnb0BhcGFjaGUub3JnMB4XDTE3MTEyODE3MzExNloX +DTI3MTEyNjE3MzExNlowgbkxCzAJBgNVBAYTAlJVMRkwFwYDVQQIDBBTYWludC1Q +ZXRlcnNidXJnMRkwFwYDVQQHDBBTYWludC1QZXRlcnNidXJnMSMwIQYDVQQKDBpB +cGFjaGUgU3BmdHdhcmUgRm91bmRhdGlvbjEWMBQGA1UECwwNQXBhY2hlIElnbml0 +ZTEUMBIGA1UEAwwLSWdvciBTYXBlZ28xITAfBgkqhkiG9w0BCQEWEmlzYXBlZ29A +YXBhY2hlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALMcDfYN +Ixc0o4bLX/3T5MQE4pk+Bv9Dfr7vBYNPJKSr/GKQJN+5QA/tr1uxTsMSBoE19y5e +N1vXFtlWMJ2um3ojNbGeqSGuzuDKk0htbgmisyctvEFTqtiYI7D+f7dalEM2KnLj +f0jIV6NJVilkFKmgsfuZpbZFRkqJDEx74ZqNAYQQ0qJ+zGv7diEak8FwWa4n6xe7 +VHt7VZIbKIkMgTljJLULbExxCRvTHpSeXPP5IMr5x1RGuSavCu4GDl+HmrXac7ot +L7sqIFHL9JGXTWO16accOQnQIdLQmhj6qh2Em8z41udabzUyIQmOSP6mmwnJEIdz +jNyWLA8XtYZOgcsCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAT6jBgiQjCdQ02cxe +H9YDFw5+cfb6YQJcjJW94BspySftUGfJ6GQm/Ybcc/ZqW7lhEILKfifdpHPfWby/ +sqhwA0nsLt5hNCjMsDcBq5onggy9ymZYak0VVWT/XkHiK27sQLK6BXo6wqRDwT4h +F9CgUWNcLGDVAaVpjLaR8itZZgx98q9MAZ680oERUZWTsj17oO0RK/x9TBWUm7OR +f9g9VNRz3mwT5dTtuqrSq4NlF1nVD7BN3lRddZUW4KnU6et2mXtIKMnUT/+XyIW3 +g+f6LuhR+Q6yhmVdfBVa8opJQIR5trb0eKnQf4pEQcvT/EX+vWkThNJkdZ4qm0mY +eIl/jQ== +-----END CERTIFICATE----- http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/config/ssl/client_unknown.pem ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/ssl/client_unknown.pem b/modules/platforms/cpp/odbc-test/config/ssl/client_unknown.pem new file mode 100644 index 0000000..b9a8e43 --- /dev/null +++ b/modules/platforms/cpp/odbc-test/config/ssl/client_unknown.pem @@ -0,0 +1,50 @@ +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC0HaDP3KkkgcT7 +3FWWxXEgiT5vAsW+ZByiWg5Yh5XtU7rAjiXT9VmOm1h/5GNdngF7ofhT+qal1k8W +yiLsbqWL6qYXkc0e8aKw9ciBaWDWDkgXNnV03butu70hNvm/fzYp/6/WQ5SXUJdm +mJZyeVjgU4NXnOe0lv2PlzUr5q1yjJCSnTbsHBvs0qfoy7DYqPQFbrwiuIOeYtVg +mjjL/y6SUCY/uNY8McLG0YFubNsnOCEIyZOgAM1RdmARt+iYZuLVZkicgkaxYtLB +pbUB8K2Y/A+0WjL7JceZVWbUaQKkDncegccMmHzEOBsJyLRWu+/5ztan7xh+jIGd +vtlgoz8/AgMBAAECggEBAKx4TnucHW7ywFA3/NEBwUDZiqo8KmQUcwLXXzNQqbT2 +3zXxJ7HeF2KhyE22wZtsaJkdULABrL/SBiuZZXWmwejHyUF6gMMnuJTg1Z1t7acr +R8bKhBBjHorO4dzDSsUfKBtxVcvDLK70IfXBGRcGsZ8k+PjVK15W0vhDX0vpeJ7c +9E6FS+Kfz31d8/xLETF3QdevfPTTMliakL0Tr37NKefdGXU8O07tvL/Chq40VWzl +KqdU0ti+mI18fNsTgpe16JLvEpQBQ1ZRm/ip5ZJPkPloZn7sP7KIpmZOuMplbYlJ +ZyINe+OKOLB8/65XK8eqwgEyQQi9Iq7/2bWgMbZKP8ECgYEA54ysuNUEVtwhmcXK +CGiTfuCqguvKmaFraenoCxvf+aY3TU7dguA8soI+yQraqt9nW1fqrMEOnzr/mEFI +3NE81k3uWLPdcbk/sPKKI2iQqkmlCR7XQYch0Kq2KZ3A4kXvT0M6njBb/8UFtSai +dWiit9/9c40PGUA28+dYCSnnn2ECgYEAxyKT/+hrCHauj7Enz2jqIBsIJGRq6bc0 +rZZf4yoQO4wJTs7zTUa3REYHQOGYM/zb6BkmO5SaHiUxwrAvWi+3UvSwzSC7SZEw +2Ym8FRFZLcjG2n9CeHK4jcp8kXnoeoKnD9K9ztQszmjl+YJ5LLAXEQuXlwG0ZSld +Nz2OHuHYgp8CgYEAnrJequtsZu/Go7LYzjyGYp4unz5mBDeK+/NRk1OOhXczTevw +i8OONjZoO7gRuK0XFJbEA5TppZ51EXAlNRq/HI4a/naAHnJ9wZPps2z2QY/p6b9W +ftXUCkUGRq2VRj/yTZvhMAwq8biiOc7554hIhceh2TFjmMXXJAF56AXtduECgYA6 +Y1kh3/QCN0pXt4oEtq5vW323rfnrLVy0yTK0WNEJpLXV9bhBIEr8KcxWqc8G701L +cJRVQ+0siZtdimtX9kW6fSSaAM7pczjvkAMl6kBLvGMSDd5fksOqT4TW4vfXdBen +/BLLYksA+qDz193PzJH23X9FN6q9PrOmTtYtF+tz4QKBgQDeUhgpylS0sjTzS36b +8V86DJ4mj22B7H6jp826Y696V79a2/jSacs1KKExOYXeJBUdhDoutVS0PiT10br9 +lSIKiExbrddmBUd5OEtZKz1bXqRoMZlAvjuOhqadU0DciSQjiZ8CSmSzCX31++7G +velIMG6xcMV3LKtY4dr7B6KuiA== +-----END PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIIDoTCCAomgAwIBAgIJAJy64S/DycmkMA0GCSqGSIb3DQEBCwUAMGcxCzAJBgNV +BAYTAlJVMRkwFwYDVQQIDBBTYWludCBQZXRlcnNidXJnMRkwFwYDVQQHDBBTYWlu +dCBQZXRlcnNidXJnMRAwDgYDVQQKDAdVbmtub3duMRAwDgYDVQQDDAdVbmtub3du +MB4XDTE4MDEyNDEwMTUwNFoXDTE5MDEyNDEwMTUwNFowZzELMAkGA1UEBhMCUlUx +GTAXBgNVBAgMEFNhaW50IFBldGVyc2J1cmcxGTAXBgNVBAcMEFNhaW50IFBldGVy +c2J1cmcxEDAOBgNVBAoMB1Vua25vd24xEDAOBgNVBAMMB1Vua25vd24wggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC0HaDP3KkkgcT73FWWxXEgiT5vAsW+ +ZByiWg5Yh5XtU7rAjiXT9VmOm1h/5GNdngF7ofhT+qal1k8WyiLsbqWL6qYXkc0e +8aKw9ciBaWDWDkgXNnV03butu70hNvm/fzYp/6/WQ5SXUJdmmJZyeVjgU4NXnOe0 +lv2PlzUr5q1yjJCSnTbsHBvs0qfoy7DYqPQFbrwiuIOeYtVgmjjL/y6SUCY/uNY8 +McLG0YFubNsnOCEIyZOgAM1RdmARt+iYZuLVZkicgkaxYtLBpbUB8K2Y/A+0WjL7 +JceZVWbUaQKkDncegccMmHzEOBsJyLRWu+/5ztan7xh+jIGdvtlgoz8/AgMBAAGj +UDBOMB0GA1UdDgQWBBSmehz8ReTNQ6IQmMBXhns97I3U6jAfBgNVHSMEGDAWgBSm +ehz8ReTNQ6IQmMBXhns97I3U6jAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUA +A4IBAQAjtzZtXSqIrWJfCJCp0Kal/swR9EDIhvdZNpH3VJMUKENRPKZF2AdlGLwx +sSAL6oUkCjew3NC4UM7CH1LZR+RZOQXhLxh+xmlIUDJukjftPcEAXAymCJyEShjD +qr/YH3SrrVfzf/ViZOa3YrlWXuP9WqEYYAMJcNmgl2A1vhpIwrF0+GLrvnUV2E6a +qHqBmA8GforiiOye+TQKNuFCgd+m8nr3AUCBaY2aVgFBg5Z2uumMzx5qmejQIdDr +tiKsr7+QiaY97lXIThMCDxPt63Jk2uO9yUJZSzDJlY2JHuRnMmyO+TnVrUAyCr60 +dBkPpbvH/kMPPFkOhDk6e40YvqWY +-----END CERTIFICATE----- http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/config/ssl/server.jks ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/ssl/server.jks b/modules/platforms/cpp/odbc-test/config/ssl/server.jks new file mode 100644 index 0000000..2632662 Binary files /dev/null and b/modules/platforms/cpp/odbc-test/config/ssl/server.jks differ http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/config/ssl/trust.jks ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/ssl/trust.jks b/modules/platforms/cpp/odbc-test/config/ssl/trust.jks new file mode 100644 index 0000000..a0f3bcf Binary files /dev/null and b/modules/platforms/cpp/odbc-test/config/ssl/trust.jks differ http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/include/odbc_test_suite.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/include/odbc_test_suite.h b/modules/platforms/cpp/odbc-test/include/odbc_test_suite.h index f79d65f..c535679 100644 --- a/modules/platforms/cpp/odbc-test/include/odbc_test_suite.h +++ b/modules/platforms/cpp/odbc-test/include/odbc_test_suite.h @@ -29,9 +29,6 @@ #include "ignite/ignite.h" -#include "test_type.h" -#include "complex_type.h" - namespace ignite { namespace odbc @@ -42,6 +39,11 @@ namespace ignite struct OdbcTestSuite { /** + * Prepare environment. + */ + void Prepare(); + + /** * Establish connection to node. * * @param connectStr Connection string. http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/include/test_utils.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/include/test_utils.h b/modules/platforms/cpp/odbc-test/include/test_utils.h index e65e187..786c2be 100644 --- a/modules/platforms/cpp/odbc-test/include/test_utils.h +++ b/modules/platforms/cpp/odbc-test/include/test_utils.h @@ -68,6 +68,11 @@ namespace ignite_test std::string GetOdbcErrorMessage(SQLSMALLINT handleType, SQLHANDLE handle); /** + * @return Test config directory path. + */ + std::string GetTestConfigDir(); + + /** * Initialize configuration for a node. * * Inits Ignite node configuration from specified config file. http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj index d565306..b1074b2 100644 --- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj +++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj @@ -91,9 +91,10 @@ <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\src;$(BOOST_HOME)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\src;$(BOOST_HOME);$(OPENSSL_HOME)\include</AdditionalIncludeDirectories> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;IGNITE_IMPL;IGNITE_FRIEND;IGNITE_TESTS_32;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling>Async</ExceptionHandling> + <WholeProgramOptimization>false</WholeProgramOptimization> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> @@ -105,7 +106,7 @@ <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\src;$(BOOST_HOME)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\src;$(BOOST_HOME);$(OPENSSL_HOME)\include</AdditionalIncludeDirectories> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;IGNITE_IMPL;IGNITE_FRIEND;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling>Async</ExceptionHandling> </ClCompile> @@ -122,7 +123,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\src;$(BOOST_HOME)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\src;$(BOOST_HOME);$(OPENSSL_HOME)\include</AdditionalIncludeDirectories> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;IGNITE_IMPL;IGNITE_FRIEND;IGNITE_TESTS_32;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling>Async</ExceptionHandling> </ClCompile> @@ -140,7 +141,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\src;$(BOOST_HOME)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\jni\include;$(ProjectDir)\..\..\..\jni\os\win\include;$(ProjectDir)\..\..\..\binary\include;$(ProjectDir)\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\odbc\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\src;$(BOOST_HOME);$(OPENSSL_HOME)\include</AdditionalIncludeDirectories> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;IGNITE_IMPL;IGNITE_FRIEND;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling>Async</ExceptionHandling> </ClCompile> @@ -172,6 +173,7 @@ <ClCompile Include="..\..\src\errors_test.cpp" /> <ClCompile Include="..\..\src\meta_queries_test.cpp" /> <ClCompile Include="..\..\src\odbc_test_suite.cpp" /> + <ClCompile Include="..\..\src\queries_ssl_test.cpp" /> <ClCompile Include="..\..\src\queries_test.cpp" /> <ClCompile Include="..\..\src\parser_test.cpp" /> <ClCompile Include="..\..\src\row_test.cpp" /> @@ -217,9 +219,8 @@ </ItemGroup> <ItemGroup> <None Include="..\..\config\queries-default.xml" /> - <None Include="..\..\config\queries-test-noodbc-32.xml" /> - <None Include="..\..\config\queries-test-noodbc.xml" /> - <None Include="..\..\config\queries-test-default.xml" /> + <None Include="..\..\config\queries-ssl-32.xml" /> + <None Include="..\..\config\queries-ssl.xml" /> <None Include="..\..\config\queries-test-32.xml" /> <None Include="..\..\config\queries-test.xml" /> </ItemGroup> http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters index 58cf045..417fac9 100644 --- a/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters +++ b/modules/platforms/cpp/odbc-test/project/vs/odbc-test.vcxproj.filters @@ -139,6 +139,9 @@ <ClCompile Include="..\..\src\odbc_test_suite.cpp"> <Filter>Code</Filter> </ClCompile> + <ClCompile Include="..\..\src\queries_ssl_test.cpp"> + <Filter>Code</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\include\test_type.h"> @@ -167,17 +170,14 @@ <None Include="..\..\config\queries-test.xml"> <Filter>Configs</Filter> </None> - <None Include="..\..\config\queries-test-noodbc-32.xml"> - <Filter>Configs</Filter> - </None> - <None Include="..\..\config\queries-test-noodbc.xml"> + <None Include="..\..\config\queries-default.xml"> <Filter>Configs</Filter> </None> - <None Include="..\..\config\queries-default.xml"> + <None Include="..\..\config\queries-ssl.xml"> <Filter>Configs</Filter> </None> - <None Include="..\..\config\queries-test-default.xml"> + <None Include="..\..\config\queries-ssl-32.xml"> <Filter>Configs</Filter> </None> </ItemGroup> -</Project> \ No newline at end of file +</Project> http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp b/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp index c17e079..293d8bc 100644 --- a/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/api_robustness_test.cpp @@ -37,6 +37,7 @@ #include "test_type.h" #include "test_utils.h" +#include "odbc_test_suite.h" using namespace ignite; using namespace ignite::cache; @@ -51,98 +52,21 @@ using ignite::impl::binary::BinaryUtils; /** * Test setup fixture. */ -struct ApiRobustnessTestSuiteFixture +struct ApiRobustnessTestSuiteFixture : public odbc::OdbcTestSuite { - void Prepare() - { - // Allocate an environment handle - SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); - - BOOST_REQUIRE(env != NULL); - - // We want ODBC 3 support - SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, reinterpret_cast<void*>(SQL_OV_ODBC3), 0); - - // Allocate a connection handle - SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc); - - BOOST_REQUIRE(dbc != NULL); - } - - /** - * Establish connection to node. - * - * @param connectStr Connection string. - */ - void Connect(const std::string& connectStr) - { - Prepare(); - - // Connect string - std::vector<SQLCHAR> connectStr0; - - connectStr0.reserve(connectStr.size() + 1); - std::copy(connectStr.begin(), connectStr.end(), std::back_inserter(connectStr0)); - - SQLCHAR outstr[ODBC_BUFFER_SIZE]; - SQLSMALLINT outstrlen; - - // Connecting to ODBC server. - SQLRETURN ret = SQLDriverConnect(dbc, NULL, &connectStr0[0], static_cast<SQLSMALLINT>(connectStr0.size()), - outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_COMPLETE); - - ODBC_FAIL_ON_ERROR(ret, SQL_HANDLE_DBC, dbc); - - // Allocate a statement handle - SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt); - - BOOST_REQUIRE(stmt != NULL); - } - - void Disconnect() - { - // Releasing statement handle. - SQLFreeHandle(SQL_HANDLE_STMT, stmt); - - // Disconneting from the server. - SQLDisconnect(dbc); - - // Releasing allocated handles. - SQLFreeHandle(SQL_HANDLE_DBC, dbc); - SQLFreeHandle(SQL_HANDLE_ENV, env); - } - static Ignite StartAdditionalNode(const char* name) { - const char* config = NULL; - -#ifdef IGNITE_TESTS_32 - config = "queries-test-noodbc-32.xml"; -#else - config = "queries-test-noodbc.xml"; -#endif - - return StartNode(config, name); + return StartTestNode("queries-test.xml", name); } /** * Constructor. */ ApiRobustnessTestSuiteFixture() : - testCache(0), - env(NULL), - dbc(NULL), - stmt(NULL) + grid(), + testCache(0) { - const char* config = NULL; - -#ifdef IGNITE_TESTS_32 - config = "queries-test-32.xml"; -#else - config = "queries-test.xml"; -#endif - - grid = StartNode(config, "NodeMain"); + grid = StartAdditionalNode("NodeMain"); testCache = grid.GetCache<int64_t, TestType>("cache"); } @@ -227,9 +151,7 @@ struct ApiRobustnessTestSuiteFixture */ ~ApiRobustnessTestSuiteFixture() { - Disconnect(); - - Ignition::StopAll(true); + // No-op. } /** Node started during the test. */ @@ -237,15 +159,6 @@ struct ApiRobustnessTestSuiteFixture /** Test cache instance. */ Cache<int64_t, TestType> testCache; - - /** ODBC Environment. */ - SQLHENV env; - - /** ODBC Connect. */ - SQLHDBC dbc; - - /** ODBC Statement. */ - SQLHSTMT stmt; }; SQLSMALLINT unsupportedC[] = { http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/src/errors_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/errors_test.cpp b/modules/platforms/cpp/odbc-test/src/errors_test.cpp index bac9fd4..9c640ba 100644 --- a/modules/platforms/cpp/odbc-test/src/errors_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/errors_test.cpp @@ -42,6 +42,7 @@ #include "test_type.h" #include "complex_type.h" #include "test_utils.h" +#include "odbc_test_suite.h" using namespace ignite; using namespace ignite::cache; @@ -59,83 +60,18 @@ using ignite::impl::binary::BinaryUtils; /** * Test setup fixture. */ -struct ErrorTestSuiteFixture +struct ErrorTestSuiteFixture : odbc::OdbcTestSuite { - /** - * Establish connection to node. - * - * @param connectStr Connection string. - */ - void Connect(const std::string& connectStr) - { - // Allocate an environment handle - SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); - - BOOST_REQUIRE(env != NULL); - - // We want ODBC 3 support - SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, reinterpret_cast<void*>(SQL_OV_ODBC3), 0); - - // Allocate a connection handle - SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc); - - BOOST_REQUIRE(dbc != NULL); - - // Connect string - std::vector<SQLCHAR> connectStr0; - - connectStr0.reserve(connectStr.size() + 1); - std::copy(connectStr.begin(), connectStr.end(), std::back_inserter(connectStr0)); - - SQLCHAR outstr[ODBC_BUFFER_SIZE]; - SQLSMALLINT outstrlen; - - // Connecting to ODBC server. - SQLRETURN ret = SQLDriverConnect(dbc, NULL, &connectStr0[0], static_cast<SQLSMALLINT>(connectStr0.size()), - outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_COMPLETE); - - if (!SQL_SUCCEEDED(ret)) - { - Ignition::StopAll(true); - - BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_DBC, dbc)); - } - - // Allocate a statement handle - SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt); - - BOOST_REQUIRE(stmt != NULL); - } - - void Disconnect() - { - // Releasing statement handle. - SQLFreeHandle(SQL_HANDLE_STMT, stmt); - - // Disconneting from the server. - SQLDisconnect(dbc); - - // Releasing allocated handles. - SQLFreeHandle(SQL_HANDLE_DBC, dbc); - SQLFreeHandle(SQL_HANDLE_ENV, env); - } - static Ignite StartAdditionalNode(const char* name) { -#ifdef IGNITE_TESTS_32 - return StartNode("queries-test-32.xml", name); -#else - return StartNode("queries-test.xml", name); -#endif + return StartTestNode("queries-test.xml", name); } /** * Constructor. */ ErrorTestSuiteFixture() : - env(NULL), - dbc(NULL), - stmt(NULL) + OdbcTestSuite() { // No-op. } @@ -145,22 +81,8 @@ struct ErrorTestSuiteFixture */ ~ErrorTestSuiteFixture() { - Disconnect(); - - Ignition::StopAll(true); + // No-op. } - - /** Frist cache instance. */ - //Cache<int64_t, TestType> cache; - - /** ODBC Environment. */ - SQLHENV env; - - /** ODBC Connect. */ - SQLHDBC dbc; - - /** ODBC Statement. */ - SQLHSTMT stmt; }; BOOST_FIXTURE_TEST_SUITE(ErrorTestSuite, ErrorTestSuiteFixture) @@ -181,7 +103,7 @@ BOOST_AUTO_TEST_CASE(TestConnectFail) BOOST_REQUIRE(dbc != NULL); // Connect string - SQLCHAR connectStr[] = "DRIVER={Apache Ignite};ADDRESS=127.0.0.1:9999;SCHEMA=cache"; + SQLCHAR connectStr[] = "DRIVER={Apache Ignite};ADDRESS=127.0.0.1:1111;SCHEMA=cache"; SQLCHAR outstr[ODBC_BUFFER_SIZE]; SQLSMALLINT outstrlen; http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/src/meta_queries_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/meta_queries_test.cpp b/modules/platforms/cpp/odbc-test/src/meta_queries_test.cpp index ba9fd04..8e22e3d 100644 --- a/modules/platforms/cpp/odbc-test/src/meta_queries_test.cpp +++ b/modules/platforms/cpp/odbc-test/src/meta_queries_test.cpp @@ -40,6 +40,7 @@ #include "test_type.h" #include "complex_type.h" #include "test_utils.h" +#include "odbc_test_suite.h" using namespace ignite; using namespace ignite::cache; @@ -55,82 +56,16 @@ using namespace boost::unit_test; /** * Test setup fixture. */ -struct MetaQueriesTestSuiteFixture +struct MetaQueriesTestSuiteFixture : public odbc::OdbcTestSuite { /** - * Establish connection to node. - * - * @param connectStr Connection string. - */ - void Connect(const std::string& connectStr) - { - // Allocate an environment handle - SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); - - BOOST_REQUIRE(env != NULL); - - // We want ODBC 3 support - SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, reinterpret_cast<void*>(SQL_OV_ODBC3), 0); - - // Allocate a connection handle - SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc); - - BOOST_REQUIRE(dbc != NULL); - - // Connect string - std::vector<SQLCHAR> connectStr0; - - connectStr0.reserve(connectStr.size() + 1); - std::copy(connectStr.begin(), connectStr.end(), std::back_inserter(connectStr0)); - - SQLCHAR outstr[ODBC_BUFFER_SIZE]; - SQLSMALLINT outstrlen; - - // Connecting to ODBC server. - SQLRETURN ret = SQLDriverConnect(dbc, NULL, &connectStr0[0], static_cast<SQLSMALLINT>(connectStr0.size()), - outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_COMPLETE); - - if (!SQL_SUCCEEDED(ret)) - { - Ignition::Stop(grid.GetName(), true); - - BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_DBC, dbc)); - } - - // Allocate a statement handle - SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt); - - BOOST_REQUIRE(stmt != NULL); - } - - /** - * Disconnect. - */ - void Disconnect() - { - // Releasing statement handle. - SQLFreeHandle(SQL_HANDLE_STMT, stmt); - - // Disconneting from the server. - SQLDisconnect(dbc); - - // Releasing allocated handles. - SQLFreeHandle(SQL_HANDLE_DBC, dbc); - SQLFreeHandle(SQL_HANDLE_ENV, env); - } - - /** * Start additional node with the specified name. * * @param name Node name. */ static Ignite StartAdditionalNode(const char* name) { -#ifdef IGNITE_TESTS_32 - return StartNode("queries-test-noodbc-32.xml", name); -#else - return StartNode("queries-test-noodbc.xml", name); -#endif + return StartTestNode("queries-test.xml", name); } /** @@ -190,17 +125,11 @@ struct MetaQueriesTestSuiteFixture * Constructor. */ MetaQueriesTestSuiteFixture() : + grid(0), cache1(0), - cache2(0), - env(NULL), - dbc(NULL), - stmt(NULL) + cache2(0) { -#ifdef IGNITE_TESTS_32 - grid = StartNode("queries-test-32.xml", "NodeMain"); -#else - grid = StartNode("queries-test.xml", "NodeMain"); -#endif + grid = StartTestNode("queries-test.xml", "NodeMain"); cache1 = grid.GetCache<int64_t, TestType>("cache"); cache2 = grid.GetCache<int64_t, ComplexType>("cache2"); @@ -211,9 +140,7 @@ struct MetaQueriesTestSuiteFixture */ ~MetaQueriesTestSuiteFixture() { - Disconnect(); - - Ignition::StopAll(true); + // No-op. } /** Node started during the test. */ @@ -224,15 +151,6 @@ struct MetaQueriesTestSuiteFixture /** Second cache instance. */ Cache<int64_t, ComplexType> cache2; - - /** ODBC Environment. */ - SQLHENV env; - - /** ODBC Connect. */ - SQLHDBC dbc; - - /** ODBC Statement. */ - SQLHSTMT stmt; }; BOOST_FIXTURE_TEST_SUITE(MetaQueriesTestSuite, MetaQueriesTestSuiteFixture) http://git-wip-us.apache.org/repos/asf/ignite/blob/394019ee/modules/platforms/cpp/odbc-test/src/odbc_test_suite.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/src/odbc_test_suite.cpp b/modules/platforms/cpp/odbc-test/src/odbc_test_suite.cpp index 970c77d..fca3604 100644 --- a/modules/platforms/cpp/odbc-test/src/odbc_test_suite.cpp +++ b/modules/platforms/cpp/odbc-test/src/odbc_test_suite.cpp @@ -40,7 +40,7 @@ namespace ignite { namespace odbc { - void OdbcTestSuite::Connect(const std::string& connectStr) + void OdbcTestSuite::Prepare() { // Allocate an environment handle SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); @@ -54,12 +54,14 @@ namespace ignite SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc); BOOST_REQUIRE(dbc != NULL); + } - // Connect string - std::vector<SQLCHAR> connectStr0; + void OdbcTestSuite::Connect(const std::string& connectStr) + { + Prepare(); - connectStr0.reserve(connectStr.size() + 1); - std::copy(connectStr.begin(), connectStr.end(), std::back_inserter(connectStr0)); + // Connect string + std::vector<SQLCHAR> connectStr0(connectStr.begin(), connectStr.end()); SQLCHAR outstr[ODBC_BUFFER_SIZE]; SQLSMALLINT outstrlen; @@ -81,15 +83,29 @@ namespace ignite void OdbcTestSuite::Disconnect() { - // Releasing statement handle. - SQLFreeHandle(SQL_HANDLE_STMT, stmt); + if (stmt) + { + // Releasing statement handle. + SQLFreeHandle(SQL_HANDLE_STMT, stmt); + stmt = NULL; + } + + if (dbc) + { + // Disconneting from the server. + SQLDisconnect(dbc); - // Disconneting from the server. - SQLDisconnect(dbc); + // Releasing allocated handles. + SQLFreeHandle(SQL_HANDLE_DBC, dbc); + dbc = NULL; + } - // Releasing allocated handles. - SQLFreeHandle(SQL_HANDLE_DBC, dbc); - SQLFreeHandle(SQL_HANDLE_ENV, env); + if (env) + { + // Releasing allocated handles. + SQLFreeHandle(SQL_HANDLE_ENV, env); + env = NULL; + } } Ignite OdbcTestSuite::StartTestNode(const char* cfg, const char* name)
