diff --git a/src/cpp/helpers/CMakeLists.txt b/src/cpp/helpers/CMakeLists.txt index 322be120e..28abc5a3e 100644 --- a/src/cpp/helpers/CMakeLists.txt +++ b/src/cpp/helpers/CMakeLists.txt @@ -23,7 +23,6 @@ target_sources(helpers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ArchiveWriter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Clock.cpp ${CMAKE_CURRENT_SOURCE_DIR}/FileInBuffer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/JsonXpansionReader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/OptionsParser.cpp ${CMAKE_CURRENT_SOURCE_DIR}/include/antares-xpansion/helpers/AntaresArchiveUpdater.h ${CMAKE_CURRENT_SOURCE_DIR}/include/antares-xpansion/helpers/AntaresArchiveUpdaterExeOptions.h diff --git a/src/cpp/study-updater/CMakeLists.txt b/src/cpp/study-updater/CMakeLists.txt index 3f729950e..15171a608 100644 --- a/src/cpp/study-updater/CMakeLists.txt +++ b/src/cpp/study-updater/CMakeLists.txt @@ -1,19 +1,21 @@ add_library(xpansion_study_updater_lib) target_sources(xpansion_study_updater_lib PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/JsonXpansionReader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/LinkCapacitiesCSVWriter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/StudyUpdateStrategy.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/LinkParametersCSVOverwriter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/StudyUpdateLinkCapacitiesStrategy.cpp ${CMAKE_CURRENT_SOURCE_DIR}/StudyUpdateLinkParameterStrategy.cpp ${CMAKE_CURRENT_SOURCE_DIR}/StudyUpdateRunner.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/LinkParametersCSVOverwriter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/StudyUpdateStrategy.cpp ${CMAKE_CURRENT_SOURCE_DIR}/StudyUpdater.cpp ${CMAKE_CURRENT_SOURCE_DIR}/include/antares-xpansion/study-updater/LinkCapacitiesCSVWriter.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/antares-xpansion/study-updater/StudyUpdateStrategy.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/antares-xpansion/study-updater/LinkParametersCSVOverwriter.h ${CMAKE_CURRENT_SOURCE_DIR}/include/antares-xpansion/study-updater/StudyUpdateLinkCapacitiesStrategy.h ${CMAKE_CURRENT_SOURCE_DIR}/include/antares-xpansion/study-updater/StudyUpdateLinkParameterStrategy.h ${CMAKE_CURRENT_SOURCE_DIR}/include/antares-xpansion/study-updater/StudyUpdateRunner.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/antares-xpansion/study-updater/LinkParametersCSVOverwriter.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/antares-xpansion/study-updater/StudyUpdateStrategy.h ${CMAKE_CURRENT_SOURCE_DIR}/include/antares-xpansion/study-updater/StudyUpdater.h + ${CMAKE_CURRENT_SOURCE_DIR}/private/JsonXpansionReader.h ) target_link_libraries(xpansion_study_updater_lib @@ -29,6 +31,8 @@ target_link_libraries(xpansion_study_updater_lib target_include_directories(xpansion_study_updater_lib PUBLIC $ + PRIVATE + $ ) add_library(${PROJECT_NAME}::xpansion_study_updater_lib ALIAS xpansion_study_updater_lib) diff --git a/src/cpp/helpers/JsonXpansionReader.cpp b/src/cpp/study-updater/JsonXpansionReader.cpp similarity index 95% rename from src/cpp/helpers/JsonXpansionReader.cpp rename to src/cpp/study-updater/JsonXpansionReader.cpp index 6e252ab99..9acd49f0d 100644 --- a/src/cpp/helpers/JsonXpansionReader.cpp +++ b/src/cpp/study-updater/JsonXpansionReader.cpp @@ -1,4 +1,4 @@ -#include "antares-xpansion/helpers/JsonXpansionReader.h" +#include "JsonXpansionReader.h" #include diff --git a/src/cpp/study-updater/LinkParametersCSVOverwriter.cpp b/src/cpp/study-updater/LinkParametersCSVOverwriter.cpp index cb23022e0..da4a66cf7 100644 --- a/src/cpp/study-updater/LinkParametersCSVOverwriter.cpp +++ b/src/cpp/study-updater/LinkParametersCSVOverwriter.cpp @@ -4,9 +4,8 @@ #include "antares-xpansion/study-updater/LinkParametersCSVOverwriter.h" -#include "antares-xpansion/helpers/JsonXpansionReader.h" +#include "JsonXpansionReader.h" #include "antares-xpansion/lpnamer/problem_modifier/LinkdataRecord.h" -#include "antares-xpansion/study-updater/StudyUpdater.h" bool LinkParametersCSVOverWriter::open( const std::filesystem::path& linkdataFilename_l) { diff --git a/src/cpp/study-updater/StudyUpdater.cpp b/src/cpp/study-updater/StudyUpdater.cpp index 9ace90821..dc9ea9180 100644 --- a/src/cpp/study-updater/StudyUpdater.cpp +++ b/src/cpp/study-updater/StudyUpdater.cpp @@ -2,7 +2,7 @@ #include -#include "antares-xpansion/helpers/JsonXpansionReader.h" +#include "JsonXpansionReader.h" #include "antares-xpansion/study-updater/StudyUpdateLinkCapacitiesStrategy.h" #include "antares-xpansion/study-updater/StudyUpdateLinkParameterStrategy.h" #include "antares-xpansion/study-updater/StudyUpdateStrategy.h" diff --git a/src/cpp/helpers/include/antares-xpansion/helpers/JsonXpansionReader.h b/src/cpp/study-updater/private/JsonXpansionReader.h similarity index 100% rename from src/cpp/helpers/include/antares-xpansion/helpers/JsonXpansionReader.h rename to src/cpp/study-updater/private/JsonXpansionReader.h diff --git a/tests/cpp/CMakeLists.txt b/tests/cpp/CMakeLists.txt index 9f3f7f706..57c45ed00 100644 --- a/tests/cpp/CMakeLists.txt +++ b/tests/cpp/CMakeLists.txt @@ -32,3 +32,4 @@ add_subdirectory(zip_mps) add_subdirectory(benders) add_subdirectory(full_run) add_subdirectory(outer_loop) +add_subdirectory(study_updater) diff --git a/tests/cpp/helpers/CMakeLists.txt b/tests/cpp/helpers/CMakeLists.txt index 587dbfa94..6574761c7 100644 --- a/tests/cpp/helpers/CMakeLists.txt +++ b/tests/cpp/helpers/CMakeLists.txt @@ -1,5 +1,4 @@ add_executable (helpers_test - JsonXpansionReaderTest.cc AntaresVersionProviderTest.cpp OptionsParserTest.cpp) @@ -18,7 +17,6 @@ target_link_libraries (helpers_test PRIVATE antaresXpansion::lp_namer_model antaresXpansion::lp_namer_input_reader antaresXpansion::lp_namer_problem_modifier - ${JSONCPP_LIB} ${PROJECT_NAME}::benders_sequential_core ) diff --git a/tests/cpp/study_updater/CMakeLists.txt b/tests/cpp/study_updater/CMakeLists.txt new file mode 100644 index 000000000..4deef589e --- /dev/null +++ b/tests/cpp/study_updater/CMakeLists.txt @@ -0,0 +1,22 @@ +add_executable(study_updater_test) +target_sources(study_updater_test PRIVATE + JsonXpansionReaderTest.cc +) + +# Get source dir to include private headers +# Better way would be to rework test and use StudyUpdater::update as entry point +get_target_property(STUDY_UPDATER_SOURCE_DIR ${PROJECT_NAME}::xpansion_study_updater_lib SOURCE_DIR) + +target_include_directories(study_updater_test +PRIVATE + ${STUDY_UPDATER_SOURCE_DIR}/private # for private headers +) + +target_link_libraries(study_updater_test + PRIVATE + ${PROJECT_NAME}::xpansion_study_updater_lib + ${JSONCPP_LIB} + GTest::Main +) +add_test(NAME study_updater_test COMMAND study_updater_test WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) +set_property(TEST study_updater_test PROPERTY LABELS unit) diff --git a/tests/cpp/helpers/JsonXpansionReaderTest.cc b/tests/cpp/study_updater/JsonXpansionReaderTest.cc similarity index 98% rename from tests/cpp/helpers/JsonXpansionReaderTest.cc rename to tests/cpp/study_updater/JsonXpansionReaderTest.cc index 5408ff851..01fefc098 100644 --- a/tests/cpp/helpers/JsonXpansionReaderTest.cc +++ b/tests/cpp/study_updater/JsonXpansionReaderTest.cc @@ -1,7 +1,7 @@ #include #include -#include "antares-xpansion/helpers/JsonXpansionReader.h" +#include "JsonXpansionReader.h" #include "gtest/gtest.h" class JsonXpansionReaderTest : public ::testing::Test {