http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/Makefile.am ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/Makefile.am b/modules/platforms/cpp/odbc/odbc-test/Makefile.am deleted file mode 100644 index 32ca6b2..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/Makefile.am +++ /dev/null @@ -1,55 +0,0 @@ -## -## 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. -## - -ACLOCAL_AMFLAGS = "-Im4" - -SUBDIRS = . -DIST_SUBDIRS = . - -AM_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/../odbc-driver/include -DIGNITE_IMPL -AM_CXXFLAGS = -Wall -std=c++0x - -noinst_PROGRAMS = ignite-odbc-tests - -ignite_odbc_tests_SOURCES = src/teamcity_boost.cpp \ - src/teamcity_messages.cpp \ - src/parser_test.cpp \ - src/cursor_test.cpp \ - src/connection_info_test.cpp \ - src/application_data_buffer_test.cpp \ - src/configuration_test.cpp \ - src/row_test.cpp \ - src/utility_test.cpp \ - ../odbc-driver/src/cursor.cpp \ - ../odbc-driver/src/config/connection_info.cpp \ - ../odbc-driver/src/app/application_data_buffer.cpp \ - ../odbc-driver/src/config/configuration.cpp \ - ../odbc-driver/src/row.cpp \ - ../odbc-driver/src/decimal.cpp \ - ../odbc-driver/src/utility.cpp \ - ../odbc-driver/src/result_page.cpp - -ignite_odbc_tests_LDFLAGS = -static-libtool-libs -L/usr/local/lib -lignite-binary -ldl - -run-check: check - ./ignite-odbc-tests -p - -clean-local: clean-check - $(RM) *.gcno *.gcda - -clean-docs: - $(RM) $(ignite_odbc_tests_OBJECTS)
http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/README.TXT ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/README.TXT b/modules/platforms/cpp/odbc/odbc-test/README.TXT deleted file mode 100644 index 97f4c64..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/README.TXT +++ /dev/null @@ -1 +0,0 @@ -Contains IDE projects artifacts. http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/configure.ac ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/configure.ac b/modules/platforms/cpp/odbc/odbc-test/configure.ac deleted file mode 100644 index abb7adc..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/configure.ac +++ /dev/null @@ -1,62 +0,0 @@ -# -# 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. -# - -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ([2.69]) -AC_INIT([Apache Ignite ODBC Test], [1.5.1.7927], [[email protected]], [ignite], [ignite.apache.org]) -AC_CONFIG_SRCDIR(src) - -AC_CANONICAL_SYSTEM -AC_CONFIG_MACRO_DIR([m4]) -AC_LANG([C++]) - -# Initialize automake -AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) -AC_CONFIG_HEADER(config.h) - -AM_PROG_AR - -# Checks for programs. -GXX="-g -O2" - -AC_PROG_CXX - -# Initialize Libtool -LT_INIT - -# Checks for libraries. -AC_CHECK_LIB([pthread], [pthread_mutex_lock]) - -# Checks for header files. - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_INLINE -AC_TYPE_INT16_T -AC_TYPE_INT32_T -AC_TYPE_INT64_T -AC_TYPE_INT8_T -AC_TYPE_PID_T -AC_TYPE_SIZE_T - -# Checks for library functions. -AC_FUNC_ERROR_AT_LINE - -AC_CONFIG_FILES(Makefile) - -AC_OUTPUT http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/include/teamcity_messages.h ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/include/teamcity_messages.h b/modules/platforms/cpp/odbc/odbc-test/include/teamcity_messages.h deleted file mode 100644 index 8cf23d0..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/include/teamcity_messages.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright 2011 JetBrains s.r.o. - * - * Licensed 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. - * - * $Revision: 88625 $ -*/ - -#ifndef H_TEAMCITY_MESSAGES -#define H_TEAMCITY_MESSAGES - -#include <string> -#include <iostream> - -namespace JetBrains { - -std::string getFlowIdFromEnvironment(); -bool underTeamcity(); - -class TeamcityMessages { - std::ostream *m_out; - -protected: - std::string escape(std::string s); - - void openMsg(const std::string &name); - void writeProperty(std::string name, std::string value); - void closeMsg(); - -public: - TeamcityMessages(); - - void setOutput(std::ostream &); - - void suiteStarted(std::string name, std::string flowid = ""); - void suiteFinished(std::string name, std::string flowid = ""); - - void testStarted(std::string name, std::string flowid = ""); - void testFailed(std::string name, std::string message, std::string details, std::string flowid = ""); - void testIgnored(std::string name, std::string message, std::string flowid = ""); - void testFinished(std::string name, int durationMs = -1, std::string flowid = ""); -}; - -} - -#endif /* H_TEAMCITY_MESSAGES */ http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/project/vs/odbc-test.vcxproj ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/project/vs/odbc-test.vcxproj b/modules/platforms/cpp/odbc/odbc-test/project/vs/odbc-test.vcxproj deleted file mode 100644 index a6a2ae3..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/project/vs/odbc-test.vcxproj +++ /dev/null @@ -1,189 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{309BEA40-495D-463F-98D5-4657F03F6D8F}</ProjectGuid> - <RootNamespace>odbctest</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v100</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v100</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <PlatformToolset>v100</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>v100</PlatformToolset> - <CharacterSet>MultiByte</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Label="Shared"> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir>$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir>$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir>$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> - <IntDir>$(Platform)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\..\common\include;$(ProjectDir)\..\..\..\..\common\os\win\include;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\..\binary\include;$(ProjectDir)\..\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\odbc-driver\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</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> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <AdditionalDependencies>$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-gd-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>Disabled</Optimization> - <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\..\common\include;$(ProjectDir)\..\..\..\..\common\os\win\include;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\..\binary\include;$(ProjectDir)\..\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\odbc-driver\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</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> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <AdditionalDependencies>$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-gd-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies> - <SubSystem>Console</SubSystem> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\..\common\include;$(ProjectDir)\..\..\..\..\common\os\win\include;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\..\binary\include;$(ProjectDir)\..\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\odbc-driver\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</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> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - <AdditionalDependencies>$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <WarningLevel>Level3</WarningLevel> - <Optimization>MaxSpeed</Optimization> - <FunctionLevelLinking>true</FunctionLevelLinking> - <IntrinsicFunctions>true</IntrinsicFunctions> - <SDLCheck>true</SDLCheck> - <AdditionalIncludeDirectories>$(ProjectDir)\..\..\..\..\common\include;$(ProjectDir)\..\..\..\..\common\os\win\include;$(ProjectDir)\..\..\src;$(ProjectDir)\..\..\os\win;$(ProjectDir)\..\..\..\..\binary\include;$(ProjectDir)\..\..\..\..\binary\os\win\include;$(ProjectDir)\..\..\..\odbc-driver\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</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> - <Link> - <GenerateDebugInformation>true</GenerateDebugInformation> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <OptimizeReferences>true</OptimizeReferences> - <AdditionalDependencies>$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="..\..\..\odbc-driver\src\app\application_data_buffer.cpp" /> - <ClCompile Include="..\..\..\odbc-driver\src\column.cpp" /> - <ClCompile Include="..\..\..\odbc-driver\src\config\configuration.cpp" /> - <ClCompile Include="..\..\..\odbc-driver\src\config\connection_info.cpp" /> - <ClCompile Include="..\..\..\odbc-driver\src\cursor.cpp" /> - <ClCompile Include="..\..\..\odbc-driver\src\decimal.cpp" /> - <ClCompile Include="..\..\..\odbc-driver\src\result_page.cpp" /> - <ClCompile Include="..\..\..\odbc-driver\src\row.cpp" /> - <ClCompile Include="..\..\..\odbc-driver\src\utility.cpp" /> - <ClCompile Include="..\..\src\application_data_buffer_test.cpp" /> - <ClCompile Include="..\..\src\column_test.cpp" /> - <ClCompile Include="..\..\src\configuration_test.cpp" /> - <ClCompile Include="..\..\src\connection_info_test.cpp" /> - <ClCompile Include="..\..\src\cursor_test.cpp" /> - <ClCompile Include="..\..\src\parser_test.cpp" /> - <ClCompile Include="..\..\src\row_test.cpp" /> - <ClCompile Include="..\..\src\teamcity_boost.cpp" /> - <ClCompile Include="..\..\src\teamcity_messages.cpp" /> - <ClCompile Include="..\..\src\utility_test.cpp" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\include\teamcity_messages.h" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\..\binary\project\vs\binary.vcxproj"> - <Project>{4f15669b-92eb-49f0-b774-8f19bae0b960}</Project> - </ProjectReference> - <ProjectReference Include="..\..\..\..\common\project\vs\common.vcxproj"> - <Project>{4f7e4917-4612-4b96-9838-025711ade391}</Project> - </ProjectReference> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/project/vs/odbc-test.vcxproj.filters ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/project/vs/odbc-test.vcxproj.filters b/modules/platforms/cpp/odbc/odbc-test/project/vs/odbc-test.vcxproj.filters deleted file mode 100644 index cf44ba9..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/project/vs/odbc-test.vcxproj.filters +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Code"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> - </Filter> - <Filter Include="Externals"> - <UniqueIdentifier>{cc75fc86-c08d-428a-8ae3-f9979e4588ab}</UniqueIdentifier> - </Filter> - <Filter Include="Code\teamcity"> - <UniqueIdentifier>{5438a56d-1009-412a-86e3-ceb1112af275}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\src\configuration_test.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\..\odbc-driver\src\utility.cpp"> - <Filter>Externals</Filter> - </ClCompile> - <ClCompile Include="..\..\src\connection_info_test.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\parser_test.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\teamcity_boost.cpp"> - <Filter>Code\teamcity</Filter> - </ClCompile> - <ClCompile Include="..\..\src\teamcity_messages.cpp"> - <Filter>Code\teamcity</Filter> - </ClCompile> - <ClCompile Include="..\..\src\application_data_buffer_test.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\src\row_test.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\..\odbc-driver\src\row.cpp"> - <Filter>Externals</Filter> - </ClCompile> - <ClCompile Include="..\..\..\odbc-driver\src\result_page.cpp"> - <Filter>Externals</Filter> - </ClCompile> - <ClCompile Include="..\..\src\cursor_test.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\..\odbc-driver\src\cursor.cpp"> - <Filter>Externals</Filter> - </ClCompile> - <ClCompile Include="..\..\src\utility_test.cpp"> - <Filter>Code</Filter> - </ClCompile> - <ClCompile Include="..\..\..\odbc-driver\src\config\configuration.cpp"> - <Filter>Externals</Filter> - </ClCompile> - <ClCompile Include="..\..\..\odbc-driver\src\config\connection_info.cpp"> - <Filter>Externals</Filter> - </ClCompile> - <ClCompile Include="..\..\..\odbc-driver\src\app\application_data_buffer.cpp"> - <Filter>Externals</Filter> - </ClCompile> - <ClCompile Include="..\..\..\odbc-driver\src\decimal.cpp"> - <Filter>Externals</Filter> - </ClCompile> - <ClCompile Include="..\..\..\odbc-driver\src\column.cpp"> - <Filter>Externals</Filter> - </ClCompile> - <ClCompile Include="..\..\src\column_test.cpp"> - <Filter>Code</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\include\teamcity_messages.h"> - <Filter>Code\teamcity</Filter> - </ClInclude> - </ItemGroup> -</Project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/src/application_data_buffer_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/src/application_data_buffer_test.cpp b/modules/platforms/cpp/odbc/odbc-test/src/application_data_buffer_test.cpp deleted file mode 100644 index 632f05f..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/src/application_data_buffer_test.cpp +++ /dev/null @@ -1,630 +0,0 @@ -/* - * 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. - */ - -#ifndef _MSC_VER -# define BOOST_TEST_DYN_LINK -#endif - -#include <boost/test/unit_test.hpp> - -#include <ignite/guid.h> -#include <ignite/odbc/decimal.h> -#include <ignite/odbc/app/application_data_buffer.h> - -#define FLOAT_PRECISION 0.0000001f - -using namespace ignite; -using namespace ignite::odbc; -using namespace ignite::odbc::app; -using namespace ignite::odbc::type_traits; - -BOOST_AUTO_TEST_SUITE(ApplicationDataBufferTestSuite) - -BOOST_AUTO_TEST_CASE(TestPutIntToString) -{ - char buffer[1024]; - SqlLen reslen; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); - - appBuf.PutInt8(12); - BOOST_REQUIRE(!strcmp(buffer, "12")); - BOOST_REQUIRE(reslen == strlen("12")); - - appBuf.PutInt8(-12); - BOOST_REQUIRE(!strcmp(buffer, "-12")); - BOOST_REQUIRE(reslen == strlen("-12")); - - appBuf.PutInt16(9876); - BOOST_REQUIRE(!strcmp(buffer, "9876")); - BOOST_REQUIRE(reslen == strlen("9876")); - - appBuf.PutInt16(-9876); - BOOST_REQUIRE(!strcmp(buffer, "-9876")); - BOOST_REQUIRE(reslen == strlen("-9876")); - - appBuf.PutInt32(1234567); - BOOST_REQUIRE(!strcmp(buffer, "1234567")); - BOOST_REQUIRE(reslen == strlen("1234567")); - - appBuf.PutInt32(-1234567); - BOOST_REQUIRE(!strcmp(buffer, "-1234567")); - BOOST_REQUIRE(reslen == strlen("-1234567")); -} - -BOOST_AUTO_TEST_CASE(TestPutFloatToString) -{ - char buffer[1024]; - SqlLen reslen; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); - - appBuf.PutFloat(12.42f); - BOOST_REQUIRE(!strcmp(buffer, "12.42")); - BOOST_REQUIRE(reslen == strlen("12.42")); - - appBuf.PutFloat(-12.42f); - BOOST_REQUIRE(!strcmp(buffer, "-12.42")); - BOOST_REQUIRE(reslen == strlen("-12.42")); - - appBuf.PutDouble(1000.21); - BOOST_REQUIRE(!strcmp(buffer, "1000.21")); - BOOST_REQUIRE(reslen == strlen("1000.21")); - - appBuf.PutDouble(-1000.21); - BOOST_REQUIRE(!strcmp(buffer, "-1000.21")); - BOOST_REQUIRE(reslen == strlen("-1000.21")); -} - -BOOST_AUTO_TEST_CASE(TestPutGuidToString) -{ - char buffer[1024]; - SqlLen reslen; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); - - ignite::Guid guid(0x1da1ef8f39ff4d62ULL, 0x8b72e8e9f3371801ULL); - - appBuf.PutGuid(guid); - - BOOST_REQUIRE(!strcmp(buffer, "1da1ef8f-39ff-4d62-8b72-e8e9f3371801")); - BOOST_REQUIRE(reslen == strlen("1da1ef8f-39ff-4d62-8b72-e8e9f3371801")); -} - -BOOST_AUTO_TEST_CASE(TestPutBinaryToString) -{ - char buffer[1024]; - SqlLen reslen; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); - - uint8_t binary[] = { 0x21, 0x84, 0xF4, 0xDC, 0x01, 0x00, 0xFF, 0xF0 }; - - appBuf.PutBinaryData(binary, sizeof(binary)); - - BOOST_REQUIRE(!strcmp(buffer, "2184f4dc0100fff0")); - BOOST_REQUIRE(reslen == strlen("2184f4dc0100fff0")); -} - -BOOST_AUTO_TEST_CASE(TestPutStringToString) -{ - char buffer[1024]; - SqlLen reslen; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, buffer, sizeof(buffer), &reslen, &offset); - - std::string testString("Test string"); - - appBuf.PutString(testString); - - BOOST_REQUIRE(!strcmp(buffer, testString.c_str())); - BOOST_REQUIRE(reslen == testString.size()); -} - -BOOST_AUTO_TEST_CASE(TestPutStringToWstring) -{ - wchar_t buffer[1024]; - SqlLen reslen; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_WCHAR, buffer, sizeof(buffer), &reslen, &offset); - - std::string testString("Test string"); - - appBuf.PutString(testString); - BOOST_REQUIRE(!wcscmp(buffer, L"Test string")); -} - -BOOST_AUTO_TEST_CASE(TestPutStringToLong) -{ - long numBuf; - SqlLen reslen; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, &offset); - - appBuf.PutString("424242424"); - BOOST_REQUIRE(numBuf == 424242424L); - - appBuf.PutString("-424242424"); - BOOST_REQUIRE(numBuf == -424242424L); -} - -BOOST_AUTO_TEST_CASE(TestPutStringToTiny) -{ - int8_t numBuf; - SqlLen reslen; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_TINYINT, &numBuf, sizeof(numBuf), &reslen, &offset); - - appBuf.PutString("12"); - BOOST_REQUIRE(numBuf == 12); - - appBuf.PutString("-12"); - BOOST_REQUIRE(numBuf == -12); -} - -BOOST_AUTO_TEST_CASE(TestPutStringToFloat) -{ - float numBuf; - SqlLen reslen; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset); - - appBuf.PutString("12.21"); - BOOST_REQUIRE_CLOSE_FRACTION(numBuf, 12.21, FLOAT_PRECISION); - - appBuf.PutString("-12.21"); - BOOST_REQUIRE_CLOSE_FRACTION(numBuf, -12.21, FLOAT_PRECISION); -} - -BOOST_AUTO_TEST_CASE(TestPutIntToFloat) -{ - float numBuf; - SqlLen reslen; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &numBuf, sizeof(numBuf), &reslen, &offset); - - appBuf.PutInt8(5); - BOOST_REQUIRE_CLOSE_FRACTION(numBuf, 5.0, FLOAT_PRECISION); - - appBuf.PutInt8(-5); - BOOST_REQUIRE_CLOSE_FRACTION(numBuf, -5.0, FLOAT_PRECISION); - - appBuf.PutInt16(4242); - BOOST_REQUIRE_CLOSE_FRACTION(numBuf, 4242.0, FLOAT_PRECISION); - - appBuf.PutInt16(-4242); - BOOST_REQUIRE_CLOSE_FRACTION(numBuf, -4242.0, FLOAT_PRECISION); - - appBuf.PutInt32(1234567); - BOOST_REQUIRE_CLOSE_FRACTION(numBuf, 1234567.0, FLOAT_PRECISION); - - appBuf.PutInt32(-1234567); - BOOST_REQUIRE_CLOSE_FRACTION(numBuf, -1234567.0, FLOAT_PRECISION); -} - -BOOST_AUTO_TEST_CASE(TestPutFloatToShort) -{ - short numBuf; - SqlLen reslen; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_SHORT, &numBuf, sizeof(numBuf), &reslen, &offset); - - appBuf.PutDouble(5.42); - BOOST_REQUIRE(numBuf == 5); - - appBuf.PutDouble(-5.42); - BOOST_REQUIRE(numBuf == -5.0); - - appBuf.PutFloat(42.99f); - BOOST_REQUIRE(numBuf == 42); - - appBuf.PutFloat(-42.99f); - BOOST_REQUIRE(numBuf == -42); -} - -BOOST_AUTO_TEST_CASE(TestPutDecimalToDouble) -{ - double numBuf; - SqlLen reslen; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &numBuf, sizeof(numBuf), &reslen, 0); - - Decimal decimal; - - BOOST_REQUIRE_CLOSE_FRACTION(static_cast<double>(decimal), 0.0, FLOAT_PRECISION); - - appBuf.PutDecimal(decimal); - BOOST_REQUIRE_CLOSE_FRACTION(numBuf, 0.0, FLOAT_PRECISION); - - int8_t mag1[] = { 1, 0 }; - - decimal = Decimal(0, mag1, sizeof(mag1)); - - appBuf.PutDecimal(decimal); - BOOST_REQUIRE_CLOSE_FRACTION(numBuf, 256.0, FLOAT_PRECISION); - - int8_t mag2[] = { 2, 23 }; - - decimal = Decimal(1 | 0x80000000, mag2, sizeof(mag2)); - - appBuf.PutDecimal(decimal); - BOOST_REQUIRE_CLOSE_FRACTION(numBuf, -53.5, FLOAT_PRECISION); -} - -BOOST_AUTO_TEST_CASE(TestPutDecimalToLong) -{ - long numBuf; - SqlLen reslen; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, sizeof(numBuf), &reslen, 0); - - Decimal decimal; - - appBuf.PutDecimal(decimal); - BOOST_REQUIRE(numBuf == 0); - - int8_t mag1[] = { 1, 0 }; - - decimal = Decimal(0, mag1, sizeof(mag1)); - - appBuf.PutDecimal(decimal); - BOOST_REQUIRE(numBuf == 256); - - int8_t mag2[] = { 2, 23 }; - - decimal = Decimal(1 | 0x80000000, mag2, sizeof(mag2)); - - appBuf.PutDecimal(decimal); - BOOST_REQUIRE(numBuf == -53); -} - -BOOST_AUTO_TEST_CASE(TestPutDecimalToString) -{ - char strBuf[64]; - SqlLen reslen; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, 0); - - Decimal decimal; - - appBuf.PutDecimal(decimal); - BOOST_REQUIRE(std::string(strBuf, reslen) == "0"); - - int8_t mag1[] = { 1, 0 }; - - decimal = Decimal(0, mag1, sizeof(mag1)); - - appBuf.PutDecimal(decimal); - BOOST_REQUIRE(std::string(strBuf, reslen) == "256"); - - int8_t mag2[] = { 2, 23 }; - - decimal = Decimal(1 | 0x80000000, mag2, sizeof(mag2)); - - appBuf.PutDecimal(decimal); - BOOST_REQUIRE(std::string(strBuf, reslen) == "-53.5"); -} - -BOOST_AUTO_TEST_CASE(TestGetStringFromLong) -{ - long numBuf = 42; - SqlLen reslen = sizeof(numBuf); - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_SIGNED_LONG, &numBuf, reslen, &reslen, &offset); - - std::string res = appBuf.GetString(32); - - BOOST_REQUIRE(res == "42"); - - numBuf = -77; - - res = appBuf.GetString(32); - - BOOST_REQUIRE(res == "-77"); -} - -BOOST_AUTO_TEST_CASE(TestGetStringFromDouble) -{ - double numBuf = 43.36; - SqlLen reslen = sizeof(numBuf); - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &numBuf, reslen, &reslen, &offset); - - std::string res = appBuf.GetString(32); - - BOOST_REQUIRE(res == "43.36"); - - numBuf = -58.91; - - res = appBuf.GetString(32); - - BOOST_REQUIRE(res == "-58.91"); -} - -BOOST_AUTO_TEST_CASE(TestGetStringFromString) -{ - char buf[] = "Some data 32d2d5hs"; - SqlLen reslen = sizeof(buf); - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset); - - std::string res = appBuf.GetString(reslen); - - BOOST_REQUIRE(res.compare(buf)); -} - -BOOST_AUTO_TEST_CASE(TestGetFloatFromUshort) -{ - unsigned short numBuf = 7162; - SqlLen reslen = sizeof(numBuf); - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_UNSIGNED_SHORT, &numBuf, reslen, &reslen, &offset); - - float resFloat = appBuf.GetFloat(); - - BOOST_REQUIRE_CLOSE_FRACTION(resFloat, 7162.0f, FLOAT_PRECISION); - - double resDouble = appBuf.GetDouble(); - - BOOST_REQUIRE_CLOSE_FRACTION(resDouble, 7162.0, FLOAT_PRECISION); -} - -BOOST_AUTO_TEST_CASE(TestGetFloatFromString) -{ - char buf[] = "28.562"; - SqlLen reslen = sizeof(buf); - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset); - - float resFloat = appBuf.GetFloat(); - - BOOST_REQUIRE_CLOSE_FRACTION(resFloat, 28.562f, FLOAT_PRECISION); - - double resDouble = appBuf.GetDouble(); - - BOOST_REQUIRE_CLOSE_FRACTION(resDouble, 28.562, FLOAT_PRECISION); -} - -BOOST_AUTO_TEST_CASE(TestGetFloatFromFloat) -{ - float buf = 207.49f; - SqlLen reslen = sizeof(buf); - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &buf, reslen, &reslen, &offset); - - float resFloat = appBuf.GetFloat(); - - BOOST_REQUIRE_CLOSE_FRACTION(resFloat, 207.49f, FLOAT_PRECISION); - - double resDouble = appBuf.GetDouble(); - - BOOST_REQUIRE_CLOSE_FRACTION(resDouble, 207.49, FLOAT_PRECISION); -} - -BOOST_AUTO_TEST_CASE(TestGetFloatFromDouble) -{ - double buf = 893.162; - SqlLen reslen = sizeof(buf); - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &buf, reslen, &reslen, &offset); - - float resFloat = appBuf.GetFloat(); - - BOOST_REQUIRE_CLOSE_FRACTION(resFloat, 893.162f, FLOAT_PRECISION); - - double resDouble = appBuf.GetDouble(); - - BOOST_REQUIRE_CLOSE_FRACTION(resDouble, 893.162, FLOAT_PRECISION); -} - -BOOST_AUTO_TEST_CASE(TestGetIntFromString) -{ - char buf[] = "39"; - SqlLen reslen = sizeof(buf); - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf, reslen, &reslen, &offset); - - int64_t resInt64 = appBuf.GetInt64(); - - BOOST_REQUIRE(resInt64 == 39); - - int32_t resInt32 = appBuf.GetInt32(); - - BOOST_REQUIRE(resInt32 == 39); - - int16_t resInt16 = appBuf.GetInt16(); - - BOOST_REQUIRE(resInt16 == 39); - - int8_t resInt8 = appBuf.GetInt8(); - - BOOST_REQUIRE(resInt8 == 39); -} - -BOOST_AUTO_TEST_CASE(TestGetIntFromFloat) -{ - float buf = -107.49f; - SqlLen reslen = sizeof(buf); - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_FLOAT, &buf, reslen, &reslen, &offset); - - int64_t resInt64 = appBuf.GetInt64(); - - BOOST_REQUIRE(resInt64 == -107); - - int32_t resInt32 = appBuf.GetInt32(); - - BOOST_REQUIRE(resInt32 == -107); - - int16_t resInt16 = appBuf.GetInt16(); - - BOOST_REQUIRE(resInt16 == -107); - - int8_t resInt8 = appBuf.GetInt8(); - - BOOST_REQUIRE(resInt8 == -107); -} - -BOOST_AUTO_TEST_CASE(TestGetIntFromDouble) -{ - double buf = 42.97f; - SqlLen reslen = sizeof(buf); - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_DOUBLE, &buf, reslen, &reslen, &offset); - - int64_t resInt64 = appBuf.GetInt64(); - - BOOST_REQUIRE(resInt64 == 42); - - int32_t resInt32 = appBuf.GetInt32(); - - BOOST_REQUIRE(resInt32 == 42); - - int16_t resInt16 = appBuf.GetInt16(); - - BOOST_REQUIRE(resInt16 == 42); - - int8_t resInt8 = appBuf.GetInt8(); - - BOOST_REQUIRE(resInt8 == 42); -} - -BOOST_AUTO_TEST_CASE(TestGetIntFromBigint) -{ - uint64_t buf = 19; - SqlLen reslen = sizeof(buf); - size_t* offset = 0; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT, &buf, reslen, &reslen, &offset); - - int64_t resInt64 = appBuf.GetInt64(); - - BOOST_REQUIRE(resInt64 == 19); - - int32_t resInt32 = appBuf.GetInt32(); - - BOOST_REQUIRE(resInt32 == 19); - - int16_t resInt16 = appBuf.GetInt16(); - - BOOST_REQUIRE(resInt16 == 19); - - int8_t resInt8 = appBuf.GetInt8(); - - BOOST_REQUIRE(resInt8 == 19); -} - -BOOST_AUTO_TEST_CASE(TestGetIntWithOffset) -{ - struct TestStruct - { - uint64_t val; - SqlLen reslen; - }; - - TestStruct buf[2] = { - { 12, sizeof(uint64_t) }, - { 42, sizeof(uint64_t) } - }; - - size_t offset = 0; - size_t* offsetPtr = &offset; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_UNSIGNED_BIGINT, &buf[0].val, sizeof(buf[0].val), &buf[0].reslen, &offsetPtr); - - int64_t val = appBuf.GetInt64(); - - BOOST_REQUIRE(val == 12); - - offset += sizeof(TestStruct); - - val = appBuf.GetInt64(); - - BOOST_REQUIRE(val == 42); - - offsetPtr = 0; - - val = appBuf.GetInt64(); - - BOOST_REQUIRE(val == 12); -} - -BOOST_AUTO_TEST_CASE(TestSetStringWithOffset) -{ - struct TestStruct - { - char val[64]; - SqlLen reslen; - }; - - TestStruct buf[2] = { - { "", 0 }, - { "", 0 } - }; - - size_t offset = 0; - size_t* offsetPtr = &offset; - - ApplicationDataBuffer appBuf(IGNITE_ODBC_C_TYPE_CHAR, &buf[0].val, sizeof(buf[0].val), &buf[0].reslen, &offsetPtr); - - appBuf.PutString("Hello Ignite!"); - - std::string res(buf[0].val, buf[0].reslen); - - BOOST_REQUIRE(buf[0].reslen == strlen("Hello Ignite!")); - BOOST_REQUIRE(res == "Hello Ignite!"); - BOOST_REQUIRE(res.size() == strlen("Hello Ignite!")); - - offset += sizeof(TestStruct); - - appBuf.PutString("Hello with offset!"); - - res.assign(buf[0].val, buf[0].reslen); - - BOOST_REQUIRE(res == "Hello Ignite!"); - BOOST_REQUIRE(res.size() == strlen("Hello Ignite!")); - BOOST_REQUIRE(buf[0].reslen == strlen("Hello Ignite!")); - - res.assign(buf[1].val, buf[1].reslen); - - BOOST_REQUIRE(res == "Hello with offset!"); - BOOST_REQUIRE(res.size() == strlen("Hello with offset!")); - BOOST_REQUIRE(buf[1].reslen == strlen("Hello with offset!")); -} - -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/src/column_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/src/column_test.cpp b/modules/platforms/cpp/odbc/odbc-test/src/column_test.cpp deleted file mode 100644 index 4864a6a..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/src/column_test.cpp +++ /dev/null @@ -1,290 +0,0 @@ -/* - * 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. - */ - -#ifndef _MSC_VER -# define BOOST_TEST_DYN_LINK -#endif - -#include <boost/test/unit_test.hpp> - -#include <ignite/impl/binary/binary_common.h> -#include <ignite/impl/binary/binary_writer_impl.h> - -#include "ignite/odbc/system/odbc_constants.h" -#include "ignite/odbc/column.h" - -using namespace ignite::impl::binary; -using namespace ignite::odbc::app; -using namespace ignite::odbc; - -BOOST_AUTO_TEST_SUITE(ColumnTestSuite) - -BOOST_AUTO_TEST_CASE(TestColumnDefaultConstruction) -{ - Column column; - - BOOST_REQUIRE(!column.IsValid()); -} - -BOOST_AUTO_TEST_CASE(TestColumnShort) -{ - ignite::impl::interop::InteropUnpooledMemory mem(4096); - ignite::impl::interop::InteropOutputStream outStream(&mem); - ignite::impl::binary::BinaryWriterImpl writer(&outStream, 0); - - int16_t data = 42; - - writer.WriteInt8(IGNITE_TYPE_SHORT); - writer.WriteInt16(data); - - outStream.Synchronize(); - - ignite::impl::interop::InteropInputStream inStream(&mem); - ignite::impl::binary::BinaryReaderImpl reader(&inStream); - - Column column(reader); - - BOOST_REQUIRE(column.IsValid()); - - BOOST_REQUIRE(column.GetSize() == 2); - - BOOST_REQUIRE(column.GetUnreadDataLength() == 2); - - short shortBuf = 0; - SqlLen reslen = 0; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_SIGNED_SHORT, &shortBuf, sizeof(shortBuf), &reslen, &offset); - - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); - - BOOST_REQUIRE(column.IsValid()); - - BOOST_REQUIRE(column.GetSize() == 2); - - BOOST_REQUIRE(column.GetUnreadDataLength() == 0); - - BOOST_REQUIRE(shortBuf == data); - - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); - - BOOST_REQUIRE(column.IsValid()); - - BOOST_REQUIRE(column.GetSize() == 2); - - BOOST_REQUIRE(column.GetUnreadDataLength() == 0); -} - -BOOST_AUTO_TEST_CASE(TestColumnString) -{ - ignite::impl::interop::InteropUnpooledMemory mem(4096); - ignite::impl::interop::InteropOutputStream outStream(&mem); - ignite::impl::binary::BinaryWriterImpl writer(&outStream, 0); - - std::string data("Some test data."); - - writer.WriteString(data.data(), static_cast<int32_t>(data.size())); - - outStream.Synchronize(); - - ignite::impl::interop::InteropInputStream inStream(&mem); - ignite::impl::binary::BinaryReaderImpl reader(&inStream); - - Column column(reader); - - BOOST_REQUIRE(column.IsValid()); - - BOOST_REQUIRE(column.GetSize() == data.size()); - - BOOST_REQUIRE(column.GetUnreadDataLength() == data.size()); - - char strBuf[1024] = {}; - SqlLen reslen = 0; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, &offset); - - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); - - BOOST_REQUIRE(column.IsValid()); - - BOOST_REQUIRE(column.GetSize() == data.size()); - - BOOST_REQUIRE(column.GetUnreadDataLength() == 0); - - BOOST_REQUIRE(std::string(strBuf) == data); - - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); - - BOOST_REQUIRE(column.IsValid()); - - BOOST_REQUIRE(column.GetSize() == data.size()); - - BOOST_REQUIRE(column.GetUnreadDataLength() == 0); -} - -BOOST_AUTO_TEST_CASE(TestColumnStringSeveral) -{ - ignite::impl::interop::InteropUnpooledMemory mem(4096); - ignite::impl::interop::InteropOutputStream outStream(&mem); - ignite::impl::binary::BinaryWriterImpl writer(&outStream, 0); - - std::string data("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - - writer.WriteString(data.data(), static_cast<int32_t>(data.size())); - - outStream.Synchronize(); - - ignite::impl::interop::InteropInputStream inStream(&mem); - ignite::impl::binary::BinaryReaderImpl reader(&inStream); - - Column column(reader); - - BOOST_REQUIRE(column.IsValid()); - - BOOST_REQUIRE(column.GetSize() == data.size()); - - BOOST_REQUIRE(column.GetUnreadDataLength() == data.size()); - - std::string res; - - std::string strBuf(data.size() / 3 + 2, 0); - SqlLen reslen = 0; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_CHAR, &strBuf[0], strBuf.size(), &reslen, &offset); - - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); - - BOOST_REQUIRE(column.IsValid()); - - BOOST_REQUIRE(column.GetSize() == data.size()); - - BOOST_REQUIRE(column.GetUnreadDataLength() == data.size() - (strBuf.size() - 1)); - - res.append(strBuf.c_str()); - - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); - - BOOST_REQUIRE(column.IsValid()); - - BOOST_REQUIRE(column.GetSize() == data.size()); - - BOOST_REQUIRE(column.GetUnreadDataLength() == data.size() - 2 * (strBuf.size() - 1)); - - res.append(strBuf.c_str()); - - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); - - BOOST_REQUIRE(column.IsValid()); - - BOOST_REQUIRE(column.GetSize() == data.size()); - - BOOST_REQUIRE(column.GetUnreadDataLength() == 0); - - res.append(strBuf.c_str()); - - BOOST_REQUIRE(column.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); - - BOOST_REQUIRE(column.IsValid()); - - BOOST_REQUIRE(column.GetSize() == data.size()); - - BOOST_REQUIRE(column.GetUnreadDataLength() == 0); - - BOOST_REQUIRE(res == data); -} - -BOOST_AUTO_TEST_CASE(TestColumnMultiString) -{ - ignite::impl::interop::InteropUnpooledMemory mem(4096); - ignite::impl::interop::InteropOutputStream outStream(&mem); - ignite::impl::binary::BinaryWriterImpl writer(&outStream, 0); - - std::string data1("Some test data."); - std::string data2("Other TEST DATA."); - - writer.WriteString(data1.data(), static_cast<int32_t>(data1.size())); - writer.WriteString(data2.data(), static_cast<int32_t>(data2.size())); - - outStream.Synchronize(); - - ignite::impl::interop::InteropInputStream inStream(&mem); - ignite::impl::binary::BinaryReaderImpl reader(&inStream); - - Column column1(reader); - - inStream.Position(column1.GetEndPosition()); - - Column column2(reader); - - BOOST_REQUIRE(column1.IsValid()); - - BOOST_REQUIRE(column1.GetSize() == data1.size()); - - BOOST_REQUIRE(column1.GetUnreadDataLength() == data1.size()); - - BOOST_REQUIRE(column2.IsValid()); - - BOOST_REQUIRE(column2.GetSize() == data2.size()); - - BOOST_REQUIRE(column2.GetUnreadDataLength() == data2.size()); - - char strBuf[1024] = {}; - SqlLen reslen = 0; - size_t* offset = 0; - - ApplicationDataBuffer appBuf(type_traits::IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, &offset); - - BOOST_REQUIRE(column1.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); - - BOOST_REQUIRE(column1.IsValid()); - - BOOST_REQUIRE(column1.GetSize() == data1.size()); - - BOOST_REQUIRE(column1.GetUnreadDataLength() == 0); - - BOOST_REQUIRE(std::string(strBuf) == data1); - - BOOST_REQUIRE(column1.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); - - BOOST_REQUIRE(column1.IsValid()); - - BOOST_REQUIRE(column1.GetSize() == data1.size()); - - BOOST_REQUIRE(column1.GetUnreadDataLength() == 0); - - BOOST_REQUIRE(column2.ReadToBuffer(reader, appBuf) == SQL_RESULT_SUCCESS); - - BOOST_REQUIRE(column2.IsValid()); - - BOOST_REQUIRE(column2.GetSize() == data2.size()); - - BOOST_REQUIRE(column2.GetUnreadDataLength() == 0); - - BOOST_REQUIRE(std::string(strBuf) == data2); - - BOOST_REQUIRE(column2.ReadToBuffer(reader, appBuf) == SQL_RESULT_NO_DATA); - - BOOST_REQUIRE(column2.IsValid()); - - BOOST_REQUIRE(column2.GetSize() == data2.size()); - - BOOST_REQUIRE(column2.GetUnreadDataLength() == 0); -} - -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/src/configuration_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/src/configuration_test.cpp b/modules/platforms/cpp/odbc/odbc-test/src/configuration_test.cpp deleted file mode 100644 index fba46cc..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/src/configuration_test.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/* - * 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. - */ - -#ifndef _MSC_VER -# define BOOST_TEST_DYN_LINK -#endif - -#include <iostream> - -#include <boost/test/unit_test.hpp> - -#include <ignite/odbc/config/configuration.h> - -using namespace ignite::odbc::config; - -namespace -{ - const char* testDriverName = "Ignite"; - const char* testServerHost = "testhost.com"; - const uint16_t testServerPort = 4242; - const char* testCacheName = "TestCache"; - const char* testDsn = "Ignite DSN"; -} - -BOOST_AUTO_TEST_SUITE(ConfigurationTestSuite) - -void CheckConnectionConfig(const Configuration& cfg) -{ - BOOST_REQUIRE(cfg.GetDriver() == testDriverName); - BOOST_REQUIRE(cfg.GetHost() == testServerHost); - BOOST_REQUIRE(cfg.GetPort() == testServerPort); - BOOST_REQUIRE(cfg.GetCache() == testCacheName); - BOOST_REQUIRE(cfg.GetDsn().empty()); - - std::stringstream constructor; - - constructor << "driver={" << testDriverName << "};" - << "server=" << testServerHost << ";" - << "port=" << testServerPort << ";" - << "cache=" << testCacheName << ";"; - - const std::string& expectedStr = constructor.str(); - - BOOST_REQUIRE(cfg.ToConnectString() == expectedStr); -} - -void CheckDsnConfig(const Configuration& cfg) -{ - BOOST_REQUIRE(cfg.GetDriver() == testDriverName); - BOOST_REQUIRE(cfg.GetDsn() == testDsn); - BOOST_REQUIRE(cfg.GetHost().empty()); - BOOST_REQUIRE(cfg.GetCache().empty()); - BOOST_REQUIRE(cfg.GetPort() == 0); -} - -BOOST_AUTO_TEST_CASE(TestConnectStringUppercase) -{ - Configuration cfg; - - std::stringstream constructor; - - constructor << "DRIVER={" << testDriverName << "};" - << "SERVER=" << testServerHost <<";" - << "PORT=" << testServerPort << ";" - << "CACHE=" << testCacheName; - - const std::string& connectStr = constructor.str(); - - cfg.FillFromConnectString(connectStr.c_str(), connectStr.size()); - - CheckConnectionConfig(cfg); -} - -BOOST_AUTO_TEST_CASE(TestConnectStringLowercase) -{ - Configuration cfg; - - std::stringstream constructor; - - constructor << "driver={" << testDriverName << "};" - << "server=" << testServerHost << ";" - << "port=" << testServerPort << ";" - << "cache=" << testCacheName; - - const std::string& connectStr = constructor.str(); - - cfg.FillFromConnectString(connectStr.c_str(), connectStr.size()); - - CheckConnectionConfig(cfg); -} - -BOOST_AUTO_TEST_CASE(TestConnectStringMixed) -{ - Configuration cfg; - - std::stringstream constructor; - - constructor << "Driver={" << testDriverName << "};" - << "Server=" << testServerHost << ";" - << "Port=" << testServerPort << ";" - << "Cache=" << testCacheName; - - const std::string& connectStr = constructor.str(); - - cfg.FillFromConnectString(connectStr.c_str(), connectStr.size()); - - CheckConnectionConfig(cfg); -} - -BOOST_AUTO_TEST_CASE(TestConnectStringWhitepaces) -{ - Configuration cfg; - - std::stringstream constructor; - - constructor << "DRIVER = {" << testDriverName << "} ;\n" - << " SERVER =" << testServerHost << " ; \n" - << "PORT= " << testServerPort << "; " - << "CACHE = \n\r" << testCacheName; - - const std::string& connectStr = constructor.str(); - - cfg.FillFromConnectString(connectStr.c_str(), connectStr.size()); - - CheckConnectionConfig(cfg); -} - -BOOST_AUTO_TEST_CASE(TestDsnStringUppercase) -{ - Configuration cfg; - - std::stringstream constructor; - - constructor << "DRIVER=" << testDriverName << '\0' - << "DSN={" << testDsn << "}" << '\0' << '\0'; - - const std::string& configStr = constructor.str(); - - cfg.FillFromConfigAttributes(configStr.data()); - - CheckDsnConfig(cfg); -} - -BOOST_AUTO_TEST_CASE(TestDsnStrinLowercase) -{ - Configuration cfg; - - std::stringstream constructor; - - constructor << "driver=" << testDriverName << '\0' - << "dsn={" << testDsn << "}" << '\0' << '\0'; - - const std::string& configStr = constructor.str(); - - cfg.FillFromConfigAttributes(configStr.data()); - - CheckDsnConfig(cfg); -} - -BOOST_AUTO_TEST_CASE(TestDsnStrinMixed) -{ - Configuration cfg; - - std::stringstream constructor; - - constructor << "Driver=" << testDriverName << '\0' - << "Dsn={" << testDsn << "}" << '\0' << '\0'; - - const std::string& configStr = constructor.str(); - - cfg.FillFromConfigAttributes(configStr.data()); - - CheckDsnConfig(cfg); -} - -BOOST_AUTO_TEST_CASE(TestDsnStrinWhitespaces) -{ - Configuration cfg; - - std::stringstream constructor; - - constructor << " DRIVER = " << testDriverName << "\r\n" << '\0' - << "DSN= {" << testDsn << "} \n" << '\0' << '\0'; - - const std::string& configStr = constructor.str(); - - cfg.FillFromConfigAttributes(configStr.data()); - - CheckDsnConfig(cfg); -} - -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/src/connection_info_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/src/connection_info_test.cpp b/modules/platforms/cpp/odbc/odbc-test/src/connection_info_test.cpp deleted file mode 100644 index dd8d1f6..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/src/connection_info_test.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/* - * 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. - */ - -#ifndef _MSC_VER -# define BOOST_TEST_DYN_LINK -#endif - -#include <iostream> - -#include <boost/test/unit_test.hpp> - -#include "ignite/odbc/system/odbc_constants.h" -#include "ignite/odbc/config/connection_info.h" - -using namespace ignite::odbc; -using namespace ignite::odbc::config; - -BOOST_AUTO_TEST_SUITE(ConnectionInfoTestSuite) - -BOOST_AUTO_TEST_CASE(TestConnectionInfoSupportedInfo) -{ - char buffer[4096]; - short reslen = 0; - - ConnectionInfo info; - - SqlResult result; - -#ifdef SQL_DRIVER_NAME - result = info.GetInfo(SQL_DRIVER_NAME, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_DRIVER_NAME - -#ifdef SQL_DBMS_NAME - result = info.GetInfo(SQL_DBMS_NAME, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_DBMS_NAME - -#ifdef SQL_DRIVER_ODBC_VER - result = info.GetInfo(SQL_DRIVER_ODBC_VER, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_DRIVER_ODBC_VER - -#ifdef SQL_DBMS_VER - result = info.GetInfo(SQL_DBMS_VER, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_DBMS_VER - -#ifdef SQL_DRIVER_VER - result = info.GetInfo(SQL_DRIVER_VER, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_DRIVER_VER - -#ifdef SQL_COLUMN_ALIAS - result = info.GetInfo(SQL_COLUMN_ALIAS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_COLUMN_ALIAS - -#ifdef SQL_IDENTIFIER_QUOTE_CHAR - result = info.GetInfo(SQL_IDENTIFIER_QUOTE_CHAR, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_IDENTIFIER_QUOTE_CHAR - -#ifdef SQL_CATALOG_NAME_SEPARATOR - result = info.GetInfo(SQL_CATALOG_NAME_SEPARATOR, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_CATALOG_NAME_SEPARATOR - -#ifdef SQL_SPECIAL_CHARACTERS - result = info.GetInfo(SQL_SPECIAL_CHARACTERS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_SPECIAL_CHARACTERS - -#ifdef SQL_CATALOG_TERM - result = info.GetInfo(SQL_CATALOG_TERM, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_CATALOG_TERM - -#ifdef SQL_TABLE_TERM - result = info.GetInfo(SQL_TABLE_TERM, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_TABLE_TERM - -#ifdef SQL_SCHEMA_TERM - result = info.GetInfo(SQL_SCHEMA_TERM, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_SCHEMA_TERM - -#ifdef SQL_ASYNC_DBC_FUNCTIONS - result = info.GetInfo(SQL_ASYNC_DBC_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_ASYNC_DBC_FUNCTIONS - -#ifdef SQL_GETDATA_EXTENSIONS - result = info.GetInfo(SQL_GETDATA_EXTENSIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_GETDATA_EXTENSIONS - -#ifdef SQL_ODBC_INTERFACE_CONFORMANCE - result = info.GetInfo(SQL_ODBC_INTERFACE_CONFORMANCE, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_ODBC_INTERFACE_CONFORMANCE - -#ifdef SQL_SQL_CONFORMANCE - result = info.GetInfo(SQL_SQL_CONFORMANCE, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_SQL_CONFORMANCE - -#ifdef SQL_CATALOG_USAGE - result = info.GetInfo(SQL_CATALOG_USAGE, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_CATALOG_USAGE - -#ifdef SQL_SCHEMA_USAGE - result = info.GetInfo(SQL_SCHEMA_USAGE, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_SCHEMA_USAGE - -#ifdef SQL_MAX_IDENTIFIER_LEN - result = info.GetInfo(SQL_MAX_IDENTIFIER_LEN, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_MAX_IDENTIFIER_LEN - -#ifdef SQL_AGGREGATE_FUNCTIONS - result = info.GetInfo(SQL_AGGREGATE_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_AGGREGATE_FUNCTIONS - -#ifdef SQL_AGGREGATE_FUNCTIONS - result = info.GetInfo(SQL_NUMERIC_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_AGGREGATE_FUNCTIONS - -#ifdef SQL_STRING_FUNCTIONS - result = info.GetInfo(SQL_STRING_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_STRING_FUNCTIONS - -#ifdef SQL_TIMEDATE_FUNCTIONS - result = info.GetInfo(SQL_TIMEDATE_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_TIMEDATE_FUNCTIONS - -#ifdef SQL_TIMEDATE_ADD_INTERVALS - result = info.GetInfo(SQL_TIMEDATE_ADD_INTERVALS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_TIMEDATE_ADD_INTERVALS - -#ifdef SQL_TIMEDATE_DIFF_INTERVALS - result = info.GetInfo(SQL_TIMEDATE_DIFF_INTERVALS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_TIMEDATE_DIFF_INTERVALS - -#ifdef SQL_DATETIME_LITERALS - result = info.GetInfo(SQL_DATETIME_LITERALS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_DATETIME_LITERALS - -#ifdef SQL_SYSTEM_FUNCTIONS - result = info.GetInfo(SQL_SYSTEM_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_SYSTEM_FUNCTIONS - -#ifdef SQL_CONVERT_FUNCTIONS - result = info.GetInfo(SQL_CONVERT_FUNCTIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_CONVERT_FUNCTIONS - -#ifdef SQL_OJ_CAPABILITIES - result = info.GetInfo(SQL_OJ_CAPABILITIES, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_OJ_CAPABILITIES - -#ifdef SQL_POS_OPERATIONS - result = info.GetInfo(SQL_POS_OPERATIONS, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_POS_OPERATIONS - -#ifdef SQL_MAX_CONCURRENT_ACTIVITIES - result = info.GetInfo(SQL_MAX_CONCURRENT_ACTIVITIES, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_MAX_CONCURRENT_ACTIVITIES - -#ifdef SQL_CURSOR_COMMIT_BEHAVIOR - result = info.GetInfo(SQL_CURSOR_COMMIT_BEHAVIOR, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_CURSOR_COMMIT_BEHAVIOR - -#ifdef SQL_CURSOR_ROLLBACK_BEHAVIOR - result = info.GetInfo(SQL_CURSOR_ROLLBACK_BEHAVIOR, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_CURSOR_ROLLBACK_BEHAVIOR - -#ifdef SQL_TXN_CAPABLE - result = info.GetInfo(SQL_TXN_CAPABLE, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_TXN_CAPABLE - -#ifdef SQL_QUOTED_IDENTIFIER_CASE - result = info.GetInfo(SQL_QUOTED_IDENTIFIER_CASE, buffer, sizeof(buffer), &reslen); - BOOST_REQUIRE(result == SQL_RESULT_SUCCESS); -#endif //SQL_QUOTED_IDENTIFIER_CASE -} - -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/src/cursor_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/src/cursor_test.cpp b/modules/platforms/cpp/odbc/odbc-test/src/cursor_test.cpp deleted file mode 100644 index af841e7..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/src/cursor_test.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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. - */ - -#ifndef _MSC_VER -# define BOOST_TEST_DYN_LINK -#endif - -#include <boost/test/unit_test.hpp> - -#include <ignite/impl/binary/binary_writer_impl.h> - -#include "ignite/odbc/system/odbc_constants.h" -#include "ignite/odbc/cursor.h" - -using namespace ignite::odbc; - -const int64_t testQueryId = 42; - -std::auto_ptr<ResultPage> CreateTestPage(bool last, int32_t size) -{ - using namespace ignite::impl::binary; - using namespace ignite::impl::interop; - - ignite::impl::interop::InteropUnpooledMemory mem(1024); - InteropOutputStream outStream(&mem); - BinaryWriterImpl writer(&outStream, 0); - - // Last page flag. - writer.WriteBool(last); - - //Page size. - writer.WriteInt32(size); - - for (int32_t i = 0; i < size; ++i) - { - // Writing row size = 1 column. - writer.WriteInt32(1); - - // Writing column type. - writer.WriteInt8(IGNITE_TYPE_INT); - - // Column value. - writer.WriteInt32(i); - } - - outStream.Synchronize(); - - std::auto_ptr<ResultPage> res(new ResultPage()); - - InteropInputStream inStream(&mem); - BinaryReaderImpl reader(&inStream); - - res->Read(reader); - - BOOST_REQUIRE(res->GetSize() == size); - BOOST_REQUIRE(res->IsLast() == last); - - return res; -} - -void CheckCursorNeedUpdate(Cursor& cursor) -{ - BOOST_REQUIRE(cursor.NeedDataUpdate()); - - BOOST_REQUIRE(cursor.HasNext()); - - BOOST_REQUIRE(!cursor.Increment()); -} - -void CheckCursorReady(Cursor& cursor) -{ - BOOST_REQUIRE(!cursor.NeedDataUpdate()); - - BOOST_REQUIRE(cursor.HasNext()); - - BOOST_REQUIRE(cursor.GetRow()); -} - -void CheckCursorEnd(Cursor& cursor) -{ - BOOST_REQUIRE(!cursor.NeedDataUpdate()); - - BOOST_REQUIRE(!cursor.HasNext()); - - BOOST_REQUIRE(!cursor.Increment()); - - BOOST_REQUIRE(cursor.GetRow()); -} - -BOOST_AUTO_TEST_SUITE(CursorTestSuite) - -BOOST_AUTO_TEST_CASE(TestCursorEmpty) -{ - Cursor cursor(testQueryId); - - BOOST_REQUIRE(cursor.GetQueryId() == testQueryId); - - CheckCursorNeedUpdate(cursor); -} - -BOOST_AUTO_TEST_CASE(TestCursorLast) -{ - const int32_t pageSize = 16; - - Cursor cursor(testQueryId); - - std::auto_ptr<ResultPage> resultPage = CreateTestPage(true, pageSize); - - cursor.UpdateData(resultPage); - - BOOST_REQUIRE(cursor.GetQueryId() == testQueryId); - - CheckCursorReady(cursor); - - for (int32_t i = 0; i < pageSize - 1; ++i) - BOOST_REQUIRE(cursor.Increment()); - - CheckCursorEnd(cursor); -} - -BOOST_AUTO_TEST_CASE(TestCursorUpdate) -{ - const int32_t pageSize = 16; - - Cursor cursor(testQueryId); - - std::auto_ptr<ResultPage> resultPage = CreateTestPage(false, pageSize); - - cursor.UpdateData(resultPage); - - BOOST_REQUIRE(cursor.GetQueryId() == testQueryId); - - CheckCursorReady(cursor); - - for (int32_t i = 0; i < pageSize - 1; ++i) - BOOST_REQUIRE(cursor.Increment()); - - CheckCursorNeedUpdate(cursor); - - resultPage = CreateTestPage(true, pageSize); - - cursor.UpdateData(resultPage); - - CheckCursorReady(cursor); - - for (int32_t i = 0; i < pageSize - 1; ++i) - BOOST_REQUIRE(cursor.Increment()); - - CheckCursorEnd(cursor); -} - -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/src/parser_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/src/parser_test.cpp b/modules/platforms/cpp/odbc/odbc-test/src/parser_test.cpp deleted file mode 100644 index ad8a5b4..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/src/parser_test.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ - -#ifndef _MSC_VER -# define BOOST_TEST_DYN_LINK -#endif - -#include <boost/test/unit_test.hpp> - -#include <ignite/odbc/parser.h> - -using namespace ignite::odbc; - -struct TestMessage -{ - TestMessage() - { - // No-op. - } - - TestMessage(int32_t a, const std::string& b) : a(a), b(b) - { - // No-op. - } - - ~TestMessage() - { - // No-op. - } - - void Write(ignite::impl::binary::BinaryWriterImpl& writer) const - { - writer.WriteInt32(a); - writer.WriteString(b.data(), static_cast<int32_t>(b.size())); - } - - void Read(ignite::impl::binary::BinaryReaderImpl& reader) - { - a = reader.ReadInt32(); - - b.resize(reader.ReadString(0, 0)); - reader.ReadString(&b[0], static_cast<int32_t>(b.size())); - } - - int32_t a; - std::string b; -}; - -bool operator==(const TestMessage& lhs, const TestMessage& rhs) -{ - return lhs.a == rhs.a && - lhs.b == rhs.b; -} - -BOOST_AUTO_TEST_SUITE(ParserTestSuite) - -BOOST_AUTO_TEST_CASE(TestParserEncodeDecode) -{ - Parser parser; - - std::vector<int8_t> outBuffer; - std::vector<int8_t> inBuffer; - - TestMessage outMsg(42, "Test message"); - TestMessage inMsg; - - parser.Encode(outMsg, outBuffer); - - inBuffer.reserve(outBuffer.size()); - - // First 4 bytes contain message size after encoding but are not expected - // during decoding. - std::copy(outBuffer.begin() + 4, outBuffer.end(), std::back_inserter(inBuffer)); - - parser.Decode(inMsg, inBuffer); - - BOOST_REQUIRE(outMsg == inMsg); -} - -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/src/row_test.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/src/row_test.cpp b/modules/platforms/cpp/odbc/odbc-test/src/row_test.cpp deleted file mode 100644 index e655cf7..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/src/row_test.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * 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. - */ - -#ifndef _MSC_VER -# define BOOST_TEST_DYN_LINK -#endif - -#include <boost/test/unit_test.hpp> - -#include <ignite/impl/binary/binary_writer_impl.h> - -#include "ignite/odbc/system/odbc_constants.h" -#include "ignite/odbc/row.h" - -using namespace ignite::odbc::app; -using namespace ignite::odbc; - - -std::string GetStrColumnValue(size_t rowIdx) -{ - std::stringstream generator("Column 2 test string, row num: "); - generator << rowIdx << ". Some trailing bytes"; - - return generator.str(); -} - -void FillMemWithData(ignite::impl::interop::InteropUnpooledMemory& mem, size_t rowNum) -{ - using namespace ignite::impl::binary; - using namespace ignite::impl::interop; - - InteropOutputStream stream(&mem); - BinaryWriterImpl writer(&stream, 0); - - for (size_t i = 0; i < rowNum; ++i) - { - // Number of columns in page. - writer.WriteInt32(4); - - // First column is int. - writer.WriteInt8(IGNITE_TYPE_LONG); - writer.WriteInt64(static_cast<int64_t>(i * 10)); - - // Second column is string. - const std::string& str(GetStrColumnValue(i)); - - writer.WriteString(str.data(), static_cast<int32_t>(str.size())); - - // Third column is GUID. - ignite::Guid guid(0x2b218f63642a4a64ULL, 0x9674098f388ac298ULL + i); - - writer.WriteGuid(guid); - - // The last column is bool. - writer.WriteInt8(IGNITE_TYPE_BOOL); - writer.WriteBool(i % 2 == 1); - } - - stream.Synchronize(); -} - -void CheckRowData(Row& row, size_t rowIdx) -{ - SqlLen reslen; - - long longBuf; - char strBuf[1024]; - SQLGUID guidBuf; - char bitBuf; - size_t* offset = 0; - - ApplicationDataBuffer appLongBuf(type_traits::IGNITE_ODBC_C_TYPE_SIGNED_LONG, &longBuf, sizeof(longBuf), &reslen, &offset); - ApplicationDataBuffer appStrBuf(type_traits::IGNITE_ODBC_C_TYPE_CHAR, &strBuf, sizeof(strBuf), &reslen, &offset); - ApplicationDataBuffer appGuidBuf(type_traits::IGNITE_ODBC_C_TYPE_GUID, &guidBuf, sizeof(guidBuf), &reslen, &offset); - ApplicationDataBuffer appBitBuf(type_traits::IGNITE_ODBC_C_TYPE_BIT, &bitBuf, sizeof(bitBuf), &reslen, &offset); - - // Checking size. - BOOST_REQUIRE(row.GetSize() == 4); - - // Checking 1st column. - BOOST_REQUIRE(row.ReadColumnToBuffer(1, appLongBuf) == SQL_RESULT_SUCCESS); - BOOST_REQUIRE(longBuf == rowIdx * 10); - - // Checking 2nd column. - BOOST_REQUIRE(row.ReadColumnToBuffer(2, appStrBuf) == SQL_RESULT_SUCCESS); - - std::string strReal(strBuf, static_cast<size_t>(reslen)); - std::string strExpected(GetStrColumnValue(rowIdx)); - - BOOST_REQUIRE(strReal == strExpected); - - // Checking 3rd column. - BOOST_REQUIRE(row.ReadColumnToBuffer(3, appGuidBuf) == SQL_RESULT_SUCCESS); - - BOOST_REQUIRE(guidBuf.Data1 == 0x2b218f63UL); - BOOST_REQUIRE(guidBuf.Data2 == 0x642aU); - BOOST_REQUIRE(guidBuf.Data3 == 0x4a64U); - - BOOST_REQUIRE(guidBuf.Data4[0] == 0x96); - BOOST_REQUIRE(guidBuf.Data4[1] == 0x74); - BOOST_REQUIRE(guidBuf.Data4[2] == 0x09); - BOOST_REQUIRE(guidBuf.Data4[3] == 0x8f); - BOOST_REQUIRE(guidBuf.Data4[4] == 0x38); - BOOST_REQUIRE(guidBuf.Data4[5] == 0x8a); - BOOST_REQUIRE(guidBuf.Data4[6] == 0xc2); - BOOST_REQUIRE(guidBuf.Data4[7] == 0x98 + rowIdx); - - // Checking 4th column. - BOOST_REQUIRE(row.ReadColumnToBuffer(4, appBitBuf) == SQL_RESULT_SUCCESS); - BOOST_REQUIRE(bitBuf == rowIdx % 2); -} - - -BOOST_AUTO_TEST_SUITE(RowTestSuite) - -BOOST_AUTO_TEST_CASE(TestRowMoveToNext) -{ - ignite::impl::interop::InteropUnpooledMemory mem(4096); - - const size_t rowNum = 32; - - FillMemWithData(mem, rowNum); - - Row row(mem); - - for (size_t i = 0; i < rowNum - 1; ++i) - { - BOOST_REQUIRE(row.GetSize() == 4); - BOOST_REQUIRE(row.MoveToNext()); - } -} - -BOOST_AUTO_TEST_CASE(TestRowRead) -{ - ignite::impl::interop::InteropUnpooledMemory mem(4096); - - const size_t rowNum = 8; - - FillMemWithData(mem, rowNum); - - Row row(mem); - - BOOST_REQUIRE(row.GetSize() == 4); - - for (size_t i = 0; i < rowNum - 1; ++i) - { - CheckRowData(row, i); - - BOOST_REQUIRE(row.MoveToNext()); - } -} - -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/src/teamcity_boost.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/src/teamcity_boost.cpp b/modules/platforms/cpp/odbc/odbc-test/src/teamcity_boost.cpp deleted file mode 100644 index 45c666d..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/src/teamcity_boost.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* Copyright 2011 JetBrains s.r.o. - * - * Licensed 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. - * - * $Revision: 88625 $ -*/ - -#define BOOST_TEST_MODULE IgniteCoreTest - -#include <sstream> - -#include <boost/test/unit_test_suite_impl.hpp> -#include <boost/test/results_collector.hpp> -#include <boost/test/utils/basic_cstring/io.hpp> -#include <boost/test/unit_test_log.hpp> -#include <boost/test/included/unit_test.hpp> - -#include "teamcity_messages.h" - -using namespace boost::unit_test; -using namespace std; - -namespace JetBrains { - -// Custom formatter for TeamCity messages -class TeamcityBoostLogFormatter: public boost::unit_test::unit_test_log_formatter { - TeamcityMessages messages; - std::string currentDetails; - std::string flowId; - -public: - TeamcityBoostLogFormatter(const std::string &_flowId); - TeamcityBoostLogFormatter(); - - void log_start(std::ostream&, boost::unit_test::counter_t test_cases_amount); - void log_finish(std::ostream&); - void log_build_info(std::ostream&); - - void test_unit_start(std::ostream&, boost::unit_test::test_unit const& tu); - void test_unit_finish(std::ostream&, - boost::unit_test::test_unit const& tu, - unsigned long elapsed); - void test_unit_skipped(std::ostream&, boost::unit_test::test_unit const& tu); - - void log_exception(std::ostream&, - boost::unit_test::log_checkpoint_data const&, - boost::unit_test::const_string explanation); - - void log_entry_start(std::ostream&, - boost::unit_test::log_entry_data const&, - log_entry_types let); - void log_entry_value(std::ostream&, boost::unit_test::const_string value); - void log_entry_finish(std::ostream&); -}; - -// Fake fixture to register formatter -struct TeamcityFormatterRegistrar { - TeamcityFormatterRegistrar() { - if (JetBrains::underTeamcity()) { - boost::unit_test::unit_test_log.set_formatter(new JetBrains::TeamcityBoostLogFormatter()); - boost::unit_test::unit_test_log.set_threshold_level(boost::unit_test::log_successful_tests); - } - } -}; -BOOST_GLOBAL_FIXTURE(TeamcityFormatterRegistrar); - -// Formatter implementation -string toString(const_string bstr) { - stringstream ss; - - ss << bstr; - - return ss.str(); -} - -TeamcityBoostLogFormatter::TeamcityBoostLogFormatter(const std::string &_flowId) -: flowId(_flowId) -{} - -TeamcityBoostLogFormatter::TeamcityBoostLogFormatter() -: flowId(getFlowIdFromEnvironment()) -{} - -void TeamcityBoostLogFormatter::log_start(ostream &out, counter_t test_cases_amount) -{} - -void TeamcityBoostLogFormatter::log_finish(ostream &out) -{} - -void TeamcityBoostLogFormatter::log_build_info(ostream &out) -{} - -void TeamcityBoostLogFormatter::test_unit_start(ostream &out, test_unit const& tu) { - messages.setOutput(out); - - if (tu.p_type == tut_case) { - messages.testStarted(tu.p_name, flowId); - } else { - messages.suiteStarted(tu.p_name, flowId); - } - - currentDetails.clear(); -} - -void TeamcityBoostLogFormatter::test_unit_finish(ostream &out, test_unit const& tu, unsigned long elapsed) { - messages.setOutput(out); - - test_results const& tr = results_collector.results(tu.p_id); - if (tu.p_type == tut_case) { - if(!tr.passed()) { - if(tr.p_skipped) { - messages.testIgnored(tu.p_name, "ignored", flowId); - } else if (tr.p_aborted) { - messages.testFailed(tu.p_name, "aborted", currentDetails, flowId); - } else { - messages.testFailed(tu.p_name, "failed", currentDetails, flowId); - } - } - - messages.testFinished(tu.p_name, elapsed / 1000, flowId); - } else { - messages.suiteFinished(tu.p_name, flowId); - } -} - -void TeamcityBoostLogFormatter::test_unit_skipped(ostream &out, test_unit const& tu) -{} - -void TeamcityBoostLogFormatter::log_exception(ostream &out, log_checkpoint_data const&, const_string explanation) { - string what = toString(explanation); - - out << what << endl; - currentDetails += what + "\n"; -} - -void TeamcityBoostLogFormatter::log_entry_start(ostream&, log_entry_data const&, log_entry_types let) -{} - -void TeamcityBoostLogFormatter::log_entry_value(ostream &out, const_string value) { - out << value; - currentDetails += toString(value); -} - -void TeamcityBoostLogFormatter::log_entry_finish(ostream &out) { - out << endl; - currentDetails += "\n"; -} - -} http://git-wip-us.apache.org/repos/asf/ignite/blob/e8287063/modules/platforms/cpp/odbc/odbc-test/src/teamcity_messages.cpp ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc/odbc-test/src/teamcity_messages.cpp b/modules/platforms/cpp/odbc/odbc-test/src/teamcity_messages.cpp deleted file mode 100644 index 087409e..0000000 --- a/modules/platforms/cpp/odbc/odbc-test/src/teamcity_messages.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* Copyright 2011 JetBrains s.r.o. - * - * Licensed 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. - * - * $Revision: 88625 $ -*/ - -#include <stdlib.h> -#include <sstream> - -#include "teamcity_messages.h" - -using namespace std; - -namespace JetBrains { - -std::string getFlowIdFromEnvironment() { - const char *flowId = getenv("TEAMCITY_PROCESS_FLOW_ID"); - return flowId == NULL ? "" : flowId; -} - -bool underTeamcity() { - return getenv("TEAMCITY_PROJECT_NAME") != NULL; -} - -TeamcityMessages::TeamcityMessages() -: m_out(&cout) -{} - -void TeamcityMessages::setOutput(ostream &out) { - m_out = &out; -} - -string TeamcityMessages::escape(string s) { - string result; - - for (size_t i = 0; i < s.length(); i++) { - char c = s[i]; - - switch (c) { - case '\n': result.append("|n"); break; - case '\r': result.append("|r"); break; - case '\'': result.append("|'"); break; - case '|': result.append("||"); break; - case ']': result.append("|]"); break; - default: result.append(&c, 1); - } - } - - return result; -} - -void TeamcityMessages::openMsg(const string &name) { - // endl for http://jetbrains.net/tracker/issue/TW-4412 - *m_out << endl << "##teamcity[" << name; -} - -void TeamcityMessages::closeMsg() { - *m_out << "]"; - // endl for http://jetbrains.net/tracker/issue/TW-4412 - *m_out << endl; - m_out->flush(); -} - -void TeamcityMessages::writeProperty(string name, string value) { - *m_out << " " << name << "='" << escape(value) << "'"; -} - -void TeamcityMessages::suiteStarted(string name, string flowid) { - openMsg("testSuiteStarted"); - writeProperty("name", name); - if(flowid.length() > 0) { - writeProperty("flowId", flowid); - } - - closeMsg(); -} - -void TeamcityMessages::suiteFinished(string name, string flowid) { - openMsg("testSuiteFinished"); - writeProperty("name", name); - if(flowid.length() > 0) { - writeProperty("flowId", flowid); - } - - closeMsg(); -} - -void TeamcityMessages::testStarted(string name, string flowid) { - openMsg("testStarted"); - writeProperty("name", name); - if(flowid.length() > 0) { - writeProperty("flowId", flowid); - } - - closeMsg(); -} - -void TeamcityMessages::testFinished(string name, int durationMs, string flowid) { - openMsg("testFinished"); - - writeProperty("name", name); - - if(flowid.length() > 0) { - writeProperty("flowId", flowid); - } - - if(durationMs >= 0) { - stringstream out; - out << durationMs; - writeProperty("duration", out.str()); - } - - closeMsg(); -} - -void TeamcityMessages::testFailed(string name, string message, string details, string flowid) { - openMsg("testFailed"); - writeProperty("name", name); - writeProperty("message", message); - writeProperty("details", details); - if(flowid.length() > 0) { - writeProperty("flowId", flowid); - } - - closeMsg(); -} - -void TeamcityMessages::testIgnored(std::string name, std::string message, string flowid) { - openMsg("testIgnored"); - writeProperty("name", name); - writeProperty("message", message); - if(flowid.length() > 0) { - writeProperty("flowId", flowid); - } - - closeMsg(); -} - -}
