diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt index 1a7733b4f9dcadc2d0b796ba38e584bc56271ec7..fa7a816f862221b5e20068a2d128389cdf479f08 100644 --- a/examples/ClientTests/CMakeLists.txt +++ b/examples/ClientTests/CMakeLists.txt @@ -30,8 +30,18 @@ dd4hep_install_dir( compact scripts DESTINATION ${DD4hep_DIR}/examples/ClientTes dd4hep_configure_scripts( ClientTests DEFAULT_SETUP WITH_TESTS) #--- Testing ------------------------------------------------------------ # +# Test JSON based parser +dd4hep_add_test_reg( ClientTests_MiniTel_JSON_Dump + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" + EXEC_ARGS geoPluginRun -destroy -plugin DD4hep_JsonDumper + ${CMAKE_CURRENT_SOURCE_DIR}/compact/MiniTel.json + REGEX_PASS "Successfully dumped json input" + REGEX_FAIL "Exception" + REGEX_FAIL "FAILED" + ) +# # Test JSON based detector construction -dd4hep_add_test_reg( ClientTests_MiniTel_JSON +dd4hep_add_test_reg( ClientTests_MiniTel_JSON_Detector COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hepCompactLoader file:${CMAKE_CURRENT_SOURCE_DIR}/compact/MiniTel_json.xml diff --git a/examples/ClientTests/src_boost/JsonTest.cpp b/examples/ClientTests/src_boost/JsonDumper.cpp similarity index 76% rename from examples/ClientTests/src_boost/JsonTest.cpp rename to examples/ClientTests/src_boost/JsonDumper.cpp index 13cb089d9c07955b318c4463d6509a4adb495b13..471672bd3d186c77391f3b52f4e84b329f25e362 100644 --- a/examples/ClientTests/src_boost/JsonTest.cpp +++ b/examples/ClientTests/src_boost/JsonDumper.cpp @@ -15,23 +15,22 @@ // Framework include files #include "JSON/Elements.h" #include "JSON/DocumentHandler.h" +#include "DD4hep/Printout.h" #include "DD4hep/Factories.h" -using namespace std; using namespace DD4hep; -using namespace DD4hep::JSON; -using namespace DD4hep::Geometry; -static long json_dump(LCDD& /* lcdd */, int argc, char** argv) { +static long json_dump(Geometry::LCDD& /* lcdd */, int argc, char** argv) { if ( argc < 1 ) { ::printf("DD4hep_JsonDumper <file> \n"); exit(EINVAL); } - DocumentHolder doc(JSON::DocumentHandler().load(argv[0])); + std::string fname = argv[0]; + JSON::DocumentHolder doc(JSON::DocumentHandler().load(fname)); dumpTree(doc.root()); + printout(INFO,"JsonDumper","+++ Successfully dumped json input: %s.",fname.c_str()); return 1; } - DECLARE_APPLY(DD4hep_JsonDumper,json_dump) #endif