├── tools
├── CMakeLists.txt
└── codegentool
│ └── CMakeLists.txt
├── samples
└── ios
│ └── TripPin
│ ├── TripPin
│ ├── en.lproj
│ │ └── InfoPlist.strings
│ ├── main.m
│ ├── TripPin-Prefix.pch
│ ├── Images.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ └── LaunchImage.launchimage
│ │ │ └── Contents.json
│ ├── MasterViewController.h
│ ├── AppDelegate.h
│ ├── DetailViewController.h
│ ├── DetailViewController.m
│ ├── TripPin-Info.plist
│ └── AppDelegate.m
│ └── TripPin.xcodeproj
│ └── project.xcworkspace
│ └── contents.xcworkspacedata
├── msvc
├── vs11
│ ├── .nuget
│ │ ├── NuGet.exe
│ │ └── NuGet.Config
│ ├── packages.config
│ ├── dirs.proj
│ ├── utilities.vs11.vcxproj.filters
│ ├── TestRunner.vs11.vcxproj.filters
│ ├── Common.vs11.props
│ └── odatacpp_samples.sln
├── vs12
│ ├── .nuget
│ │ ├── NuGet.exe
│ │ └── NuGet.Config
│ ├── packages.config
│ ├── dirs.proj
│ ├── utilities.vs12.vcxproj.filters
│ ├── TestRunner.vs12.vcxproj.filters
│ ├── Common.vs12.props
│ └── odatacpp_samples.sln
├── dirs.proj
└── Common.Build.Traversal.targets
├── tests
├── framework
│ ├── CMakeLists.txt
│ ├── utilities
│ │ ├── CMakeLists.txt
│ │ ├── stdafx.h
│ │ ├── include
│ │ │ ├── common_utilities_public.h
│ │ │ └── os_utilities.h
│ │ ├── targetver.h
│ │ └── os_utilities.cpp
│ ├── TestRunner
│ │ ├── run_tests.sh
│ │ └── test_module_loader.h
│ └── UnitTestpp
│ │ ├── COPYING
│ │ ├── CMakeLists.txt
│ │ ├── ThirdPartyNotices.txt
│ │ ├── src
│ │ ├── tests
│ │ │ ├── stdafx.cpp
│ │ │ ├── TestTestSuite.cpp
│ │ │ ├── stdafx.h
│ │ │ ├── TestCurrentTest.cpp
│ │ │ ├── TestTestList.cpp
│ │ │ └── ScopedCurrentTest.h
│ │ ├── TimeHelpers.h
│ │ ├── TestReporter.cpp
│ │ ├── TestSuite.h
│ │ ├── AssertException.cpp
│ │ ├── ReportAssert.h
│ │ ├── CurrentTest.cpp
│ │ ├── CurrentTest.h
│ │ ├── Posix
│ │ │ ├── TimeHelpers.h
│ │ │ ├── TimeHelpers.cpp
│ │ │ └── SignalTranslator.h
│ │ ├── AssertException.h
│ │ ├── ExceptionMacros.h
│ │ ├── TestHeader.h
│ │ ├── TestDetails.cpp
│ │ ├── Test.cpp
│ │ ├── TestList.h
│ │ ├── TestReporterStdout.h
│ │ ├── TestDetails.h
│ │ ├── Test.h
│ │ ├── TestReporter.h
│ │ ├── Win32
│ │ │ └── TimeHelpers.h
│ │ ├── GlobalSettings.h
│ │ ├── DeferredTestReporter.h
│ │ ├── DeferredTestReporter.cpp
│ │ ├── GlobalSettings.cpp
│ │ └── DeferredTestResult.h
│ │ └── unittestpp.h
├── CMakeLists.txt
├── e2e
│ ├── e2e_test_case.cpp
│ ├── e2e_tests.h
│ ├── CMakeLists.txt
│ ├── exchange_tests.cpp
│ ├── e2e_test_case.h
│ ├── exchange_test_case.h
│ └── edit_link_tests.cpp
└── functional
│ ├── odata_tests.h
│ ├── codegen_tool_test
│ ├── baseline
│ │ ├── SimpleModel.xml
│ │ ├── simple_model_test_baseline.cpp
│ │ └── simple_model_test_baseline.h
│ └── codegen_basic_test.cpp
│ ├── CMakeLists.txt
│ └── core_test
│ ├── odata_entity_value_test.cpp
│ └── odata_collection_value_test.cpp
├── scripts
├── add_license_header.sh
└── copyright.txt
├── dirs.proj
├── ios
├── configure.sh
└── CMakeLists.txt
├── setup_ps_env_VS2012.ps1
├── setup_ps_env_VS2013.ps1
├── include
└── odata
│ ├── edm
│ ├── odata_edm.h
│ ├── edm_navigation_source.h
│ ├── edm_operation_import.h
│ ├── edm_entity_set.h
│ ├── edm_model_reader.h
│ └── edm_singleton.h
│ ├── communication
│ ├── http_utility.h
│ ├── http_service_exception.h
│ └── http_communication.h
│ ├── core
│ ├── odata_complex_value.h
│ ├── odata_core.h
│ ├── odata_enum_value.h
│ ├── odata_entity_model_builder.h
│ ├── odata_json_constants.h
│ ├── odata_collection_value.h
│ ├── odata_entity_value.h
│ ├── odata_entity_factory.h
│ ├── odata_parameter.h
│ ├── odata_context_url_parser.h
│ ├── odata_value.h
│ ├── odata_json_operation_url_parameter_writer.h
│ ├── odata_json_writer.h
│ ├── odata_json_operation_payload_parameter_writer.h
│ ├── odata_json_reader.h
│ └── odata_payload.h
│ ├── common
│ ├── platform.h
│ └── utility.h
│ └── codegen
│ ├── odata_void_query_executor.h
│ ├── odata_query_option.h
│ ├── code_generation_base.h
│ ├── code_generation_helper.h
│ └── odata_query_builder.h
├── src
├── core
│ ├── odata_json_constants.cpp
│ ├── odata_entity_value.cpp
│ └── odata_structured_value.cpp
├── edm
│ ├── edm_entity_container.cpp
│ └── edm_schema.cpp
├── CMakeLists.txt
├── codegen
│ └── odata_query_path.cpp
└── communication
│ └── http_implement.cpp
└── LICENSE.txt
/tools/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(codegentool)
--------------------------------------------------------------------------------
/samples/ios/TripPin/TripPin/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/msvc/vs11/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OData/odatacpp-client/HEAD/msvc/vs11/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/msvc/vs12/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OData/odatacpp-client/HEAD/msvc/vs12/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/tests/framework/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(utilities)
2 | add_subdirectory(UnitTestpp)
3 | add_subdirectory(TestRunner)
4 |
--------------------------------------------------------------------------------
/msvc/vs11/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/msvc/vs12/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/msvc/vs11/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/msvc/vs12/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/scripts/add_license_header.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | for f in $(find ../ -name '*.cpp' -or -name '*.h')
3 | do
4 | echo "Processing $f"
5 | if ! grep -q Copyright $f
6 | then
7 | cat copyright.txt $f >$f.new && mv $f.new $f
8 | fi
9 | done
--------------------------------------------------------------------------------
/samples/ios/TripPin/TripPin.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(ODATACPP_TEST_FRAMEWORK_DIR ${ODATACPP_TEST_DIR}/framework)
2 | set(UnitTestpp_INCLUDE_DIR ${ODATACPP_TEST_FRAMEWORK_DIR}/UnitTestpp)
3 | set(Utilities_INCLUDE_DIR ${ODATACPP_TEST_FRAMEWORK_DIR}/utilities/include)
4 |
5 | add_subdirectory(framework)
6 | add_subdirectory(functional)
7 | add_subdirectory(e2e)
--------------------------------------------------------------------------------
/samples/ios/TripPin/TripPin/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // TripPin
4 | //
5 | // Created by xubin on 7/31/14.
6 | //
7 | //
8 |
9 | #import
10 |
11 | #import "AppDelegate.h"
12 |
13 | int main(int argc, char * argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/e2e/e2e_test_case.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #include "e2e_test_case.h"
--------------------------------------------------------------------------------
/samples/ios/TripPin/TripPin/TripPin-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #import
8 |
9 | #ifndef __IPHONE_5_0
10 | #warning "This project uses features only available in iOS SDK 5.0 and later."
11 | #endif
12 |
13 | #ifdef __OBJC__
14 | #import
15 | #import
16 | #endif
17 |
--------------------------------------------------------------------------------
/tests/framework/utilities/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include_directories(include)
2 |
3 | if(UNIX)
4 | set(CXX_FLAGS "${CXX_FLAGS} -include ${ODATACPP_INCLUDE_DIR}/compat/linux_compat.h")
5 | elseif(WIN32)
6 | add_definitions(-DCOMMONUTILITIES_EXPORTS)
7 | endif()
8 |
9 | add_library(${LIB}utilities
10 | os_utilities.cpp
11 | )
12 |
13 | target_link_libraries(${LIB}utilities
14 | ${LIB}unittestpp
15 | #${BOOST_SYSTEM_LIBRARY}
16 | #${BOOST_THREAD_LIBRARY}
17 | )
18 |
--------------------------------------------------------------------------------
/dirs.proj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/samples/ios/TripPin/TripPin/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "40x40",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "60x60",
16 | "scale" : "2x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/tools/codegentool/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Target
2 | set(ODATACPP_TOOLS_CODEGENTOOL odata-codegen-tool)
3 |
4 | set(ODATACPP_TOOLS_CODEGENTOOL_SOURCES
5 | odata_codegen_initializer.cpp
6 | odata_codegen_tools.cpp
7 | odata_codegen_writer.cpp
8 | )
9 |
10 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS} -Werror -pedantic")
11 |
12 | add_executable(${ODATACPP_TOOLS_CODEGENTOOL} ${ODATACPP_TOOLS_CODEGENTOOL_SOURCES})
13 |
14 | target_link_libraries(${ODATACPP_TOOLS_CODEGENTOOL}
15 | ${ODATACPP_CLIENT}
16 | )
17 |
--------------------------------------------------------------------------------
/samples/ios/TripPin/TripPin/MasterViewController.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #import
8 |
9 | @interface MasterViewController : UITableViewController
10 |
11 | @end
12 |
--------------------------------------------------------------------------------
/ios/configure.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | BASEDIR=$(dirname $0)
5 |
6 | rm -rf $BASEDIR/boost.framework
7 | cp -R $BASEDIR/../lib/casablanca/Build_iOS/boost.framework $BASEDIR/boost.framework
8 |
9 | rm -rf $BASEDIR/ios-cmake
10 | cp -R $BASEDIR/../lib/casablanca/Build_iOS/ios-cmake $BASEDIR/ios-cmake
11 |
12 | rm -rf $BASEDIR/build.ios
13 | mkdir $BASEDIR/build.ios
14 | pushd $BASEDIR/build.ios
15 | cmake .. -DCMAKE_BUILD_TYPE=Release
16 | make
17 | popd
18 | echo "===="
19 | echo "The final library is available in 'build.ios/libodata-client.a'"
20 |
--------------------------------------------------------------------------------
/samples/ios/TripPin/TripPin/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #import
8 |
9 | @interface AppDelegate : UIResponder
10 |
11 | @property (strong, nonatomic) UIWindow *window;
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/msvc/dirs.proj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/samples/ios/TripPin/TripPin/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "orientation" : "portrait",
12 | "idiom" : "iphone",
13 | "subtype" : "retina4",
14 | "extent" : "full-screen",
15 | "minimum-system-version" : "7.0",
16 | "scale" : "2x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/setup_ps_env_VS2012.ps1:
--------------------------------------------------------------------------------
1 | function Get-Batchfile ($file) {
2 | $cmd = "`"$file`" & set"
3 | cmd /c $cmd | Foreach-Object {
4 | $p, $v = $_.split('=')
5 | Set-Item -path env:$p -value $v
6 | }
7 | }
8 |
9 | function VsVars32()
10 | {
11 | $vs110comntools = (Get-ChildItem env:VS110COMNTOOLS).Value
12 | $batchFile = [System.IO.Path]::Combine($vs110comntools, "vsvars32.bat")
13 | Get-Batchfile $BatchFile
14 | }
15 |
16 | "Initializing ODataCpp Powershell VS2012 Environment"
17 |
18 | # get VS tools
19 | VsVars32
20 |
21 | $Env:VisualStudioVersion = "11.0"
22 | $Env:DevToolsVersion = "110"
23 |
--------------------------------------------------------------------------------
/setup_ps_env_VS2013.ps1:
--------------------------------------------------------------------------------
1 | function Get-Batchfile ($file) {
2 | $cmd = "`"$file`" & set"
3 | cmd /c $cmd | Foreach-Object {
4 | $p, $v = $_.split('=')
5 | Set-Item -path env:$p -value $v
6 | }
7 | }
8 |
9 | function VsVars32()
10 | {
11 | $vs120comntools = (Get-ChildItem env:VS120COMNTOOLS).Value
12 | $batchFile = [System.IO.Path]::Combine($vs120comntools, "vsvars32.bat")
13 | Get-Batchfile $BatchFile
14 | }
15 |
16 | "Initializing ODataCpp Powershell VS2013 Environment"
17 |
18 | # get VS tools
19 | VsVars32
20 |
21 | $Env:VisualStudioVersion = "12.0"
22 | $Env:DevToolsVersion = "120"
23 |
--------------------------------------------------------------------------------
/tests/framework/utilities/stdafx.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #ifdef WIN32
10 |
11 | #include "targetver.h"
12 |
13 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
14 | #define NOMINMAX
15 | #include
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/samples/ios/TripPin/TripPin/DetailViewController.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #import
8 |
9 | @interface DetailViewController : UIViewController
10 |
11 | @property (strong, nonatomic) id detailItem;
12 |
13 | @property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel;
14 | @end
15 |
--------------------------------------------------------------------------------
/scripts/copyright.txt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) Microsoft Corporation. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
--------------------------------------------------------------------------------
/tests/framework/TestRunner/run_tests.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DEBUGGER=""
4 | ENABLE_DEBUG_MODE=""
5 | if [ "$1" = "--debug" ]; then
6 | DEBUGGER="gdb -args" # -q -x automate_gdb -args"
7 | ENABLE_DEBUG_MODE="/breakonerror"
8 | fi
9 |
10 | export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
11 |
12 | exit_code=0
13 |
14 | for test_lib in *_test.so; do
15 | $DEBUGGER ./test_runner $ENABLE_DEBUG_MODE $test_lib
16 | if [ $? -ne 0 ]
17 | then
18 | echo "Test suite failed"
19 | exit_code=1
20 | fi
21 | done
22 | if [ $exit_code -eq 0 ];
23 | then
24 | echo "All tests finished successfully"
25 | else
26 | echo "Some tests failed"
27 | fi
28 | date
29 | exit $exit_code
30 |
31 |
--------------------------------------------------------------------------------
/include/odata/edm/odata_edm.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/common/utility.h"
10 | #include "odata/edm/edm_type.h"
11 | #include "odata/edm/edm_entity_set.h"
12 | #include "odata/edm/edm_operation_import.h"
13 | #include "odata/edm/edm_entity_container.h"
14 | #include "odata/edm/edm_schema.h"
15 | #include "odata/edm/edm_model.h"
16 | #include "odata/edm/edm_singleton.h"
17 |
--------------------------------------------------------------------------------
/include/odata/communication/http_utility.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include
10 | #include "cpprest/http_client.h"
11 |
12 |
13 | namespace odata { namespace communication
14 | {
15 |
16 | class http_utility
17 | {
18 | public:
19 | static bool is_successful_status_code(::web::http::status_code code)
20 | {
21 | return (200 <= code) && (code < 300);
22 | }
23 | };
24 | }}
--------------------------------------------------------------------------------
/tests/functional/odata_tests.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/client/odata_client.h"
10 |
11 | #include "unittestpp.h"
12 | #include "os_utilities.h"
13 |
14 |
15 | extern const char* test_model_string;
16 | extern std::shared_ptr<::odata::edm::edm_model> g_test_model;
17 | extern ::utility::string_t g_service_root_url;
18 |
19 | std::shared_ptr<::odata::edm::edm_model> get_test_model();
--------------------------------------------------------------------------------
/include/odata/core/odata_complex_value.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/edm/odata_edm.h"
10 | #include "odata/core/odata_value.h"
11 | #include "odata/core/odata_structured_value.h"
12 |
13 | namespace odata { namespace core
14 | {
15 |
16 | class odata_complex_value : public odata_structured_value
17 | {
18 | public:
19 | odata_complex_value(std::shared_ptr<::odata::edm::edm_named_type> type) : odata_structured_value(type)
20 | {
21 | }
22 | };
23 |
24 | }}
--------------------------------------------------------------------------------
/tests/e2e/e2e_tests.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/client/odata_client.h"
10 | #include "unittestpp.h"
11 | #include "e2e_test_case.h"
12 | #include "odata/codegen/odata_entityset_query_executor.h"
13 | #include "odata/codegen/odata_singleton_query_executor.h"
14 | #include "odata/codegen/odata_primitive_query_executor.h"
15 | #include "odata/codegen/odata_complex_query_executor.h"
16 | #include "odata/codegen/odata_void_query_executor.h"
17 | #include "odata/codegen/odata_enum_query_executor.h"
--------------------------------------------------------------------------------
/tests/framework/utilities/include/common_utilities_public.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #if !defined(_WIN32) && !defined(__cplusplus_winrt)
10 | #define TEST_UTILITY_API
11 | #endif // !_WIN32 && !__cplusplus_winrt
12 |
13 | #ifndef TEST_UTILITY_API
14 | #ifdef COMMONUTILITIES_EXPORTS
15 | #define TEST_UTILITY_API __declspec(dllexport)
16 | #else // COMMONUTILITIES_EXPORTS
17 | #define TEST_UTILITY_API __declspec(dllimport)
18 | #endif // COMMONUTILITIES_EXPORTS
19 | #endif // TEST_UTILITY_API
20 |
--------------------------------------------------------------------------------
/msvc/vs11/dirs.proj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/msvc/vs12/dirs.proj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/tests/e2e/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include_directories(
2 | ${UnitTestpp_INCLUDE_DIR}
3 | ${Utilities_INCLUDE_DIR}
4 | )
5 |
6 | # Target
7 | set(ODATACPP_TESTS_E2E odata-tests-e2e)
8 |
9 | set(ODATACPP_TESTS_E2E_SOURCES
10 | common_tests.cpp
11 | containment_tests.cpp
12 | containment_tests.cpp
13 | function_action_tests.cpp
14 | derived_type_tests.cpp
15 | navigation_property_tests.cpp
16 | e2e_test_case.cpp
17 | odata_wcf_service.cpp
18 | edit_link_tests.cpp
19 | query_option_tests.cpp
20 | enum_tests.cpp
21 | reference_tests.cpp
22 | exchange_service.cpp
23 | singleton_tests.cpp
24 | )
25 |
26 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
27 |
28 | add_library(${ODATACPP_TESTS_E2E} ${ODATACPP_TESTS_E2E_SOURCES})
29 |
30 | target_link_libraries(${ODATACPP_TESTS_E2E}
31 | ${ODATACPP_CLIENT}
32 | unittestpp
33 | utilities
34 | )
35 |
--------------------------------------------------------------------------------
/include/odata/common/platform.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #if defined(_MSC_VER) && (_MSC_VER >= 1800)
10 | #include
11 | namespace pplx = Concurrency;
12 | #else
13 | #include "pplx/pplxtasks.h"
14 | #endif
15 |
16 | #ifdef _MSC_VER
17 | #pragma warning(disable:4146 4267 4521 4522 4566 4996)
18 | #endif
19 |
20 | #define U(x) _XPLATSTR(x)
21 |
22 | #ifndef ODATACPP_CLIENT_API
23 | #ifdef ODATACLIENT_EXPORTS
24 | #define ODATACPP_CLIENT_API __declspec(dllexport)
25 | #else
26 | #define ODATACPP_CLIENT_API __declspec(dllimport)
27 | #endif
28 | #endif
--------------------------------------------------------------------------------
/include/odata/core/odata_core.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/core/odata_value.h"
10 | #include "odata/core/odata_collection_value.h"
11 | #include "odata/core/odata_complex_value.h"
12 | #include "odata/core/odata_primitive_value.h"
13 | #include "odata/core/odata_enum_value.h"
14 | #include "odata/core/odata_property_map.h"
15 | #include "odata/core/odata_entity_value.h"
16 | #include "odata/core/odata_payload.h"
17 | #include "odata/core/odata_entity_model_builder.h"
18 | #include "odata/core/odata_parameter.h"
19 | #include "odata/core/odata_json_constants.h"
20 |
--------------------------------------------------------------------------------
/tests/functional/codegen_tool_test/baseline/SimpleModel.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/msvc/vs11/utilities.vs11.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Source Files
6 |
7 |
8 |
9 |
10 | Header Files
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | {24e13f0e-e0f6-4fe0-922a-5cf7cbe823f4}
19 |
20 |
21 | {ef18a939-f1a3-4e9e-b93a-05826fbae7f6}
22 |
23 |
24 |
--------------------------------------------------------------------------------
/msvc/vs12/utilities.vs12.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Source Files
6 |
7 |
8 |
9 |
10 | Header Files
11 |
12 |
13 | Header Files
14 |
15 |
16 |
17 |
18 | {24e13f0e-e0f6-4fe0-922a-5cf7cbe823f4}
19 |
20 |
21 | {ef18a939-f1a3-4e9e-b93a-05826fbae7f6}
22 |
23 |
24 |
--------------------------------------------------------------------------------
/include/odata/core/odata_enum_value.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/edm/odata_edm.h"
10 | #include "odata/core/odata_value.h"
11 |
12 | namespace odata { namespace core
13 | {
14 |
15 | class odata_enum_value : public odata_value
16 | {
17 | public:
18 | odata_enum_value(std::shared_ptr<::odata::edm::edm_named_type>type, ::utility::string_t stringRep) : odata_value(type), m_string_rep(std::move(stringRep))
19 | {
20 | }
21 |
22 | const ::utility::string_t& to_string() const
23 | {
24 | return m_string_rep;
25 | }
26 |
27 | private:
28 | ::utility::string_t m_string_rep;
29 |
30 | };
31 |
32 | }}
--------------------------------------------------------------------------------
/src/core/odata_json_constants.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #include "odata/core/odata_json_constants.h"
8 |
9 | namespace odata { namespace core
10 | {
11 | const ::utility::string_t odata_json_constants::PAYLOAD_ANNOTATION_NAVIGATIONLINK = U("@odata.navigationLink");
12 | const ::utility::string_t odata_json_constants::PAYLOAD_ANNOTATION_READLINK(U("@odata.readLink"));
13 | const ::utility::string_t odata_json_constants::PAYLOAD_ANNOTATION_EDITLINK(U("@odata.editLink"));
14 | const ::utility::string_t odata_json_constants::PAYLOAD_ANNOTATION_TYPE(U("@odata.type"));
15 | const ::utility::string_t odata_json_constants::PAYLOAD_ANNOTATION_ID(U("@odata.id"));
16 | }}
--------------------------------------------------------------------------------
/tests/functional/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include_directories(
2 | ${UnitTestpp_INCLUDE_DIR}
3 | ${Utilities_INCLUDE_DIR}
4 | )
5 |
6 | # Target
7 | set(ODATACPP_TESTS_FUNCTIONAL odata-tests-functional)
8 |
9 | set(ODATACPP_TESTS_FUNCTIONAL_SOURCES
10 | odata_tests.cpp
11 | client_test/odata_query_builder_test.cpp
12 | codegen_test/codegen_test.cpp
13 | codegen_test/codegen_test_service.cpp
14 | common_test/common_utility_test.cpp
15 | core_test/odata_collection_value_test.cpp
16 | core_test/odata_json_writer_test.cpp
17 | core_test/odata_context_url_parser_test.cpp
18 | core_test/odata_value_test.cpp
19 | core_test/odata_json_reader_test.cpp
20 | edm_test/edm_model_reader_test.cpp
21 | edm_test/edm_model_utility_test.cpp
22 | )
23 |
24 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
25 |
26 | add_library(${ODATACPP_TESTS_FUNCTIONAL} ${ODATACPP_TESTS_FUNCTIONAL_SOURCES})
27 |
28 | target_link_libraries(${ODATACPP_TESTS_FUNCTIONAL}
29 | ${ODATACPP_CLIENT}
30 | unittestpp
31 | utilities
32 | )
33 |
--------------------------------------------------------------------------------
/msvc/Common.Build.Traversal.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
8 |
9 |
10 |
11 |
12 | true
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/msvc/vs11/TestRunner.vs11.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Source Files
6 |
7 |
8 | Source Files
9 |
10 |
11 |
12 |
13 | {5e4d32c8-a472-4388-b880-920a7a546fa3}
14 |
15 |
16 | {f05a925c-282c-4424-ae9a-10fe7f88fe47}
17 |
18 |
19 |
20 |
21 | Header Files
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/msvc/vs12/TestRunner.vs12.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Source Files
6 |
7 |
8 | Source Files
9 |
10 |
11 |
12 |
13 | {5e4d32c8-a472-4388-b880-920a7a546fa3}
14 |
15 |
16 | {f05a925c-282c-4424-ae9a-10fe7f88fe47}
17 |
18 |
19 |
20 |
21 | Header Files
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/include/odata/core/odata_entity_model_builder.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/core/odata_entity_value.h"
10 | #include "odata/edm/odata_edm.h"
11 |
12 | namespace odata { namespace core
13 | {
14 |
15 | class odata_entity_model_builder
16 | {
17 | public:
18 | ODATACPP_CLIENT_API static ::utility::string_t compute_edit_link(
19 | const ::utility::string_t& root_url,
20 | std::shared_ptr entity_value,
21 | const ::utility::string_t& parent_edit_link,
22 | bool is_collection_navigation);
23 |
24 | ODATACPP_CLIENT_API static ::utility::string_t get_entity_key_value_string(const std::shared_ptr& entity_value);
25 | };
26 |
27 | }}
--------------------------------------------------------------------------------
/include/odata/core/odata_json_constants.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "cpprest/basic_types.h"
10 | #include "odata/common/platform.h"
11 |
12 | namespace odata { namespace core
13 | {
14 | class odata_json_constants
15 | {
16 | public:
17 | ODATACPP_CLIENT_API static const ::utility::string_t PAYLOAD_ANNOTATION_NAVIGATIONLINK;
18 | ODATACPP_CLIENT_API static const ::utility::string_t PAYLOAD_ANNOTATION_READLINK;
19 | ODATACPP_CLIENT_API static const ::utility::string_t PAYLOAD_ANNOTATION_EDITLINK;
20 | ODATACPP_CLIENT_API static const ::utility::string_t PAYLOAD_ANNOTATION_TYPE;
21 | ODATACPP_CLIENT_API static const ::utility::string_t PAYLOAD_ANNOTATION_ID;
22 | };
23 |
24 | }}
--------------------------------------------------------------------------------
/tests/framework/utilities/include/os_utilities.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "common_utilities_public.h"
10 |
11 | namespace tests { namespace common { namespace utilities {
12 |
13 | class os_utilities
14 | {
15 | public:
16 |
17 | static TEST_UTILITY_API void sleep(unsigned long ms);
18 |
19 | // Could use std::atomics but VS 2010 doesn't support it yet.
20 | static TEST_UTILITY_API unsigned long interlocked_increment(volatile unsigned long *addend);
21 | static TEST_UTILITY_API long interlocked_exchange(volatile long *target, long value);
22 |
23 | private:
24 | os_utilities();
25 | os_utilities(const os_utilities &);
26 | os_utilities & operator=(const os_utilities &);
27 | };
28 |
29 | }}}
30 |
31 |
--------------------------------------------------------------------------------
/tests/e2e/exchange_tests.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #include "e2e_tests.h"
8 | #include "exchange_service.h"
9 |
10 | namespace tests { namespace e2e { namespace odata {
11 |
12 | using namespace exchange_service;
13 |
14 | class exchange_test_case
15 | {
16 | public:
17 | std::shared_ptr service_context;
18 |
19 | exchange_test_case() {
20 | service_context = std::make_shared(U("http://odatae2etest.azurewebsites.net/cpptemp/DefaultService/"));
21 | }
22 | };
23 |
24 | SUITE(exchange_tests)
25 | {
26 |
27 | TEST_FIXTURE(exchange_test_case, query_users)
28 | {
29 | //auto users = service_context->create_users_query()->execute_query().get();
30 |
31 | //VERIFY_IS_TRUE(users.size() > 0);
32 | }
33 |
34 |
35 | }
36 |
37 | }}}
--------------------------------------------------------------------------------
/include/odata/core/odata_collection_value.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/edm/odata_edm.h"
10 | #include "odata/core/odata_value.h"
11 |
12 | namespace odata { namespace core
13 | {
14 |
15 | class odata_collection_value : public odata_value
16 | {
17 | public:
18 | odata_collection_value(std::shared_ptr<::odata::edm::edm_named_type> type) : odata_value(type)
19 | {
20 | }
21 |
22 | void add_collection_value(std::shared_ptr value)
23 | {
24 | m_values.push_back(value);
25 | }
26 |
27 | const std::vector>& get_collection_values() const
28 | {
29 | return m_values;
30 | }
31 |
32 | private:
33 | std::vector> m_values;
34 | };
35 |
36 | }}
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | ODataCpp Client ver. 1.0.0
2 | Copyright (c) Microsoft Corporation
3 | All rights reserved.
4 | MIT License
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/include/odata/core/odata_entity_value.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/edm/odata_edm.h"
10 | #include "odata/core/odata_value.h"
11 | #include "odata/core/odata_structured_value.h"
12 |
13 | namespace odata { namespace core
14 | {
15 |
16 | class odata_entity_value : public odata_structured_value
17 | {
18 | public:
19 | odata_entity_value(std::shared_ptr<::odata::edm::edm_entity_type> type) : odata_structured_value(type)
20 | {}
21 |
22 | odata_entity_value(odata_property_map properties, std::shared_ptr<::odata::edm::edm_entity_type> type) : odata_structured_value(type, properties)
23 | {}
24 |
25 | ODATACPP_CLIENT_API ::utility::string_t get_entity_key_string();
26 |
27 | private:
28 | ::utility::string_t to_key(std::shared_ptr value);
29 | };
30 |
31 | }}
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/COPYING:
--------------------------------------------------------------------------------
1 | Copyright (c) 2006 Noel Llopis and Charles Nicholson
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included
12 | in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/samples/ios/TripPin/TripPin/DetailViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // DetailViewController.m
3 | // TripPin
4 | //
5 | // Created by xubin on 7/31/14.
6 | //
7 | //
8 |
9 | #import "DetailViewController.h"
10 |
11 | @interface DetailViewController ()
12 | - (void)configureView;
13 | @end
14 |
15 | @implementation DetailViewController
16 |
17 | #pragma mark - Managing the detail item
18 |
19 | - (void)setDetailItem:(id)newDetailItem
20 | {
21 | if (_detailItem != newDetailItem) {
22 | _detailItem = newDetailItem;
23 |
24 | // Update the view.
25 | [self configureView];
26 | }
27 | }
28 |
29 | - (void)configureView
30 | {
31 | // Update the user interface for the detail item.
32 |
33 | if (self.detailItem) {
34 | self.detailDescriptionLabel.text = [self.detailItem description];
35 | }
36 | }
37 |
38 | - (void)viewDidLoad
39 | {
40 | [super viewDidLoad];
41 | // Do any additional setup after loading the view, typically from a nib.
42 | [self configureView];
43 | }
44 |
45 | - (void)didReceiveMemoryWarning
46 | {
47 | [super didReceiveMemoryWarning];
48 | // Dispose of any resources that can be recreated.
49 | }
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/include/odata/communication/http_service_exception.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/common/utility.h"
10 | #include "cpprest/asyncrt_utils.h"
11 |
12 | namespace odata { namespace communication
13 | {
14 |
15 | ///
16 | /// Represents an OData service operation exception
17 | ///
18 | class service_exception : public std::exception
19 | {
20 | public:
21 |
22 | ///
23 | /// Constructor
24 | ///
25 | /// A string value containing the service error.
26 | explicit service_exception(::utility::string_t error) : m_error(error)
27 | {
28 | }
29 |
30 | ///
31 | /// Destructor
32 | ///
33 | ~service_exception() _noexcept {}
34 |
35 | const ::utility::string_t& what()
36 | {
37 | return m_error;
38 | }
39 |
40 | private:
41 | ::utility::string_t m_error;
42 | };
43 |
44 | }}
--------------------------------------------------------------------------------
/tests/e2e/e2e_test_case.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 | #include "odata/client/odata_client.h"
9 | #include "odata_wcf_service.h"
10 |
11 | namespace tests { namespace e2e { namespace odata {
12 |
13 | using namespace ::odata::client;
14 | using namespace ::utility;
15 | using namespace odata_wcf_service;
16 |
17 | class e2e_raw_client
18 | {
19 | public:
20 | odata_client client;
21 |
22 | e2e_raw_client() : client(U("http://odatae2etest.azurewebsites.net/cpptest/DefaultService")) {
23 | //Reset data source first.
24 | client.send_data_to_server(U("ResetDataSource")).get();
25 | }
26 | };
27 |
28 |
29 | class e2e_test_case
30 | {
31 | public:
32 | std::shared_ptr service_context;
33 |
34 | e2e_test_case() {
35 | service_context = std::make_shared(U("http://odatae2etest.azurewebsites.net/cpptest/DefaultService"));
36 |
37 | //Reset data source first.
38 | service_context->ResetDataSource().get();
39 | }
40 | };
41 | }}}
--------------------------------------------------------------------------------
/tests/functional/codegen_tool_test/codegen_basic_test.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #include "codegen_tool_test_case.h"
8 |
9 | namespace tests { namespace functional { namespace _odata {
10 |
11 | SUITE(codegen_basic_test)
12 | {
13 |
14 | TEST_FIXTURE(codegen_tool_test_case, simple_model_test)
15 | {
16 | ::std::string metadata_file_name("SimpleModel.xml"), baseline_file_name("simple_model_test_baseline"), generated_file_name("simple_model_test");
17 | set_test_parameters(metadata_file_name, baseline_file_name, generated_file_name);
18 |
19 | generate_code_files();
20 | compare_with_baseline();
21 | }
22 |
23 | TEST_FIXTURE(codegen_tool_test_case, default_service_test)
24 | {
25 | ::std::string metadata_file_name("DefaultServiceModel.xml"), baseline_file_name("default_service_test_baseline"), generated_file_name("default_service_test");
26 | set_test_parameters(metadata_file_name, baseline_file_name, generated_file_name);
27 |
28 | generate_code_files();
29 | compare_with_baseline();
30 | }
31 |
32 | }
33 |
34 | }}}
--------------------------------------------------------------------------------
/tests/framework/utilities/targetver.h:
--------------------------------------------------------------------------------
1 | /***
2 | * ==++==
3 | *
4 | * Copyright (c) Microsoft Corporation. All rights reserved.
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | * ==--==
17 | * =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
18 | *
19 | * targetver.h
20 | *
21 | * Standard VS-generated header file.
22 | *
23 | * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
24 | ****/
25 | #pragma once
26 |
27 | // Including SDKDDKVer.h defines the highest available Windows platform.
28 |
29 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
30 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
31 |
32 | #include
33 |
--------------------------------------------------------------------------------
/src/edm/edm_entity_container.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #include "odata/edm/odata_edm.h"
8 |
9 | namespace odata { namespace edm
10 | {
11 |
12 | std::shared_ptr edm_entity_container::find_entity_set(::utility::string_t name) const
13 | {
14 | auto find_iter = m_entity_sets.find(name);
15 | if (find_iter != m_entity_sets.end())
16 | {
17 | return find_iter->second;
18 | }
19 |
20 | return nullptr;
21 | }
22 |
23 | std::shared_ptr edm_entity_container::find_singleton(::utility::string_t name) const
24 | {
25 | auto find_iter = m_singletons.find(name);
26 | if (find_iter != m_singletons.end())
27 | {
28 | return find_iter->second;
29 | }
30 |
31 | return nullptr;
32 | }
33 |
34 | std::shared_ptr edm_entity_container::find_operation_import(::utility::string_t name) const
35 | {
36 | auto find_iter = m_operation_imports.find(name);
37 | if (find_iter != m_operation_imports.end())
38 | {
39 | return find_iter->second;
40 | }
41 |
42 | return nullptr;
43 | }
44 |
45 | }}
--------------------------------------------------------------------------------
/include/odata/core/odata_entity_factory.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/common/utility.h"
10 | #include "odata/core/odata_core.h"
11 | #include "odata/edm/odata_edm.h"
12 | #include "cpprest/json.h"
13 |
14 | namespace odata { namespace core
15 | {
16 |
17 | template
18 | class entity_factory
19 | {
20 | public:
21 | static std::shared_ptr<_Entity_Impl> create_reader_instance(std::shared_ptr<::odata::edm::edm_model> model, const ::utility::string_t& service_root_url)
22 | {
23 | return std::make_shared<_Entity_Impl>(model, service_root_url);
24 | }
25 |
26 | static std::shared_ptr<_Entity_Impl> create_writer_instance(std::shared_ptr<::odata::edm::edm_model> model)
27 | {
28 | return std::make_shared<_Entity_Impl>(model);
29 | }
30 |
31 | static std::shared_ptr<_Entity_Impl> create_context_url_parser(std::shared_ptr<::odata::edm::edm_model> model, const ::utility::string_t& service_root_url)
32 | {
33 | return std::make_shared<_Entity_Impl>(model, service_root_url);
34 | }
35 | };
36 |
37 | }}
--------------------------------------------------------------------------------
/tests/e2e/exchange_test_case.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 | #include "odata/client/odata_client.h"
9 | #include "odata_wcf_service.h"
10 |
11 | namespace tests { namespace e2e { namespace odata {
12 |
13 | using namespace ::odata::client;
14 | using namespace ::utility;
15 | using namespace odata_wcf_service;
16 |
17 | class e2e_raw_client
18 | {
19 | public:
20 | odata_client client;
21 |
22 | e2e_raw_client() : client(U("http://odatae2etest.azurewebsites.net/cpptest/DefaultService")) {
23 | //Reset data source first.
24 | client.send_data_to_server(U("ResetDataSource")).get();
25 | }
26 | };
27 |
28 |
29 | class e2e_test_case
30 | {
31 | public:
32 | std::shared_ptr service_context;
33 |
34 | e2e_test_case() {
35 | service_context = std::make_shared(U("http://odatae2etest.azurewebsites.net/cpptest/DefaultService"));
36 |
37 | //Reset data source first.
38 | service_context->get_client()->send_data_to_server(U("ResetDataSource")).get(); //TODO: [tiano] use API instead of odata_client
39 | }
40 | };
41 | }}}
--------------------------------------------------------------------------------
/tests/functional/core_test/odata_entity_value_test.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #include "../odata_tests.h"
8 | #include "cpprest/json.h"
9 | #include "odata/edm/odata_edm.h"
10 | #include "odata/edm/edm_model_reader.h"
11 |
12 | using namespace ::odata::client;
13 | using namespace ::odata::edm;
14 | using namespace ::odata::core;
15 |
16 | namespace tests { namespace functional { namespace _odata {
17 |
18 | SUITE(odata_entity_value_test_cases)
19 | {
20 | TEST(get_entity_key_string)
21 | {
22 | auto model = get_test_model();
23 | VERIFY_IS_NOT_NULL(model);
24 |
25 | auto entity_value = std::make_shared(model->find_entity_type(U("ProductReview")));
26 | entity_value->set_value(U("ProductID"), 1);
27 | entity_value->set_value(U("ProductDetailID"), 2);
28 | entity_value->set_value(U("ReviewTitle"), U("title"));
29 | entity_value->set_value(U("RevisionID"), 3);
30 |
31 | auto key = entity_value->get_entity_key_string();
32 | VERIFY_ARE_EQUAL(U("(ProductID=1,ProductDetailID=2,ReviewTitle='title',RevisionID=3)"), key);
33 | }
34 | }
35 |
36 | }}}
--------------------------------------------------------------------------------
/include/odata/core/odata_parameter.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/core/odata_value.h"
10 |
11 | namespace odata { namespace core
12 | {
13 | // Represents the parameter in function/action.
14 | class odata_parameter
15 | {
16 | public:
17 | /// Default constructor
18 | odata_parameter()
19 | : m_value(std::make_shared<::odata::core::odata_value>())
20 | {
21 | }
22 |
23 | odata_parameter(::utility::string_t name, const std::shared_ptr<::odata::core::odata_value>& value)
24 | : m_name(std::move(name)), m_value(value)
25 | {
26 | }
27 |
28 | const ::utility::string_t& get_name() const { return m_name; }
29 |
30 | void set_name(::utility::string_t name)
31 | {
32 | m_name = std::move(name);
33 | }
34 |
35 | const std::shared_ptr<::odata::core::odata_value>& get_value() const { return m_value; }
36 |
37 | void set_value(const std::shared_ptr<::odata::core::odata_value>& value)
38 | {
39 | m_value = value;
40 | }
41 |
42 | private:
43 | ::utility::string_t m_name;
44 | std::shared_ptr<::odata::core::odata_value> m_value;
45 | };
46 |
47 | }}
--------------------------------------------------------------------------------
/include/odata/core/odata_context_url_parser.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/common/utility.h"
10 | #include "odata/core/odata_core.h"
11 | #include "cpprest/json.h"
12 | #include "odata/edm/odata_edm.h"
13 |
14 | namespace odata { namespace core
15 | {
16 |
17 | class odata_contex_url_parser
18 | {
19 | public:
20 | odata_contex_url_parser(std::shared_ptr<::odata::edm::edm_model> model, ::utility::string_t service_root_url)
21 | : m_model(model), m_service_root_url(std::move(service_root_url))
22 | {
23 | }
24 |
25 | ODATACPP_CLIENT_API std::shared_ptr<::odata::edm::edm_named_type> get_payload_content_type(const ::utility::string_t& context_url);
26 |
27 | private:
28 | std::shared_ptr<::odata::edm::edm_named_type> parse_context_url(std::list<::utility::string_t>& paths, const std::shared_ptr<::odata::edm::edm_named_type>& current_type);
29 | std::shared_ptr<::odata::edm::edm_named_type> parse_complex_or_primitive(const ::utility::string_t& current_path);
30 |
31 | std::shared_ptr<::odata::edm::edm_model> m_model;
32 | ::utility::string_t m_service_root_url;
33 | };
34 |
35 | }}
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include_directories(src .)
2 |
3 | set(UT_SOURCES
4 | src/AssertException.cpp
5 | src/CompositeTestReporter.cpp
6 | src/CurrentTest.cpp
7 | src/DeferredTestReporter.cpp
8 | src/DeferredTestResult.cpp
9 | src/GlobalSettings.cpp
10 | src/MemoryOutStream.cpp
11 | src/ReportAssert.cpp
12 | src/Test.cpp
13 | src/TestDetails.cpp
14 | src/TestList.cpp
15 | src/TestReporter.cpp
16 | src/TestReporterStdout.cpp
17 | src/TestResults.cpp
18 | src/TestRunner.cpp
19 | src/XmlTestReporter.cpp
20 | )
21 |
22 | set(TEST_SOURCES
23 | src/tests/TestAssertHandler.cpp
24 | src/tests/TestCheckMacros.cpp
25 | src/tests/TestChecks.cpp
26 | src/tests/TestCompositeTestReporter.cpp
27 | src/tests/TestCurrentTest.cpp
28 | src/tests/TestDeferredTestReporter.cpp
29 | src/tests/TestMemoryOutStream.cpp
30 | src/tests/TestTest.cpp
31 | src/tests/TestTestList.cpp
32 | src/tests/TestTestMacros.cpp
33 | src/tests/TestTestResults.cpp
34 | src/tests/TestTestRunner.cpp
35 | src/tests/TestTestSuite.cpp
36 | src/tests/TestUnitTestPP.cpp
37 | src/tests/TestXmlTestReporter.cpp
38 | )
39 |
40 | if(UNIX)
41 | set(UT_SOURCES ${UT_SOURCES}
42 | src/Posix/SignalTranslator.cpp
43 | src/Posix/TimeHelpers.cpp
44 | )
45 | elseif(WIN32)
46 | set(UT_SOURCES ${UT_SOURCES} src/Win32/TimeHelpers.cpp)
47 |
48 | add_definitions(-DWIN32 -D_USRDLL -D_CRT_SECURE_NO_DEPRECATE -DUNITTEST_DLL_EXPORT)
49 | endif()
50 |
51 | add_library(${LIB}unittestpp ${UT_SOURCES})
52 |
--------------------------------------------------------------------------------
/tests/framework/utilities/os_utilities.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #include "stdafx.h"
8 |
9 | #include "os_utilities.h"
10 |
11 | #ifdef WIN32
12 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
13 | #define NOMINMAX
14 | #include
15 | #else
16 | #include
17 | #endif
18 |
19 | namespace tests { namespace common { namespace utilities {
20 |
21 | void os_utilities::sleep(unsigned long ms)
22 | {
23 | #ifdef WIN32
24 | Sleep(ms);
25 | #else
26 | usleep(ms*1000);
27 | #endif
28 | }
29 |
30 | unsigned long os_utilities::interlocked_increment(volatile unsigned long *addend)
31 | {
32 | #ifdef WIN32
33 | return InterlockedIncrement(addend);
34 | #elif defined(__GNUC__)
35 | return __sync_add_and_fetch(addend, 1);
36 | #else
37 | #error Need to implement interlocked_increment
38 | #endif
39 | }
40 |
41 | long os_utilities::interlocked_exchange(volatile long *target, long value)
42 | {
43 | #ifdef WIN32
44 | return InterlockedExchange(target, value);
45 | #elif defined(__GNUC__)
46 | return __sync_lock_test_and_set(target, value);
47 | #else
48 | #error Need to implement interlocked_exchange
49 | #endif
50 | }
51 |
52 | }}}
53 |
--------------------------------------------------------------------------------
/tests/functional/codegen_tool_test/baseline/simple_model_test_baseline.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #include "simple_model_test.h"
8 |
9 | namespace Simple
10 | {
11 |
12 | BEGIN_ENTITY_CONSTRUCTOR(TestType, type_base)
13 | ON_PROPERTY_IN_ENTITY_CONSTRUCTOR(keyprop, 0)
14 | END_ENTITY_CONSTRUCTOR(TestType, type_base)
15 |
16 | BEGIN_ENTITY_DESTRUCTOR(TestType)
17 | END_ENTITY_DESTRUCTOR(TestType)
18 |
19 | IMPLEMENT_PRIMITIVE_PROPERTY_IN_ENTITY_MAPPING(TestType, keyprop, KeyProp, int32_t);
20 | IMPLEMENT_PRIMITIVE_PROPERTY_IN_ENTITY_MAPPING(TestType, valueprop, ValueProp, ::utility::string_t);
21 |
22 | IMPLEMENT_EDM_INFO(TestType, Simple, TestType)
23 |
24 | BEGIN_PROPERTY_IN_ENTITY_MAPPING(TestType)
25 | ON_PROPERTY_IN_ENTITY_MAPPING(TestType, keyprop)
26 | ON_PROPERTY_IN_ENTITY_MAPPING(TestType, valueprop)
27 | END_PROPERTY_IN_ENTITY_MAPPING(TestType)
28 |
29 | BEGIN_SERIALIZE_PROPERTY_IN_ENTITY_MAPPING(TestType)
30 | ON_SERIALIZE_PROPERTY_IN_ENTITY_MAPPING(TestType, keyprop)
31 | ON_SERIALIZE_PROPERTY_IN_ENTITY_MAPPING(TestType, valueprop)
32 | END_SERIALIZE_PROPERTY_IN_ENTITY_MAPPING(TestType)
33 |
34 |
35 | IMPLEMENT_EMPTY_DERIVED_TYPE_CREATOR_MAP(TestType)
36 | }
37 |
--------------------------------------------------------------------------------
/include/odata/core/odata_value.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/edm/odata_edm.h"
10 | #include "odata/core/odata_property_map.h"
11 |
12 | namespace odata { namespace core
13 | {
14 |
15 | class odata_entity_value;
16 |
17 | // A combination of the property type (see enum above) and a string representation of the property value.
18 | class odata_value
19 | {
20 | public:
21 | /// Default constructor
22 | odata_value() : m_property_type(std::make_shared<::odata::edm::edm_named_type>()){}
23 |
24 | odata_value(std::shared_ptr<::odata::edm::edm_named_type>type, bool is_null_value = false)
25 | : m_property_type(type), m_is_null_value(is_null_value)
26 | {
27 | }
28 |
29 | virtual ~odata_value(){};
30 |
31 | std::shared_ptr<::odata::edm::edm_named_type> get_value_type() const { return m_property_type; }
32 |
33 | void set_value_type(std::shared_ptr<::odata::edm::edm_named_type> property_type)
34 | {
35 | m_property_type = property_type;
36 | }
37 |
38 | private:
39 | friend class entity;
40 | friend class odata_property_map;
41 |
42 | std::shared_ptr<::odata::edm::edm_named_type> m_property_type;
43 | bool m_is_null_value;
44 | };
45 |
46 | }}
--------------------------------------------------------------------------------
/samples/ios/TripPin/TripPin/TripPin-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIdentifier
12 | OData.${PRODUCT_NAME:rfc1034identifier}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | LSRequiresIPhoneOS
26 |
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UIStatusBarTintParameters
34 |
35 | UINavigationBar
36 |
37 | Style
38 | UIBarStyleDefault
39 | Translucent
40 |
41 |
42 |
43 | UISupportedInterfaceOrientations
44 |
45 | UIInterfaceOrientationPortrait
46 | UIInterfaceOrientationLandscapeLeft
47 | UIInterfaceOrientationLandscapeRight
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(ODATACPP_CLIENT_SOURCES
2 | client/odata_client.cpp
3 | codegen/odata_query_path.cpp
4 | common/utility.cpp
5 | common/xmlhelpers.cpp
6 | communication/http_implement.cpp
7 | core/odata_context_url_parser.cpp
8 | core/odata_entity_model_builder.cpp
9 | core/odata_entity_value.cpp
10 | core/odata_json_constants.cpp
11 | core/odata_json_operation_payload_parameter_writer.cpp
12 | core/odata_json_operation_url_parameter_writer.cpp
13 | core/odata_json_reader.cpp
14 | core/odata_json_writer.cpp
15 | core/odata_primitive_value.cpp
16 | core/odata_property_map.cpp
17 | core/odata_structured_value.cpp
18 | edm/edm_entity_container.cpp
19 | edm/edm_model.cpp
20 | edm/edm_model_reader.cpp
21 | edm/edm_model_utility.cpp
22 | edm/edm_schema.cpp
23 | edm/edm_type.cpp
24 | )
25 |
26 | # if(WIN32)
27 | # add_definitions(
28 | # -DODATALIB_EXPORTS
29 | # -D_WINDLL
30 | # -D_USRDLL
31 | # )
32 | # endif()
33 |
34 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS} -Werror -pedantic")
35 |
36 | add_library(${ODATACPP_CLIENT} ${ODATACPP_CLIENT_SOURCES})
37 |
38 | target_link_libraries(${ODATACPP_CLIENT}
39 | ${Casablanca_LIBRARIES}
40 | ${LIBXML2_LIBRARIES}
41 | ${EXTRALINKS}
42 | )
43 |
44 | # Portions specific to odatacpp binary versioning.
45 | set (ODATACPP_VERSION_MAJOR 1)
46 | set (ODATACPP_VERSION_MINOR 0)
47 | set (ODATACPP_VERSION_REVISION 0)
48 | if(WIN32)
49 | set_target_properties(${ODATACPP_CLIENT} PROPERTIES
50 | OUTPUT_NAME "${ODATACPP_CLIENT}.${ODATACPP_VERSION_MAJOR}.${ODATACPP_VERSION_MINOR}")
51 | else()
52 | set_target_properties(${ODATACPP_CLIENT} PROPERTIES
53 | SOVERSION ${ODATACPP_VERSION_MAJOR}.${ODATACPP_VERSION_MINOR})
54 | endif()
55 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/ThirdPartyNotices.txt:
--------------------------------------------------------------------------------
1 | ----------------- ThirdPartyNotices----------------------------------------------
2 |
3 | This file is based on or incorporates material from the UnitTest++ r30 open source project.Microsoft is not the original author of this code but has modified it and is licensing the code under the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License, whether by implication, estoppel or otherwise.
4 |
5 | UnitTest++ r30
6 |
7 | Copyright (c) 2006 Noel Llopis and Charles Nicholson
8 | Portions Copyright (c) Microsoft Corporation
9 |
10 | All Rights Reserved.
11 |
12 | MIT License
13 |
14 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
15 |
16 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
20 | -------------End of ThirdPartyNotices---------------------------------------
21 |
--------------------------------------------------------------------------------
/include/odata/codegen/odata_void_query_executor.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/client/odata_client.h"
10 | #include "odata/common/utility.h"
11 | #include "odata/core/odata_core.h"
12 | #include "odata/codegen/odata_service_context.h"
13 | #include "cpprest/uri.h"
14 | #include "cpprest/asyncrt_utils.h"
15 | #include "cpprest/json.h"
16 | #include "cpprest/http_client.h"
17 |
18 | namespace odata { namespace codegen {
19 |
20 | class odata_void_query_executor
21 | {
22 | public:
23 | odata_void_query_executor(std::shared_ptr<::odata::codegen::odata_service_context> client_context) : m_client_context(client_context)
24 | {
25 | }
26 |
27 | typedef int return_type;
28 |
29 | ::pplx::task execute_operation_query(const ::utility::string_t& query_expression, const std::vector>& parameters, bool is_function)
30 | {
31 | if (!m_client_context || !m_client_context->get_client())
32 | {
33 | return ::pplx::task_from_result(-1);
34 | }
35 |
36 | std::vector> ret_values;
37 | m_client_context->get_client()->send_data_to_server(query_expression, parameters, ret_values, is_function ? HTTP_GET : HTTP_POST).get();
38 |
39 | return ::pplx::task_from_result(0);
40 | }
41 |
42 | protected:
43 | std::shared_ptr<::odata::codegen::odata_service_context> m_client_context;
44 | };
45 |
46 | }}
47 |
--------------------------------------------------------------------------------
/include/odata/common/utility.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include "cpprest/uri.h"
26 | #include "cpprest/asyncrt_utils.h"
27 | #include "cpprest/json.h"
28 | #include "cpprest/http_client.h"
29 | #include "odata/common/platform.h"
30 |
31 | namespace odata { namespace common
32 | {
33 |
34 | ODATACPP_CLIENT_API ::utility::string_t strip_string(const ::utility::string_t& escaped);
35 |
36 | ODATACPP_CLIENT_API void split_string(::utility::string_t& source, const ::utility::string_t& delim, std::list<::utility::string_t>& ret);
37 |
38 | template
39 | void to_string(const T& input, ::utility::string_t& result)
40 | {
41 | ::utility::stringstream_t ostr;
42 | ostr << input;
43 | result = ostr.str();
44 | }
45 |
46 | ODATACPP_CLIENT_API bool is_relative_path(const ::utility::string_t& root_url, const ::utility::string_t& path);
47 |
48 | ODATACPP_CLIENT_API ::utility::string_t print_double(const double& db, int precision = 20);
49 | ODATACPP_CLIENT_API ::utility::string_t print_float(const float& db, int precision = 16);
50 |
51 | }}
52 |
--------------------------------------------------------------------------------
/include/odata/codegen/odata_query_option.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/common/utility.h"
10 | #include "odata/core/odata_core.h"
11 |
12 | namespace odata { namespace codegen {
13 |
14 | enum ODATA_QUERY_OPTION_TYPE
15 | {
16 | KEY_QUERY = 0,
17 | FILTER_QUERY,
18 | TOP_QUERY,
19 | SKIP_QUERY,
20 | ORDER_BY,
21 | SELECT_QUERY,
22 | EXPAND_QUERY,
23 | };
24 |
25 | class odata_query_option
26 | {
27 | public:
28 | odata_query_option(ODATA_QUERY_OPTION_TYPE query_option_type, ::utility::string_t query_option_clause)
29 | : m_query_option_type(query_option_type), m_query_option_clause(std::move(query_option_clause))
30 | {
31 | }
32 |
33 | const ODATA_QUERY_OPTION_TYPE& get_query_option_type() const
34 | {
35 | return m_query_option_type;
36 | }
37 |
38 | const ::utility::string_t& get_query_option_clause() const
39 | {
40 | return m_query_option_clause;
41 | }
42 |
43 | void set_query_option_clause(::utility::string_t query_option_clause)
44 | {
45 | m_query_option_clause = std::move(query_option_clause);
46 | }
47 |
48 | private:
49 | ODATA_QUERY_OPTION_TYPE m_query_option_type;
50 | ::utility::string_t m_query_option_clause;
51 | };
52 |
53 | class odata_query_option_comparator
54 | {
55 | public:
56 | bool operator()(const odata_query_option& left, const odata_query_option& right)
57 | {
58 | return left.get_query_option_type() < right.get_query_option_type();
59 | }
60 | };
61 |
62 | }}
--------------------------------------------------------------------------------
/include/odata/core/odata_json_operation_url_parameter_writer.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "cpprest/json.h"
10 | #include "odata/communication/http_communication.h"
11 | #include "odata/common/utility.h"
12 | #include "odata/core/odata_core.h"
13 | #include "odata/edm/odata_edm.h"
14 |
15 | namespace odata { namespace core
16 | {
17 |
18 | class odata_json_operation_url_parameter_writer
19 | {
20 | public:
21 | odata_json_operation_url_parameter_writer(std::shared_ptr<::odata::edm::edm_model> model) : m_model(model)
22 | {
23 | }
24 |
25 | ODATACPP_CLIENT_API ::utility::string_t serialize(std::vector> parameters);
26 |
27 | private:
28 | void handle_serialize_odata_parameter(::utility::stringstream_t& ss, const std::shared_ptr<::odata::core::odata_parameter>& parameter, ::utility::char_t mark, ::utility::char_t separator);
29 | void handle_serialize_odata_value(::utility::stringstream_t& ss, const std::shared_ptr<::odata::edm::edm_named_type>& property_type, const std::shared_ptr& property_value);
30 | void handle_serialize_primitive_value(::utility::stringstream_t& ss, const std::shared_ptr<::odata::edm::edm_primitive_type>& p_primitive_type, const std::shared_ptr& p_value);
31 | void handle_serialize_enum_value(::utility::stringstream_t& ss, const std::shared_ptr& p_value);
32 |
33 | std::shared_ptr<::odata::edm::edm_model> m_model;
34 | };
35 |
36 | }}
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/tests/stdafx.cpp:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | // stdafx.cpp :
33 | // Include the standard header and generate the precompiled header.
34 |
35 | #include "stdafx.h"
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/TimeHelpers.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #include "../config.h"
33 |
34 | #if defined UNITTEST_POSIX
35 | #include "Posix/TimeHelpers.h"
36 | #else
37 | #include "Win32/TimeHelpers.h"
38 | #endif
39 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/TestReporter.cpp:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #include "TestHeader.h"
33 |
34 | namespace UnitTest {
35 |
36 | TestReporter::TestReporter()
37 | {
38 | }
39 |
40 | TestReporter::~TestReporter()
41 | {
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/include/odata/edm/edm_navigation_source.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/common/utility.h"
10 | #include "odata/edm/edm_type.h"
11 |
12 | namespace odata { namespace edm
13 | {
14 |
15 | enum container_resource_type
16 | {
17 | E_RESOURCE_ENTITY_SET = 0,
18 | E_RESOURCE_SINGLETON,
19 | };
20 |
21 | class edm_navigation_source
22 | {
23 | public:
24 | edm_navigation_source(::utility::string_t name, container_resource_type resource_type) : m_name(std::move(name)), m_resource_type(resource_type)
25 | {}
26 |
27 | virtual ~edm_navigation_source()
28 | {}
29 |
30 | void add_navigation_source(const ::utility::string_t& property_path_name, const ::utility::string_t& target_name)
31 | {
32 | navigation_property_mapping[property_path_name] = target_name;
33 | }
34 |
35 | ::utility::string_t get_navigation_source_name(const ::utility::string_t& property_path_name)
36 | {
37 | return navigation_property_mapping[property_path_name];
38 | }
39 |
40 | const std::unordered_map<::utility::string_t, ::utility::string_t>& get_navigation_sources() const
41 | {
42 | return navigation_property_mapping;
43 | }
44 |
45 |
46 | const ::utility::string_t& get_name() const
47 | {
48 | return m_name;
49 | }
50 |
51 | container_resource_type get_resource_type() const
52 | {
53 | return m_resource_type;
54 | }
55 |
56 | protected:
57 | std::unordered_map<::utility::string_t, ::utility::string_t> navigation_property_mapping;
58 | ::utility::string_t m_name;
59 | container_resource_type m_resource_type;
60 | };
61 |
62 | }}
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/TestSuite.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_TESTSUITE_H
33 | #define UNITTEST_TESTSUITE_H
34 |
35 | namespace UnitTestSuite
36 | {
37 | inline char const* GetSuiteName ()
38 | {
39 | return "DefaultSuite";
40 | }
41 | }
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/msvc/vs11/Common.vs11.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.root))
6 | $(ODataCppBase)\msvc\vs11\packages
7 | $(ODataCppBase)\output
8 | $(ODataCppBase)\include
9 | $(ODataCppBase)\src
10 | $(ODataCppBase)\lib
11 | $(ODataCppBase)\tools
12 | $(ODataCppBase)\tests
13 | $(ODataCppTest)\functional
14 | $(ODataCppTest)\e2e
15 | $(ODataCppTest)\service
16 | $(ODataCppBase)\samples
17 |
18 |
19 |
20 |
21 | 2.1.0
22 | $(ODataCppPackage)\cpprestsdk.$(CasablancaVersion)\build\native
23 | $(CasablancaBase)\cpprestsdk.props
24 | $(CasablancaBase)\cpprestsdk.targets
25 | $(CasablancaBase)\private
26 |
27 |
28 |
29 |
30 | $(ODataCppTest)\framework
31 | $(TestFrameworkBase)\UnitTestpp
32 | $(UnitTestppBase)\src
33 | $(TestFrameworkBase)\TestRunner
34 | $(TestFrameworkBase)\utilities
35 | $(UtilitiesBase)\include
36 |
37 |
38 |
--------------------------------------------------------------------------------
/msvc/vs12/Common.vs12.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.root))
6 | $(ODataCppBase)\msvc\vs12\packages
7 | $(ODataCppBase)\output
8 | $(ODataCppBase)\include
9 | $(ODataCppBase)\src
10 | $(ODataCppBase)\lib
11 | $(ODataCppBase)\tools
12 | $(ODataCppBase)\tests
13 | $(ODataCppTest)\functional
14 | $(ODataCppTest)\e2e
15 | $(ODataCppTest)\service
16 | $(ODataCppBase)\samples
17 |
18 |
19 |
20 |
21 | 2.1.0
22 | $(ODataCppPackage)\cpprestsdk.$(CasablancaVersion)\build\native
23 | $(CasablancaBase)\cpprestsdk.props
24 | $(CasablancaBase)\cpprestsdk.targets
25 | $(CasablancaBase)\private
26 |
27 |
28 |
29 |
30 | $(ODataCppTest)\framework
31 | $(TestFrameworkBase)\UnitTestpp
32 | $(UnitTestppBase)\src
33 | $(TestFrameworkBase)\TestRunner
34 | $(TestFrameworkBase)\utilities
35 | $(UtilitiesBase)\include
36 |
37 |
38 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/AssertException.cpp:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #include "TestHeader.h"
33 |
34 | #ifndef UNITTEST_NO_EXCEPTIONS
35 |
36 | namespace UnitTest {
37 |
38 | AssertException::AssertException()
39 | {
40 | }
41 |
42 | AssertException::~AssertException() throw()
43 | {
44 | }
45 |
46 | }
47 |
48 | #endif
49 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/unittestpp.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTESTPP_H
33 | #define UNITTESTPP_H
34 |
35 | #include "config.h"
36 | #include "src/TestMacros.h"
37 | #include "src/CheckMacros.h"
38 | #include "src/TestRunner.h"
39 | #include "src/ReportAssert.h"
40 | #include "src/GlobalSettings.h"
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/ReportAssert.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_ASSERT_H
33 | #define UNITTEST_ASSERT_H
34 |
35 | #include "HelperMacros.h"
36 |
37 | namespace UnitTest {
38 |
39 | UNITTEST_LINKAGE void ReportAssert(char const* description, char const* filename, int lineNumber);
40 |
41 | }
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/include/odata/edm/edm_operation_import.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/common/utility.h"
10 | #include "odata/edm/edm_type.h"
11 |
12 | namespace odata { namespace edm
13 | {
14 |
15 | class edm_entity_container;
16 |
17 | ///
18 | ///
19 | ///
20 | enum OperationImportKind
21 | {
22 | ActionImport = 0,
23 | FunctionImport
24 | };
25 |
26 | ///
27 | /// Represents a set of operation imports in a container
28 | ///
29 | class edm_operation_import
30 | {
31 | public:
32 | edm_operation_import(::utility::string_t name, ::utility::string_t operation_name, ::utility::string_t entity_set_path, bool is_in_service_document, OperationImportKind operation_import_kind) :
33 | m_name(std::move(name)), m_operation_name(std::move(operation_name)), m_entity_set_path(std::move(entity_set_path)), m_is_in_service_document(is_in_service_document), m_operation_import_kind(operation_import_kind)
34 | {
35 | m_operation_type = nullptr;
36 | }
37 |
38 | const ::utility::string_t get_name() const
39 | {
40 | return m_name;
41 | }
42 |
43 | const std::shared_ptr get_operation_type() const
44 | {
45 | return m_operation_type;
46 | }
47 |
48 | void set_operation_type(std::shared_ptr operationType)
49 | {
50 | m_operation_type = operationType;
51 | }
52 |
53 | private:
54 | friend class edm_entity_container;
55 |
56 | ::utility::string_t m_name;
57 | ::utility::string_t m_operation_name;
58 | std::shared_ptr m_operation_type;
59 | ::utility::string_t m_entity_set_path;
60 | bool m_is_in_service_document;
61 | OperationImportKind m_operation_import_kind;
62 | };
63 |
64 | }}
--------------------------------------------------------------------------------
/include/odata/edm/edm_entity_set.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/common/utility.h"
10 | #include "odata/edm/edm_navigation_source.h"
11 | #include "odata/edm/edm_type.h"
12 |
13 | namespace odata { namespace edm
14 | {
15 |
16 | class edm_entity_container;
17 |
18 | ///
19 | /// Represents a set of entities in a container
20 | ///
21 | class edm_entity_set : public edm_navigation_source
22 | {
23 | public:
24 | ///
25 | /// Constructor
26 | ///
27 | /// The name of the entity set.
28 | edm_entity_set(::utility::string_t name, ::utility::string_t type)
29 | : m_type_name(std::move(type)), edm_navigation_source(std::move(name), container_resource_type::E_RESOURCE_ENTITY_SET)
30 | {}
31 |
32 | edm_entity_set(::utility::string_t name, std::shared_ptr type)
33 | : m_entity_type(type), edm_navigation_source(std::move(name), container_resource_type::E_RESOURCE_ENTITY_SET)
34 | {}
35 |
36 | ///
37 | /// Gets the name of the type of the entity set
38 | ///
39 | /// The name of the type of the entity set.
40 | const ::utility::string_t& get_entity_type_name() const
41 | {
42 | return m_type_name;
43 | }
44 |
45 | std::shared_ptr get_entity_type() const
46 | {
47 | return m_entity_type.lock();
48 | }
49 |
50 | void set_entity_type(const std::shared_ptr& entity_type)
51 | {
52 | m_entity_type = entity_type;
53 | }
54 |
55 | private:
56 | friend class edm_entity_container;
57 | ::utility::string_t m_type_name;
58 | std::weak_ptr m_entity_type;
59 | };
60 |
61 | }}
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/tests/TestTestSuite.cpp:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #include "stdafx.h"
33 |
34 | // We're really testing if it's possible to use the same suite in two files
35 | // to compile and link successfuly (TestTestSuite.cpp has suite with the same name)
36 | // Note: we are outside of the anonymous namespace
37 | SUITE(SameTestSuite)
38 | {
39 | TEST(DummyTest2)
40 | {
41 | }
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/CurrentTest.cpp:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #include "TestHeader.h"
33 |
34 | namespace UnitTest {
35 |
36 | UNITTEST_LINKAGE TestResults*& CurrentTest::Results()
37 | {
38 | static TestResults* testResults = NULL;
39 | return testResults;
40 | }
41 |
42 | UNITTEST_LINKAGE const TestDetails*& CurrentTest::Details()
43 | {
44 | static const TestDetails* testDetails = NULL;
45 | return testDetails;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/CurrentTest.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_CURRENTTESTRESULTS_H
33 | #define UNITTEST_CURRENTTESTRESULTS_H
34 |
35 | #include "HelperMacros.h"
36 |
37 | namespace UnitTest {
38 |
39 | class TestResults;
40 | class TestDetails;
41 |
42 | namespace CurrentTest
43 | {
44 | UNITTEST_LINKAGE TestResults*& Results();
45 | UNITTEST_LINKAGE const TestDetails*& Details();
46 | }
47 |
48 | }
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/samples/ios/TripPin/TripPin/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // TripPin
4 | //
5 | // Created by xubin on 7/31/14.
6 | //
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @implementation AppDelegate
12 |
13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
14 | {
15 | // Override point for customization after application launch.
16 | return YES;
17 | }
18 |
19 | - (void)applicationWillResignActive:(UIApplication *)application
20 | {
21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
23 | }
24 |
25 | - (void)applicationDidEnterBackground:(UIApplication *)application
26 | {
27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
29 | }
30 |
31 | - (void)applicationWillEnterForeground:(UIApplication *)application
32 | {
33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | - (void)applicationDidBecomeActive:(UIApplication *)application
37 | {
38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
39 | }
40 |
41 | - (void)applicationWillTerminate:(UIApplication *)application
42 | {
43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/tests/stdafx.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #pragma once
33 |
34 | #include "../../config.h"
35 | #include "../../unittestpp.h"
36 |
37 | #include "../TestMacros.h"
38 | #include "../CurrentTest.h"
39 | #include "../TestReporter.h"
40 | #include "../TestResults.h"
41 | #include "../ReportAssert.h"
42 | #include "../TimeHelpers.h"
43 | #include "../ReportAssertImpl.h"
44 |
45 | #include "ScopedCurrentTest.h"
46 | #include "RecordingReporter.h"
47 |
48 | #include
--------------------------------------------------------------------------------
/include/odata/edm/edm_model_reader.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/edm/odata_edm.h"
10 | #include "odata/common/xmlhelpers.h"
11 | #include "odata/communication/http_communication.h"
12 |
13 | namespace odata { namespace edm
14 | {
15 |
16 | class edm_model_reader : public ::odata::common::xml_reader
17 | {
18 | public:
19 | edm_model_reader(concurrency::streams::istream stream) :
20 | xml_reader(stream), m_parsing_key(false), m_model(std::make_shared()),
21 | m_current_st(nullptr), m_current_enum(nullptr), m_current_operation(nullptr)
22 | {
23 | }
24 |
25 | std::shared_ptr get_model()
26 | {
27 | return m_model;
28 | }
29 |
30 | ODATACPP_CLIENT_API bool parse();
31 |
32 | protected:
33 | ODATACPP_CLIENT_API virtual void handle_begin_element(const ::utility::string_t& elementName);
34 | ODATACPP_CLIENT_API virtual void handle_end_element(const ::utility::string_t& elementName);
35 | ODATACPP_CLIENT_API virtual void handle_element(const ::utility::string_t& elementName);
36 |
37 |
38 | private:
39 | void _process_property();
40 | void _process_navigation_property();
41 | void _process_operation_parameter();
42 | void _process_operation_return_type();
43 | void _process_navigation_property_binding();
44 |
45 | bool m_parsing_key;
46 |
47 | // These variables are used to cache values for each entity
48 | std::shared_ptr m_model;
49 | std::shared_ptr m_current_schema;
50 | std::shared_ptr m_current_container;
51 | std::shared_ptr m_current_entity_set;
52 | std::shared_ptr m_current_singleton;
53 | edm_structured_type* m_current_st;
54 | edm_enum_type* m_current_enum;
55 | edm_operation_type* m_current_operation;
56 | };
57 |
58 | }}
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/Posix/TimeHelpers.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_TIMEHELPERS_H
33 | #define UNITTEST_TIMEHELPERS_H
34 |
35 | #include
36 |
37 | namespace UnitTest {
38 |
39 | class Timer
40 | {
41 | public:
42 | Timer();
43 | void Start();
44 | double GetTimeInMs() const;
45 |
46 | private:
47 | struct timeval m_startTime;
48 | };
49 |
50 |
51 | namespace TimeHelpers
52 | {
53 | void SleepMs(int ms);
54 | }
55 |
56 |
57 | }
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/AssertException.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_ASSERTEXCEPTION_H
33 | #define UNITTEST_ASSERTEXCEPTION_H
34 |
35 | #include "../config.h"
36 | #ifndef UNITTEST_NO_EXCEPTIONS
37 |
38 | #include "HelperMacros.h"
39 | #include
40 |
41 | namespace UnitTest {
42 |
43 | class AssertException : public std::exception
44 | {
45 | public:
46 | UNITTEST_LINKAGE AssertException();
47 | UNITTEST_LINKAGE virtual ~AssertException() throw();
48 | };
49 |
50 | }
51 |
52 | #endif
53 |
54 | #endif
55 |
--------------------------------------------------------------------------------
/include/odata/core/odata_json_writer.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "cpprest/json.h"
10 | #include "odata/communication/http_communication.h"
11 | #include "odata/common/utility.h"
12 | #include "odata/core/odata_core.h"
13 | #include "odata/core/odata_json_constants.h"
14 | #include "odata/edm/odata_edm.h"
15 |
16 | namespace odata { namespace core
17 | {
18 |
19 | class odata_json_writer
20 | {
21 | public:
22 | odata_json_writer(std::shared_ptr<::odata::edm::edm_model> model) : m_model(model)
23 | {
24 | }
25 |
26 | ODATACPP_CLIENT_API ::web::json::value serialize(std::shared_ptr value_object);
27 | ODATACPP_CLIENT_API ::web::json::value serialize(std::vector> parameters);
28 |
29 | private:
30 | void handle_serialize_odata_parameter(::utility::stringstream_t& ss, const std::shared_ptr<::odata::core::odata_parameter>& parameter, ::utility::char_t mark, ::utility::char_t separator);
31 | void handle_serialize_odata_properties(::utility::stringstream_t& ss, const odata_property_map& properties);
32 | void handle_serialize_odata_value(::utility::stringstream_t& ss, const std::shared_ptr<::odata::edm::edm_named_type>& property_type, const std::shared_ptr& property_value);
33 | void handle_serialize_primitive_value(::utility::stringstream_t& ss, const std::shared_ptr<::odata::edm::edm_primitive_type>& p_primitive_type, const std::shared_ptr& p_value);
34 | void handle_serialize_enum_value(::utility::stringstream_t& ss, const std::shared_ptr& p_value);
35 | void handle_serialize_collection_value(::utility::stringstream_t& ss, const std::shared_ptr& p_value);
36 | bool is_type_serializable(const std::shared_ptr<::odata::edm::edm_named_type>& property_type);
37 |
38 | std::shared_ptr<::odata::edm::edm_model> m_model;
39 | };
40 |
41 | }}
--------------------------------------------------------------------------------
/include/odata/core/odata_json_operation_payload_parameter_writer.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "cpprest/json.h"
10 | #include "odata/communication/http_communication.h"
11 | #include "odata/common/utility.h"
12 | #include "odata/core/odata_core.h"
13 | #include "odata/core/odata_json_constants.h"
14 | #include "odata/edm/odata_edm.h"
15 |
16 | namespace odata { namespace core
17 | {
18 |
19 | class odata_json_operation_payload_parameter_writer
20 | {
21 | public:
22 | odata_json_operation_payload_parameter_writer(std::shared_ptr<::odata::edm::edm_model> model) : m_model(model)
23 | {
24 | }
25 |
26 | ODATACPP_CLIENT_API ::web::json::value serialize(std::vector> parameters);
27 |
28 | private:
29 | void handle_serialize_odata_parameter(::utility::stringstream_t& ss, const std::shared_ptr<::odata::core::odata_parameter>& parameter, ::utility::char_t mark, ::utility::char_t separator);
30 | void handle_serialize_odata_value(::utility::stringstream_t& ss, const std::shared_ptr<::odata::edm::edm_named_type>& property_type, const std::shared_ptr& property_value);
31 | void handle_serialize_primitive_value(::utility::stringstream_t& ss, const std::shared_ptr<::odata::edm::edm_primitive_type>& p_primitive_type, const std::shared_ptr& p_value);
32 | void handle_serialize_enum_value(::utility::stringstream_t& ss, const std::shared_ptr& p_value);
33 | void handle_serialize_collection_value(::utility::stringstream_t& ss, const std::shared_ptr& p_value);
34 | void handle_serialize_odata_properties(::utility::stringstream_t& ss, const odata_property_map& properties);
35 | bool is_type_serializable(const std::shared_ptr<::odata::edm::edm_named_type>& property_type);
36 |
37 | std::shared_ptr<::odata::edm::edm_model> m_model;
38 | };
39 |
40 | }}
--------------------------------------------------------------------------------
/include/odata/edm/edm_singleton.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/common/utility.h"
10 | #include "odata/edm/edm_type.h"
11 |
12 | namespace odata { namespace edm
13 | {
14 |
15 | class edm_entity_container;
16 |
17 | ///
18 | /// Represents a set of entities in a container
19 | ///
20 | class edm_singleton : public edm_navigation_source
21 | {
22 | public:
23 | ///
24 | /// Constructor
25 | ///
26 | /// The name of the entity set.
27 | edm_singleton(::utility::string_t name, ::utility::string_t type)
28 | : m_type_name(std::move(type)), edm_navigation_source(std::move(name), container_resource_type::E_RESOURCE_SINGLETON)
29 | {}
30 |
31 | edm_singleton(::utility::string_t name, std::shared_ptr type)
32 | : m_entity_type(std::move(type)), edm_navigation_source(std::move(name), container_resource_type::E_RESOURCE_SINGLETON)
33 | {}
34 |
35 | ///
36 | /// Gets the name of the entity set
37 | ///
38 | /// The name of the entity set.
39 | const ::utility::string_t& get_name() const
40 | {
41 | return m_name;
42 | }
43 |
44 | ///
45 | /// Gets the name of the type of the entity set
46 | ///
47 | /// The name of the type of the entity set.
48 | const ::utility::string_t& get_entity_type_name() const
49 | {
50 | return m_type_name;
51 | }
52 |
53 | std::shared_ptr get_entity_type() const
54 | {
55 | return m_entity_type.lock();
56 | }
57 |
58 | void set_entity_type(const std::shared_ptr& entity_type)
59 | {
60 | m_entity_type = entity_type;
61 | }
62 |
63 | private:
64 | friend class edm_entity_container;
65 | ::utility::string_t m_type_name;
66 | std::weak_ptr m_entity_type;
67 | };
68 |
69 | }}
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/ExceptionMacros.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_EXCEPTIONMACROS_H
33 | #define UNITTEST_EXCEPTIONMACROS_H
34 |
35 | #include "../config.h"
36 |
37 | #ifndef UNITTEST_NO_EXCEPTIONS
38 | #define UT_TRY(x) try x
39 | #define UT_THROW(x) throw x
40 | #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody
41 | #define UT_CATCH_ALL(CatchBody) catch(...) CatchBody
42 | #else
43 | #define UT_TRY(x) x
44 | #define UT_THROW(x)
45 | #define UT_CATCH(ExceptionType, ExceptionName, CatchBody)
46 | #define UT_CATCH_ALL(CatchBody)
47 | #endif
48 |
49 | #endif
50 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/TestHeader.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #pragma once
33 |
34 | #include "../config.h"
35 |
36 | #include "AssertException.h"
37 | #include "CurrentTest.h"
38 | #include "DeferredTestReporter.h"
39 | #include "TestDetails.h"
40 | #include "MemoryOutStream.h"
41 | #include "TestResults.h"
42 | #include "Test.h"
43 | #include "TestList.h"
44 | #include "TestReporter.h"
45 | #include "TestReporterStdout.h"
46 | #include "TimeHelpers.h"
47 |
48 | #include
49 | #include
50 | #include
51 |
52 | #ifdef WIN32
53 | #define WIN32_LEAN_AND_MEAN
54 | #define NOMINMAX
55 | #include
56 | #endif
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/TestDetails.cpp:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #include "TestHeader.h"
33 |
34 | namespace UnitTest {
35 |
36 | TestDetails::TestDetails(char const* testName_, char const* suiteName_, char const* filename_, int lineNumber_)
37 | : suiteName(suiteName_)
38 | , testName(testName_)
39 | , filename(filename_)
40 | , lineNumber(lineNumber_)
41 | {
42 | }
43 |
44 | TestDetails::TestDetails(const TestDetails& details, int lineNumber_)
45 | : suiteName(details.suiteName)
46 | , testName(details.testName)
47 | , filename(details.filename)
48 | , lineNumber(lineNumber_)
49 | {
50 | }
51 |
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/Test.cpp:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #include "TestHeader.h"
33 |
34 | #include "ExecuteTest.h"
35 |
36 | #ifdef UNITTEST_POSIX
37 | #include "Posix/SignalTranslator.h"
38 | #endif
39 |
40 | namespace UnitTest {
41 |
42 | Test::Test(char const* testName, char const* suiteName, char const* filename, int lineNumber)
43 | : m_details(testName, suiteName, filename, lineNumber)
44 | , m_nextTest(0)
45 | , m_isMockTest(false)
46 | {
47 | }
48 |
49 | Test::~Test()
50 | {
51 | }
52 |
53 | void Test::Run()
54 | {
55 | ExecuteTest(*this, m_details, m_isMockTest);
56 | }
57 |
58 | void Test::RunImpl() const
59 | {
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/ios/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(odatacpp-ios)
2 | cmake_minimum_required(VERSION 2.6)
3 |
4 | set(TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ios-cmake/toolchain/iOS.cmake")
5 |
6 | set(SIM_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/build.i386" CACHE INTERNAL "")
7 | set(SIM_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.." CACHE INTERNAL "")
8 |
9 | set(ARM_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/build.arm" CACHE INTERNAL "")
10 | set(ARM_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.." CACHE INTERNAL "")
11 |
12 | file(MAKE_DIRECTORY ${SIM_BINARY_DIR})
13 | execute_process(WORKING_DIRECTORY ${SIM_BINARY_DIR}
14 | COMMAND ${CMAKE_COMMAND}
15 | -GXcode
16 | -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}
17 | -DIOS_PLATFORM=SIMULATOR
18 | -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
19 | "${SIM_SOURCE_DIR}"
20 | )
21 |
22 | file(MAKE_DIRECTORY ${ARM_BINARY_DIR})
23 | execute_process(WORKING_DIRECTORY ${ARM_BINARY_DIR}
24 | COMMAND ${CMAKE_COMMAND}
25 | -GXcode
26 | -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}
27 | -DIOS_PLATFORM=OS
28 | "-DCMAKE_OSX_ARCHITECTURES=armv7s;armv7;arm64"
29 | -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
30 | "${ARM_SOURCE_DIR}"
31 | )
32 |
33 |
34 | ## Simulator version
35 | add_custom_target(sim
36 | COMMAND ${CMAKE_COMMAND}
37 | --build ${SIM_BINARY_DIR}
38 | --target odata-client
39 | --config ${CMAKE_BUILD_TYPE}
40 | COMMENT "Building for i386 (simulator)"
41 | VERBATIM
42 | )
43 |
44 | ## ARM version
45 | add_custom_target(arm
46 | COMMAND ${CMAKE_COMMAND}
47 | --build ${ARM_BINARY_DIR}
48 | --target odata-client
49 | --config ${CMAKE_BUILD_TYPE}
50 | COMMENT "Building for armv7, armv7s, arm64"
51 | VERBATIM
52 | )
53 |
54 | set(LIB_ODATACLIENT libodata-client.a)
55 | add_custom_command(
56 | OUTPUT ${LIB_ODATACLIENT}
57 | COMMAND lipo -create
58 | -output "${CMAKE_CURRENT_BINARY_DIR}/${LIB_ODATACLIENT}"
59 | ${SIM_BINARY_DIR}/output/${CMAKE_BUILD_TYPE}/${LIB_ODATACLIENT}
60 | ${ARM_BINARY_DIR}/output/${CMAKE_BUILD_TYPE}/${LIB_ODATACLIENT}
61 | DEPENDS
62 | sim
63 | arm
64 | "${SIM_BINARY_DIR}/output/${CMAKE_BUILD_TYPE}/${LIB_ODATACLIENT}"
65 | "${ARM_BINARY_DIR}/output/${CMAKE_BUILD_TYPE}/${LIB_ODATACLIENT}"
66 | VERBATIM
67 | )
68 |
69 | add_custom_target(odata-library ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${LIB_ODATACLIENT})
--------------------------------------------------------------------------------
/tests/functional/core_test/odata_collection_value_test.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #include "../odata_tests.h"
8 | #include "cpprest/json.h"
9 | #include "odata/edm/odata_edm.h"
10 | #include "odata/edm/edm_model_reader.h"
11 |
12 | using namespace ::odata::client;
13 | using namespace ::odata::edm;
14 | using namespace ::odata::core;
15 | using namespace std;
16 |
17 | namespace tests { namespace functional { namespace _odata {
18 |
19 | SUITE(odata_collection_value_test_cases)
20 | {
21 | TEST(collection_of_primitive_value)
22 | {
23 | shared_ptr int_type = edm_primitive_type::INT32();
24 | shared_ptr collection_type = std::make_shared(U("collection type"), int_type);
25 | shared_ptr collection_value = std::make_shared(collection_type);
26 | collection_value->add_collection_value(odata_primitive_value::make_primitive_value(10));
27 | collection_value->add_collection_value(odata_primitive_value::make_primitive_value(-10));
28 |
29 | VERIFY_ARE_EQUAL(edm_type_kind_t::Collection, collection_value->get_value_type()->get_type_kind());
30 |
31 | VERIFY_ARE_EQUAL(2, collection_value->get_collection_values().size());
32 | }
33 |
34 | TEST(collection_of_enum_value)
35 | {
36 | shared_ptr enum_type = make_shared(U("Color"), U("namespace"), U("Edm.Int32"), false);
37 | auto collection_type = std::make_shared(U("collection type"), enum_type);
38 | auto collection_value = std::make_shared(collection_type);
39 |
40 | collection_value->add_collection_value(make_shared(enum_type, U("Blue")));
41 | collection_value->add_collection_value(make_shared(enum_type, U("Red")));
42 |
43 | VERIFY_ARE_EQUAL(edm_type_kind_t::Collection, collection_value->get_value_type()->get_type_kind());
44 |
45 | VERIFY_ARE_EQUAL(2, collection_value->get_collection_values().size());
46 | }
47 |
48 | }}}}
--------------------------------------------------------------------------------
/include/odata/core/odata_json_reader.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "cpprest/json.h"
10 | #include "odata/communication/http_communication.h"
11 | #include "odata/common/utility.h"
12 | #include "odata/core/odata_core.h"
13 | #include "odata/core/odata_json_constants.h"
14 | #include "odata/edm/odata_edm.h"
15 |
16 | namespace odata { namespace core
17 | {
18 |
19 | class odata_json_reader
20 | {
21 | public:
22 | odata_json_reader(std::shared_ptr<::odata::edm::edm_model> model, ::utility::string_t service_root_url)
23 | : m_model(model), m_service_root_url(std::move(service_root_url))
24 | {
25 | };
26 |
27 | ODATACPP_CLIENT_API std::shared_ptr deserilize(const web::json::value& content);
28 |
29 | private:
30 | odata_property_map handle_extract_entity_property(::web::json::value& value, std::shared_ptr<::odata::edm::edm_entity_type>& edm_entity_type);
31 | odata_property_map handle_extract_complex_property(::web::json::value& value, std::shared_ptr<::odata::edm::edm_complex_type>& edm_complex_type);
32 | std::shared_ptr handle_extract_collection_property(std::shared_ptr<::odata::edm::edm_named_type> type, web::json::value& value);
33 | void handle_extract_entity_annotation(const ::utility::string_t& annotation, const ::utility::string_t& value, odata_property_map& result);
34 | void handle_extract_navigation_property(::web::json::value& value, std::shared_ptr<::odata::edm::edm_navigation_type> navigation_type, odata_property_map& result, const ::utility::string_t& name);
35 | ::utility::string_t get_edit_link_from_context_url(const ::utility::string_t& context_url);
36 | void set_edit_link_for_entity_value(const std::shared_ptr& entity_value, const ::utility::string_t& expect_type_name, const ::utility::string_t& edit_link, bool is_collection);
37 |
38 | std::shared_ptr<::odata::edm::edm_model> m_model;
39 | ::utility::string_t m_service_root_url;
40 | std::shared_ptr<::odata::edm::edm_entity_set> m_entity_set;
41 | };
42 |
43 | }}
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/TestList.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_TESTLIST_H
33 | #define UNITTEST_TESTLIST_H
34 |
35 | #include "HelperMacros.h"
36 |
37 | namespace UnitTest {
38 |
39 | class Test;
40 |
41 | class TestList
42 | {
43 | public:
44 | UNITTEST_LINKAGE TestList();
45 | UNITTEST_LINKAGE void Add(Test* test);
46 |
47 | UNITTEST_LINKAGE Test* GetFirst() const;
48 |
49 | UNITTEST_LINKAGE bool IsEmpty() const;
50 |
51 | UNITTEST_LINKAGE void Clear();
52 |
53 | private:
54 | Test* m_head;
55 | Test* m_tail;
56 | };
57 |
58 |
59 | class UNITTEST_LINKAGE ListAdder
60 | {
61 | public:
62 | ListAdder(TestList& list, Test* test, ...);
63 | };
64 |
65 | }
66 |
67 |
68 | #endif
69 |
--------------------------------------------------------------------------------
/tests/framework/TestRunner/test_module_loader.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #ifndef INCLUDED_TEST_MODULE_LOADER
8 | #define INCLUDED_TEST_MODULE_LOADER
9 |
10 | #include
11 | #include "unittestpp.h"
12 |
13 | // Exported function from all test dlls.
14 | typedef UnitTest::TestList & (__cdecl *GetTestsFunc)();
15 |
16 | // Interface to implement on each platform to be be able to load/unload and call global functions.
17 | class test_module
18 | {
19 | public:
20 | test_module(const std::string &dllName) : m_dllName(dllName), m_loaded(false) {}
21 | virtual ~test_module() {}
22 |
23 | unsigned long load()
24 | {
25 | if(!m_loaded)
26 | {
27 | m_loaded = true;
28 | unsigned long error_code = load_impl();
29 | if(error_code != 0)
30 | {
31 | m_loaded = false;
32 | }
33 | return error_code;
34 | }
35 | return 0;
36 | }
37 |
38 | virtual GetTestsFunc get_test_list() = 0;
39 |
40 | unsigned long unload()
41 | {
42 | if(m_loaded)
43 | {
44 | m_loaded = false;
45 | return unload_impl();
46 | }
47 | return 0;
48 | }
49 |
50 | protected:
51 |
52 | virtual unsigned long load_impl() = 0;
53 | virtual unsigned long unload_impl() = 0;
54 |
55 | bool m_loaded;
56 | const std::string m_dllName;
57 |
58 | private:
59 | test_module(const test_module &);
60 | test_module & operator=(const test_module &);
61 | };
62 |
63 | // Handles organizing all test binaries and using the correct module loader.
64 | class test_module_loader
65 | {
66 | public:
67 | test_module_loader();
68 | ~test_module_loader();
69 |
70 | // Does't complain if module with same name is already loaded.
71 | unsigned long load(const std::string &dllName);
72 |
73 | // Module must have already been loaded.
74 | UnitTest::TestList& get_test_list(const std::string &dllName);
75 |
76 | private:
77 | std::map m_modules;
78 | };
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/msvc/vs12/odatacpp_samples.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.30723.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "odata_client.vs12", "odata_client.vs12.vcxproj", "{19EF328C-A68D-4036-8717-3B1B6D1E261E}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{51025A2C-84D1-4F15-A02E-80EF40A02E72}"
9 | ProjectSection(SolutionItems) = preProject
10 | .nuget\NuGet.Config = .nuget\NuGet.Config
11 | .nuget\NuGet.exe = .nuget\NuGet.exe
12 | .nuget\NuGet.targets = .nuget\NuGet.targets
13 | EndProjectSection
14 | EndProject
15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "odata_trippin_sample.vs12", "odata_trippin_sample.vs12.vcxproj", "{5A53AD52-69A4-4086-83A3-D0D300AF4D43}"
16 | EndProject
17 | Global
18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
19 | Debug|Win32 = Debug|Win32
20 | Debug|x64 = Debug|x64
21 | Release|Win32 = Release|Win32
22 | Release|x64 = Release|x64
23 | EndGlobalSection
24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
25 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Debug|Win32.ActiveCfg = Debug|Win32
26 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Debug|Win32.Build.0 = Debug|Win32
27 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Debug|x64.ActiveCfg = Debug|x64
28 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Debug|x64.Build.0 = Debug|x64
29 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Release|Win32.ActiveCfg = Release|Win32
30 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Release|Win32.Build.0 = Release|Win32
31 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Release|x64.ActiveCfg = Release|x64
32 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Release|x64.Build.0 = Release|x64
33 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Debug|Win32.ActiveCfg = Debug|Win32
34 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Debug|Win32.Build.0 = Debug|Win32
35 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Debug|x64.ActiveCfg = Debug|Win32
36 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Release|Win32.ActiveCfg = Release|Win32
37 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Release|Win32.Build.0 = Release|Win32
38 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Release|x64.ActiveCfg = Release|Win32
39 | EndGlobalSection
40 | GlobalSection(SolutionProperties) = preSolution
41 | HideSolutionNode = FALSE
42 | EndGlobalSection
43 | EndGlobal
44 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/TestReporterStdout.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_TESTREPORTERSTDOUT_H
33 | #define UNITTEST_TESTREPORTERSTDOUT_H
34 |
35 | #include "TestReporter.h"
36 |
37 | namespace UnitTest {
38 |
39 | class TestReporterStdout : public TestReporter
40 | {
41 | private:
42 | UNITTEST_LINKAGE virtual void ReportTestStart(TestDetails const& test);
43 | UNITTEST_LINKAGE virtual void ReportFailure(TestDetails const& test, char const* failure);
44 | UNITTEST_LINKAGE virtual void ReportTestFinish(TestDetails const& test, bool passed, float secondsElapsed);
45 | UNITTEST_LINKAGE virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed);
46 | };
47 |
48 | }
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/Posix/TimeHelpers.cpp:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #include "TimeHelpers.h"
33 | #include
34 |
35 | namespace UnitTest {
36 |
37 | Timer::Timer()
38 | {
39 | m_startTime.tv_sec = 0;
40 | m_startTime.tv_usec = 0;
41 | }
42 |
43 | void Timer::Start()
44 | {
45 | gettimeofday(&m_startTime, 0);
46 | }
47 |
48 | double Timer::GetTimeInMs() const
49 | {
50 | struct timeval currentTime;
51 | gettimeofday(¤tTime, 0);
52 |
53 | double const dsecs = currentTime.tv_sec - m_startTime.tv_sec;
54 | double const dus = currentTime.tv_usec - m_startTime.tv_usec;
55 |
56 | return (dsecs * 1000.0) + (dus / 1000.0);
57 | }
58 |
59 | void TimeHelpers::SleepMs(int ms)
60 | {
61 | usleep(ms * 1000);
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/include/odata/communication/http_communication.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/common/utility.h"
10 | #include "cpprest/uri.h"
11 | #include "cpprest/asyncrt_utils.h"
12 | #include "cpprest/json.h"
13 | #include "cpprest/http_client.h"
14 | #include "odata/edm/odata_edm.h"
15 | #include "odata/client/odata_client_options.h"
16 | #include "odata/communication/http_service_exception.h"
17 |
18 | namespace odata { namespace communication
19 | {
20 |
21 | #define HTTP_GET U("GET")
22 | #define HTTP_POST U("POST")
23 | #define HTTP_PATCH U("PATCH")
24 | #define HTTP_DELETE U("DELETE")
25 | #define HTTP_PUT U("PUT")
26 |
27 | typedef ::web::http::http_response http_client_response;
28 |
29 | template
30 | class http_client_proxy
31 | {
32 | public:
33 | http_client_proxy(const ::utility::string_t& baseAddress, std::shared_ptr<::odata::client::odata_client_credential> credential_setting)
34 | {
35 | m_client_impl = std::make_shared<_Http_Imple>(baseAddress, credential_setting);
36 | }
37 |
38 | http_client_proxy(std::shared_ptr<_Http_Imple> client_impl) : m_client_impl(client_impl)
39 | {
40 | }
41 |
42 | pplx::task<_Http_Response> send_http_request(const ::utility::string_t& method, const ::utility::string_t& request_uri, const ::utility::string_t accept)
43 | {
44 | return m_client_impl->send_http_request(method, request_uri, accept);
45 | }
46 |
47 | pplx::task<_Http_Response> send_http_request(const ::utility::string_t& method, const ::utility::string_t& request_uri, const ::utility::string_t accept, ::web::json::value object)
48 | {
49 | return m_client_impl->send_http_request(method, request_uri, accept, object);
50 | }
51 |
52 | ::utility::string_t base_uri()
53 | {
54 | return m_client_impl->base_uri();
55 | }
56 |
57 | ::web::http::client::http_client_config& get_client_config(){
58 | return m_client_impl->get_client_config();
59 | }
60 |
61 | private:
62 | std::shared_ptr<_Http_Imple> m_client_impl;
63 | };
64 |
65 | }}
66 |
--------------------------------------------------------------------------------
/src/core/odata_entity_value.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #include "odata/core/odata_entity_value.h"
8 | #include "odata/edm/edm_model_utility.h"
9 |
10 | using namespace ::odata::edm;
11 | using namespace ::web;
12 |
13 | namespace odata { namespace core
14 | {
15 |
16 | ::utility::string_t odata_entity_value::get_entity_key_string()
17 | {
18 | ::utility::string_t key;
19 |
20 | auto entitytype = std::dynamic_pointer_cast(get_value_type());
21 |
22 | if (entitytype)
23 | {
24 | key += U("(");
25 |
26 | std::vector<::utility::string_t> key_property_names = entitytype->get_key_with_parents();
27 | for (size_t i = 0; i < key_property_names.size(); i++)
28 | {
29 | std::shared_ptr property_value;
30 | get_property_value(key_property_names[i], property_value);
31 | if (property_value)
32 | {
33 | auto property_type = property_value->get_value_type();
34 | if (property_type && property_type->get_type_kind() == edm_type_kind_t::Primitive)
35 | {
36 | if (i != 0)
37 | {
38 | key += U(",");
39 | }
40 |
41 | auto primitive_property_value = std::dynamic_pointer_cast(property_value);
42 | if (primitive_property_value)
43 | {
44 | if (key_property_names.size() == 1)
45 | {
46 | key += to_key(primitive_property_value);
47 | }
48 | else
49 | {
50 | key += key_property_names[i] + U("=") + to_key(primitive_property_value);
51 | }
52 | }
53 | }
54 | else
55 | {
56 | throw std::runtime_error("entity key type error!");
57 | }
58 | }
59 | }
60 |
61 | key += U(")");
62 | }
63 |
64 | return key;
65 | }
66 |
67 | ::utility::string_t odata_entity_value::to_key(std::shared_ptr value)
68 | {
69 | if (value->get_primitive_type()->get_primitive_kind() == edm_primitive_type_kind_t::String)
70 | {
71 | return U("'") + value->to_string() + U("'");
72 | }
73 | else
74 | {
75 | return value->to_string();
76 | }
77 | }
78 |
79 | }}
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/tests/TestCurrentTest.cpp:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #include "stdafx.h"
33 |
34 | namespace
35 | {
36 |
37 | TEST(CanSetandGetDetails)
38 | {
39 | bool ok = false;
40 | {
41 | ScopedCurrentTest scopedTest;
42 |
43 | const UnitTest::TestDetails* details = reinterpret_cast< const UnitTest::TestDetails* >(12345);
44 | UnitTest::CurrentTest::Details() = details;
45 |
46 | ok = (UnitTest::CurrentTest::Details() == details);
47 | }
48 |
49 | CHECK(ok);
50 | }
51 |
52 | TEST(CanSetAndGetResults)
53 | {
54 | bool ok = false;
55 | {
56 | ScopedCurrentTest scopedTest;
57 |
58 | UnitTest::TestResults results;
59 | UnitTest::CurrentTest::Results() = &results;
60 |
61 | ok = (UnitTest::CurrentTest::Results() == &results);
62 | }
63 |
64 | CHECK(ok);
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/include/odata/core/odata_payload.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 |
9 | #include "odata/core/odata_entity_value.h"
10 |
11 | namespace odata { namespace core
12 | {
13 |
14 | enum odata_payload_kind
15 | {
16 | PAYLOAD_KIND_SERVICE_DOCUMENT = 0,
17 | PAYLOAD_KIND_ENTITY,
18 | PAYLOAD_KIND_COLLECTION_ENTITY,
19 | PAYLOAD_KIND_SINGLETON,
20 | PAYLOAD_KIND_DERIVED_ENTITY,
21 | PAYLOAD_KIND_COLLECTION_DERIVED_ENTITY,
22 | PAYLOAD_KIND_PROJECT_ENTITY,
23 | PAYLOAD_KIND_COLLECTION_PROJECT_ENTITY,
24 | PAYLOAD_KIND_EXPAND_ENTITY,
25 | PAYLOAD_KIND_COLLECTION_EXPAND_ENTITY,
26 | PAYLOAD_KIND_ENTITY_REFERENCE,
27 | PAYLOAD_KIND_COLLECTION_ENTITY_REFERENCE,
28 | PAYLOAD_KIND_ENTITY_PROPERTY,
29 | PAYLOAD_KIND_PRIMITIVE_COMPLEX,
30 | PAYLOAD_KIND_COLLECTION_PRIMITIVE_COMPLEX,
31 | PAYLOAD_KIND_UNKNOWN,
32 | };
33 |
34 | class odata_payload
35 | {
36 | public:
37 | odata_payload() {}
38 |
39 | void add_value(std::shared_ptr value)
40 | {
41 | m_odata_values.push_back(value);
42 | }
43 |
44 | void insert_values(const std::vector>& values)
45 | {
46 | m_odata_values.insert(m_odata_values.end(), values.begin(), values.end());
47 | }
48 |
49 | const int value_count() const
50 | {
51 | return m_odata_values.size();
52 | }
53 |
54 | const std::vector>& get_values() const
55 | {
56 | return m_odata_values;
57 | }
58 |
59 | const ::utility::string_t& get_next_link() const
60 | {
61 | return m_next_link;
62 | }
63 |
64 | void set_next_link(::utility::string_t next_link)
65 | {
66 | m_next_link = std::move(next_link);
67 | }
68 |
69 | const ::utility::string_t& get_context_url() const
70 | {
71 | return m_context_url;
72 | }
73 |
74 | void set_context_url(::utility::string_t context_ur)
75 | {
76 | m_context_url = std::move(context_ur);
77 | }
78 |
79 | bool has_next_page_data()
80 | {
81 | return !m_next_link.empty();
82 | }
83 |
84 | private:
85 | std::vector> m_odata_values;
86 | ::utility::string_t m_next_link;
87 | ::utility::string_t m_context_url;
88 | };
89 |
90 | }}
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/TestDetails.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_TESTDETAILS_H
33 | #define UNITTEST_TESTDETAILS_H
34 |
35 | #include "HelperMacros.h"
36 |
37 | namespace UnitTest {
38 |
39 | class TestDetails
40 | {
41 | public:
42 | UNITTEST_LINKAGE TestDetails(char const* testName, char const* suiteName, char const* filename, int lineNumber);
43 | UNITTEST_LINKAGE TestDetails(const TestDetails& details, int lineNumber);
44 |
45 | char const* const suiteName;
46 | char const* const testName;
47 | char const* const filename;
48 | int const lineNumber;
49 |
50 | UNITTEST_LINKAGE TestDetails(TestDetails const&); // Why is it public? --> http://gcc.gnu.org/bugs.html#cxx_rvalbind
51 | private:
52 | TestDetails& operator=(TestDetails const&);
53 | };
54 |
55 | }
56 |
57 | #endif
58 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/Test.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_TEST_H
33 | #define UNITTEST_TEST_H
34 |
35 | #include "TestDetails.h"
36 | #include "TestProperties.h"
37 |
38 | namespace UnitTest {
39 |
40 | class TestResults;
41 |
42 | class Test
43 | {
44 | public:
45 | UNITTEST_LINKAGE explicit Test(char const* testName, char const* suiteName = "DefaultSuite", char const* filename = "", int lineNumber = 0);
46 | UNITTEST_LINKAGE virtual ~Test();
47 | UNITTEST_LINKAGE void Run();
48 |
49 | TestProperties m_properties;
50 |
51 | TestDetails const m_details;
52 | Test* m_nextTest;
53 | mutable bool m_isMockTest;
54 |
55 | UNITTEST_LINKAGE virtual void RunImpl() const;
56 |
57 | private:
58 | Test(Test const&);
59 | Test& operator =(Test const&);
60 | };
61 |
62 |
63 | }
64 |
65 | #endif
66 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/TestReporter.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_TESTREPORTER_H
33 | #define UNITTEST_TESTREPORTER_H
34 |
35 | #include "HelperMacros.h"
36 |
37 | namespace UnitTest {
38 |
39 | class TestDetails;
40 |
41 | class TestReporter
42 | {
43 | public:
44 | UNITTEST_LINKAGE TestReporter();
45 | UNITTEST_LINKAGE virtual ~TestReporter();
46 |
47 | UNITTEST_LINKAGE virtual void ReportTestStart(TestDetails const& test) = 0;
48 | UNITTEST_LINKAGE virtual void ReportFailure(TestDetails const& test, char const* failure) = 0;
49 | UNITTEST_LINKAGE virtual void ReportTestFinish(TestDetails const& test, bool passed, float secondsElapsed) = 0;
50 | UNITTEST_LINKAGE virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed) = 0;
51 | };
52 |
53 | }
54 | #endif
55 |
--------------------------------------------------------------------------------
/include/odata/codegen/code_generation_base.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 | #include "odata/common/utility.h"
9 | #include "cpprest/json.h"
10 | #include "odata/core/odata_core.h"
11 |
12 | namespace odata { namespace codegen {
13 |
14 | #define SAFE_DELETE(value) \
15 | if (value) \
16 | { \
17 | delete value; \
18 | value = nullptr; \
19 | }
20 |
21 | class odata_service_context;
22 |
23 | class type_base
24 | {
25 | public:
26 | type_base(const std::shared_ptr& service_context) : m_service_context(service_context){}
27 | virtual ~type_base(){}
28 |
29 | virtual void from_value(const std::shared_ptr<::odata::core::odata_entity_value>& pentity) {}
30 | virtual void from_value(const std::shared_ptr<::odata::core::odata_complex_value>& pentity) {}
31 |
32 | const ::utility::string_t& get_edit_link()
33 | {
34 | return m_edit_link;
35 | }
36 |
37 | void set_edit_link(::utility::string_t edit_link)
38 | {
39 | m_edit_link = std::move(edit_link);
40 | }
41 |
42 | ::utility::string_t get_key_property_string(bool with_key_name = false)
43 | {
44 | return U("");
45 | }
46 |
47 | protected:
48 | ::utility::string_t m_edit_link;
49 | std::shared_ptr m_service_context;
50 | };
51 |
52 |
53 | typedef void (type_base::*PROP_MAP_CALL_IN_ENTITY)(const std::shared_ptr<::odata::core::odata_entity_value>&);
54 | typedef void (type_base::*PROP_MAP_CALL_IN_COMPLEX)(const std::shared_ptr<::odata::core::odata_complex_value>&);
55 |
56 | typedef std::shared_ptr (*CREATE_CALL_FOR_ENTITY)(const std::shared_ptr<::odata::codegen::odata_service_context>&);
57 | typedef std::unordered_map<::utility::string_t, CREATE_CALL_FOR_ENTITY> create_map_for_entity_type;
58 |
59 | typedef std::shared_ptr (*CREATE_CALL_FOR_COMPLEX)(const std::shared_ptr<::odata::codegen::odata_service_context>&);
60 | typedef std::unordered_map<::utility::string_t, CREATE_CALL_FOR_COMPLEX> create_map_for_complex_type;
61 |
62 | struct PROPMAP_ENTRY_IN_ENTITY
63 | {
64 | PROP_MAP_CALL_IN_ENTITY pfn;
65 | };
66 |
67 | struct PROPMAP_ENTRY_IN_COMPLEX
68 | {
69 | PROP_MAP_CALL_IN_COMPLEX pfn;
70 | };
71 |
72 | }}
--------------------------------------------------------------------------------
/src/codegen/odata_query_path.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #include "odata/common/utility.h"
8 | #include "odata/codegen/odata_query_path.h"
9 |
10 | using namespace ::odata::common;
11 |
12 | namespace odata { namespace codegen {
13 |
14 | ::utility::string_t odata_query_path::normalize_query_options()
15 | {
16 | if (m_query_options.size() > 0)
17 | {
18 | std::sort(m_query_options.begin(), m_query_options.end(), odata_query_option_comparator());
19 |
20 | ::utility::stringstream_t ostr;
21 |
22 | bool first = true;
23 | for (auto iter = m_query_options.cbegin(); iter != m_query_options.cend(); iter++)
24 | {
25 | if (!first)
26 | {
27 | if (m_is_root)
28 | ostr << U("&");
29 | else
30 | ostr << U(";");
31 | }
32 | else
33 | {
34 | first = false;
35 | }
36 |
37 | ostr << iter->get_query_option_clause();
38 | }
39 |
40 | return std::move(ostr.str());
41 | }
42 | else
43 | {
44 | return U("");
45 | }
46 | }
47 |
48 | ::utility::string_t odata_query_path::evaluate_query_path()
49 | {
50 | ::utility::stringstream_t ostr;
51 |
52 | ostr << m_resource_path;
53 |
54 | if (m_is_root && (m_query_options.size() > 0 || l_child_item))
55 | {
56 | ostr << U("?");
57 | }
58 |
59 | if (!m_is_root && (m_query_options.size() > 0 || l_child_item))
60 | ostr << U("(");
61 |
62 | ostr << normalize_query_options();
63 |
64 | if (l_child_item)
65 | {
66 | if (m_query_options.size() > 0)
67 | {
68 | if (m_is_root)
69 | ostr << U("&");
70 | else
71 | ostr << U(";");
72 | }
73 |
74 | ostr << U("$expand=");
75 |
76 | bool first = true;
77 |
78 | odata_query_path* child = l_child_item;
79 | while(child)
80 | {
81 | if (!first)
82 | {
83 | ostr << U(",");
84 | }
85 | else
86 | {
87 | first = false;
88 | }
89 |
90 | ostr << child->evaluate_query_path();
91 |
92 | child = child->l_sibling_item;
93 | }
94 | }
95 |
96 | if (!m_is_root && (m_query_options.size() > 0 || l_child_item))
97 | ostr << U(")");
98 |
99 | return std::move(ostr.str());
100 | }
101 |
102 | }}
103 |
--------------------------------------------------------------------------------
/tests/functional/codegen_tool_test/baseline/simple_model_test_baseline.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #pragma once
8 | #include "odata/codegen/code_generation.h"
9 | #include "odata/codegen/odata_service_context.h"
10 | #include "odata/codegen/odata_service_query.h"
11 | #include "odata/codegen/odata_entityset_query_executor.h"
12 | #include "odata/codegen/odata_singleton_query_executor.h"
13 | #include "odata/codegen/odata_primitive_query_executor.h"
14 | #include "odata/codegen/odata_primitive_query_executor.h"
15 | #include "odata/codegen/odata_complex_query_executor.h"
16 | #include "odata/codegen/odata_enum_query_executor.h"
17 | #include "odata/codegen/odata_void_query_executor.h"
18 | #include "odata/codegen/odata_query_builder.h"
19 | #include "cpprest/json.h"
20 |
21 | using namespace std;
22 | using namespace ::odata::client;
23 | using namespace ::odata::core;
24 | using namespace ::odata::edm;
25 | using namespace ::odata::codegen;
26 |
27 | namespace Simple
28 | {
29 |
30 |
31 | class TestType;
32 |
33 | class enum_type_resolver
34 | {
35 | public:
36 | };
37 |
38 | class TestType : public type_base
39 | {
40 | public:
41 | DECLARE_ENTITY_CONSTRUCTOR(TestType);
42 | DECLARE_ENTITY_DESTRUCTOR(TestType);
43 | DECLARE_EDM_INFO();
44 | ENABLE_PROPERTY_IN_ENTITY_MAPPING();
45 |
46 | DECLARE_PRIMITIVE_PROPERTY_IN_ENTITY_MAPPING(keyprop, KeyProp, int32_t);
47 | DECLARE_PRIMITIVE_PROPERTY_IN_ENTITY_MAPPING(valueprop, ValueProp, ::utility::string_t);
48 |
49 | DECLARE_GET_KEY_PROPERTY_STRING_ONE_PARAM(type_base, KeyProp, keyprop);
50 | };
51 |
52 | class DefaultContainer : public odata_service_context
53 | {
54 | public:
55 | DefaultContainer(const ::utility::string_t& baseAddress, client_options options = client_options()) : odata_service_context(baseAddress, options)
56 | {
57 | }
58 |
59 | std::shared_ptr, odata_query_builder>> create_testtypeset_query()
60 | {
61 | return create_query, odata_query_builder>(U("TestTypeSet"));
62 | }
63 |
64 | };
65 |
66 | #include "odata/codegen/odata_function_param_formatter.h"
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/msvc/vs11/odatacpp_samples.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2012
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "odata_client.vs11", "odata_client.vs11.vcxproj", "{19EF328C-A68D-4036-8717-3B1B6D1E261E}"
5 | EndProject
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{51025A2C-84D1-4F15-A02E-80EF40A02E72}"
7 | ProjectSection(SolutionItems) = preProject
8 | .nuget\NuGet.Config = .nuget\NuGet.Config
9 | .nuget\NuGet.exe = .nuget\NuGet.exe
10 | .nuget\NuGet.targets = .nuget\NuGet.targets
11 | EndProjectSection
12 | EndProject
13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "odata_trippin_sample.vs11", "odata_trippin_sample.vs11.vcxproj", "{5A53AD52-69A4-4086-83A3-D0D300AF4D43}"
14 | EndProject
15 | Global
16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
17 | Debug|ARM = Debug|ARM
18 | Debug|Win32 = Debug|Win32
19 | Debug|x64 = Debug|x64
20 | Release|ARM = Release|ARM
21 | Release|Win32 = Release|Win32
22 | Release|x64 = Release|x64
23 | EndGlobalSection
24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
25 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Debug|ARM.ActiveCfg = Debug|Win32
26 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Debug|Win32.ActiveCfg = Debug|Win32
27 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Debug|Win32.Build.0 = Debug|Win32
28 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Debug|x64.ActiveCfg = Debug|Win32
29 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Release|ARM.ActiveCfg = Release|Win32
30 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Release|Win32.ActiveCfg = Release|Win32
31 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Release|Win32.Build.0 = Release|Win32
32 | {19EF328C-A68D-4036-8717-3B1B6D1E261E}.Release|x64.ActiveCfg = Release|Win32
33 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Debug|ARM.ActiveCfg = Debug|Win32
34 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Debug|Win32.ActiveCfg = Debug|Win32
35 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Debug|Win32.Build.0 = Debug|Win32
36 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Debug|x64.ActiveCfg = Debug|Win32
37 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Release|ARM.ActiveCfg = Release|Win32
38 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Release|Win32.ActiveCfg = Release|Win32
39 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Release|Win32.Build.0 = Release|Win32
40 | {5A53AD52-69A4-4086-83A3-D0D300AF4D43}.Release|x64.ActiveCfg = Release|Win32
41 | EndGlobalSection
42 | GlobalSection(SolutionProperties) = preSolution
43 | HideSolutionNode = FALSE
44 | EndGlobalSection
45 | EndGlobal
46 |
--------------------------------------------------------------------------------
/src/edm/edm_schema.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #include "odata/edm/edm_schema.h"
8 |
9 | namespace odata { namespace edm
10 | {
11 |
12 | std::shared_ptr edm_schema::find_entity_type(::utility::string_t name) const
13 | {
14 | auto nsp_size = m_namespace.size();
15 | if (name.size() > nsp_size && name.substr(0, nsp_size) == m_namespace)
16 | {
17 | // Strip qualification when searching.
18 | name = name.substr(nsp_size + 1);
19 | }
20 |
21 | auto find_iter = m_entity_types.find(name);
22 | if (find_iter != m_entity_types.end())
23 | {
24 | return find_iter->second;
25 | }
26 |
27 | return nullptr;
28 | }
29 |
30 | std::shared_ptr edm_schema::find_complex_type(::utility::string_t name) const
31 | {
32 | auto nsp_size = m_namespace.size();
33 | if (name.size() > nsp_size && name.substr(0, nsp_size) == m_namespace)
34 | {
35 | // Strip qualification when searching.
36 | name = name.substr(nsp_size + 1);
37 | }
38 |
39 | auto find_iter = m_complex_types.find(name);
40 | if (find_iter != m_complex_types.end())
41 | {
42 | return find_iter->second;
43 | }
44 |
45 | return nullptr;
46 | }
47 |
48 | std::shared_ptr edm_schema::find_enum_type(::utility::string_t name) const
49 | {
50 | auto nsp_size = m_namespace.size();
51 | if ( name.size() > nsp_size && name.substr(0, nsp_size) == m_namespace)
52 | {
53 | // Strip qualification when searching.
54 | name = name.substr(nsp_size + 1);
55 | }
56 |
57 | auto find_iter = m_enum_types.find(name);
58 | if (find_iter != m_enum_types.end())
59 | {
60 | return find_iter->second;
61 | }
62 |
63 | return nullptr;
64 | }
65 |
66 | std::shared_ptr edm_schema::find_operation_type(::utility::string_t name) const
67 | {
68 | auto nsp_size = m_namespace.size();
69 | if ( name.size() > nsp_size && name.substr(0, nsp_size) == m_namespace)
70 | {
71 | // Strip qualification when searching.
72 | name = name.substr(nsp_size+1);
73 | }
74 |
75 | auto find_iter = m_operation_types.find(name);
76 | if (find_iter != m_operation_types.end())
77 | {
78 | return find_iter->second;
79 | }
80 |
81 | return nullptr;
82 | }
83 |
84 | }}
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/Win32/TimeHelpers.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_TIMEHELPERS_H
33 | #define UNITTEST_TIMEHELPERS_H
34 |
35 | #include "../../config.h"
36 | #include "../HelperMacros.h"
37 |
38 | #ifdef UNITTEST_MINGW
39 | #ifndef __int64
40 | #define __int64 long long
41 | #endif
42 | #endif
43 |
44 | namespace UnitTest {
45 |
46 | class Timer
47 | {
48 | public:
49 | UNITTEST_LINKAGE Timer();
50 | UNITTEST_LINKAGE void Start();
51 | UNITTEST_LINKAGE double GetTimeInMs() const;
52 |
53 | private:
54 | __int64 GetTime() const;
55 |
56 | void* m_threadHandle;
57 |
58 | #if defined(_WIN64)
59 | unsigned __int64 m_processAffinityMask;
60 | #else
61 | unsigned long m_processAffinityMask;
62 | #endif
63 |
64 | __int64 m_startTime;
65 | __int64 m_frequency;
66 | };
67 |
68 |
69 | namespace TimeHelpers
70 | {
71 | UNITTEST_LINKAGE void SleepMs(int ms);
72 | }
73 |
74 | }
75 |
76 | #endif
77 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/GlobalSettings.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_GLOBAL_PROPERTIES_H
33 | #define UNITTEST_GLOBAL_PROPERTIES_H
34 |
35 | #include
36 |
37 | namespace UnitTest {
38 |
39 | // Simple key value pairs for global properties.
40 | // Any test case which specifies a 'Requires' TestProperty will only execute if
41 | // the required property is satisfied as a key in the GlobalSettings.
42 | class GlobalSettings
43 | {
44 | public:
45 |
46 | UNITTEST_LINKAGE static void Add(const std::string &key, const std::string &value);
47 |
48 | UNITTEST_LINKAGE static bool Has(const std::string &key);
49 |
50 | UNITTEST_LINKAGE static const std::string &Get(const std::string &key);
51 |
52 | private:
53 | GlobalSettings();
54 | GlobalSettings(const GlobalSettings &);
55 | GlobalSettings &operator=(const GlobalSettings &);
56 | };
57 | }
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/src/core/odata_structured_value.cpp:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------
2 | //
3 | // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
4 | //
5 | //---------------------------------------------------------------------
6 |
7 | #include "odata/core/odata_structured_value.h"
8 | #include "odata/core/odata_collection_value.h"
9 | #include "odata/core/odata_complex_value.h"
10 | #include "odata/core/odata_enum_value.h"
11 | #include "odata/core/odata_entity_value.h"
12 | #include "odata/edm/edm_model_utility.h"
13 |
14 | using namespace web;
15 | using namespace odata::edm;
16 |
17 | namespace odata { namespace core
18 | {
19 |
20 | void odata_structured_value::set_value(const ::utility::string_t& property_name, const ::utility::string_t& string_value)
21 | {
22 | bool setted = false;
23 | std::shared_ptr property_value;
24 | if (get_property_value(property_name, property_value))
25 | {
26 | std::shared_ptr property_type = property_value->get_value_type();
27 | if (property_type && (property_type->get_type_kind() == edm_type_kind_t::Primitive))
28 | {
29 | setted = true;
30 | m_properties[property_name] = std::make_shared(std::dynamic_pointer_cast(property_type), string_value);
31 | }
32 | }
33 |
34 | if (!setted)
35 | {
36 | m_properties[property_name] = std::make_shared(edm_primitive_type::STRING(), string_value);
37 | }
38 | }
39 |
40 | void odata_structured_value::set_value(const ::utility::string_t& property_name, std::shared_ptr property_value)
41 | {
42 | m_properties[property_name] = property_value;
43 | }
44 |
45 | void odata_structured_value::set_value(const ::utility::string_t& property_name, std::shared_ptr property_value)
46 | {
47 | m_properties[property_name] = property_value;
48 | }
49 |
50 | void odata_structured_value::set_value(const ::utility::string_t& property_name, std::shared_ptr property_value)
51 | {
52 | m_properties[property_name] = property_value;
53 | }
54 |
55 | void odata_structured_value::set_value(const ::utility::string_t& property_name, std::shared_ptr property_value)
56 | {
57 | m_properties[property_name] = property_value;
58 | }
59 |
60 | void odata_structured_value::set_value(const ::utility::string_t& property_name, std::shared_ptr property_value)
61 | {
62 | m_properties[property_name] = property_value;
63 | }
64 |
65 | }}
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/DeferredTestReporter.h:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #ifndef UNITTEST_DEFERREDTESTREPORTER_H
33 | #define UNITTEST_DEFERREDTESTREPORTER_H
34 |
35 | #include "../config.h"
36 |
37 | #ifndef UNITTEST_NO_DEFERRED_REPORTER
38 |
39 | #include "TestReporter.h"
40 | #include "DeferredTestResult.h"
41 |
42 | #include
43 |
44 | namespace UnitTest
45 | {
46 |
47 | class DeferredTestReporter : public TestReporter
48 | {
49 | public:
50 | UNITTEST_LINKAGE virtual void ReportTestStart(TestDetails const& details);
51 | UNITTEST_LINKAGE virtual void ReportFailure(TestDetails const& details, char const* failure);
52 | UNITTEST_LINKAGE virtual void ReportTestFinish(TestDetails const& details, bool passed, float secondsElapsed);
53 |
54 | typedef std::vector< DeferredTestResult > DeferredTestResultList;
55 | UNITTEST_LINKAGE DeferredTestResultList& GetResults();
56 |
57 | private:
58 | DeferredTestResultList m_results;
59 | };
60 |
61 | }
62 |
63 | #endif
64 | #endif
65 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/DeferredTestReporter.cpp:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #include "TestHeader.h"
33 |
34 | #ifndef UNITTEST_NO_DEFERRED_REPORTER
35 |
36 | using namespace UnitTest;
37 |
38 | void DeferredTestReporter::ReportTestStart(TestDetails const& details)
39 | {
40 | m_results.push_back(DeferredTestResult(details.suiteName, details.testName));
41 | }
42 |
43 | void DeferredTestReporter::ReportFailure(TestDetails const& details, char const* failure)
44 | {
45 | DeferredTestResult& r = m_results.back();
46 | r.failed = true;
47 | r.failures.push_back(DeferredTestFailure(details.lineNumber, failure));
48 | r.failureFile = details.filename;
49 | }
50 |
51 | void DeferredTestReporter::ReportTestFinish(TestDetails const&, bool, float secondsElapsed)
52 | {
53 | DeferredTestResult& r = m_results.back();
54 | r.timeElapsed = secondsElapsed;
55 | }
56 |
57 | DeferredTestReporter::DeferredTestResultList& DeferredTestReporter::GetResults()
58 | {
59 | return m_results;
60 | }
61 |
62 | #endif
63 |
--------------------------------------------------------------------------------
/tests/framework/UnitTestpp/src/GlobalSettings.cpp:
--------------------------------------------------------------------------------
1 | /***
2 | * This file is based on or incorporates material from the UnitTest++ r30 open source project.
3 | * Microsoft is not the original author of this code but has modified it and is licensing the code under
4 | * the MIT License. Microsoft reserves all other rights not expressly granted under the MIT License,
5 | * whether by implication, estoppel or otherwise.
6 | *
7 | * UnitTest++ r30
8 | *
9 | * Copyright (c) 2006 Noel Llopis and Charles Nicholson
10 | * Portions Copyright (c) Microsoft Corporation
11 | *
12 | * All Rights Reserved.
13 | *
14 | * MIT License
15 | *
16 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
17 | * and associated documentation files (the "Software"), to deal in the Software without restriction,
18 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 | * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
20 | * subject to the following conditions:
21 | *
22 | * The above copyright notice and this permission notice shall be included in all copies or
23 | * substantial portions of the Software.
24 | *
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
26 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
27 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 | ***/
31 |
32 | #include "TestHeader.h"
33 |
34 | #include
35 | #include