@@ -68,6 +68,42 @@ char const* dbs2Str =
68
68
#include " DBServer0003.json"
69
69
;
70
70
71
+ int loadResources (void ) {return 0 ;}
72
+
73
+ #else // _WIN32
74
+ #include < Windows.h>
75
+ #include " jsonresource.h"
76
+ LPSTR planStr = nullptr ;
77
+ LPSTR currentStr = nullptr ;
78
+ LPSTR supervisionStr = nullptr ;
79
+ LPSTR dbs0Str = nullptr ;
80
+ LPSTR dbs1Str = nullptr ;
81
+ LPSTR dbs2Str = nullptr ;
82
+
83
+ LPSTR getResource (int which) {
84
+ HRSRC myResource = ::FindResource (NULL , MAKEINTRESOURCE (which), RT_RCDATA);
85
+ HGLOBAL myResourceData = ::LoadResource (NULL , myResource);
86
+ return (LPSTR) ::LockResource (myResourceData);
87
+ }
88
+ int loadResources (void ) {
89
+ if ((planStr == nullptr ) &&
90
+ (currentStr == nullptr ) &&
91
+ (supervisionStr == nullptr ) &&
92
+ (dbs0Str == nullptr ) &&
93
+ (dbs1Str == nullptr ) &&
94
+ (dbs2Str == nullptr )) {
95
+ planStr = getResource (IDS_PLAN);
96
+ currentStr = getResource (IDS_CURRENT);
97
+ dbs0Str = getResource (IDS_DBSERVER0001);
98
+ dbs1Str = getResource (IDS_DBSERVER0002);
99
+ dbs2Str = getResource (IDS_DBSERVER0003);
100
+ supervisionStr = getResource (IDS_SUPERVISION);
101
+ }
102
+ return 0 ;
103
+ }
104
+
105
+ #endif // _WIN32
106
+
71
107
std::map<std::string, std::string> matchShortLongIds (Node const & supervision) {
72
108
std::map<std::string, std::string> ret;
73
109
for (auto const & dbs : supervision (" Health" ).children ()) {
@@ -291,6 +327,7 @@ class LogicalCollection;
291
327
class MaintenanceTestActionDescription : public ::testing::Test {
292
328
protected:
293
329
MaintenanceTestActionDescription () {
330
+ loadResources ();
294
331
plan = createNode (planStr);
295
332
originalPlan = plan;
296
333
supervision = createNode (supervisionStr);
@@ -324,8 +361,7 @@ TEST_F(MaintenanceTestActionDescription, retrieve_nonassigned_key_from_actiondes
324
361
try {
325
362
auto bogus = desc.get (" bogus" );
326
363
ASSERT_TRUE (bogus == " bogus" );
327
- } catch (std::out_of_range const & e) {
328
- }
364
+ } catch (std::out_of_range const &) { }
329
365
std::string value;
330
366
auto res = desc.get (" bogus" , value);
331
367
ASSERT_TRUE (value.empty ());
@@ -339,8 +375,7 @@ TEST_F(MaintenanceTestActionDescription, retrieve_nonassigned_key_from_actiondes
339
375
try {
340
376
auto bogus = desc.get (" bogus" );
341
377
ASSERT_TRUE (bogus == " bogus" );
342
- } catch (std::out_of_range const & e) {
343
- }
378
+ } catch (std::out_of_range const &) { }
344
379
std::string value;
345
380
auto res = desc.get (" bogus" , value);
346
381
ASSERT_TRUE (value == " bogus" );
@@ -434,6 +469,7 @@ TEST_F(MaintenanceTestActionDescription, retrieve_array_value_from_actiondescrip
434
469
435
470
class MaintenanceTestActionPhaseOne : public ::testing::Test {
436
471
protected:
472
+ int _dummy;
437
473
std::shared_ptr<arangodb::options::ProgramOptions> po;
43
6D40
8
474
arangodb::application_features::ApplicationServer as;
439
475
TestMaintenanceFeature feature;
@@ -443,18 +479,19 @@ class MaintenanceTestActionPhaseOne : public ::testing::Test {
443
479
444
480
arangodb::MMFilesEngine engine; // arbitrary implementation that has index types registered
445
481
arangodb::StorageEngine* origStorageEngine;
446
-
482
+
447
483
MaintenanceTestActionPhaseOne ()
448
- : po(std::make_shared<arangodb::options::ProgramOptions>(" test" , std::string(),
449
- std::string (),
450
- "path")),
451
- as(po, nullptr ),
452
- feature(as),
453
- localNodes{{dbsIds[shortNames[0 ]], createNode (dbs0Str)},
454
- {dbsIds[shortNames[1 ]], createNode (dbs1Str)},
455
- {dbsIds[shortNames[2 ]], createNode (dbs2Str)}},
456
- engine (as),
457
- origStorageEngine(arangodb::EngineSelectorFeature::ENGINE) {
484
+ : _dummy(loadResources()),
485
+ po (std::make_shared<arangodb::options::ProgramOptions>(" test" , std::string(),
486
+ std::string(),
487
+ "path")),
488
+ as(po, nullptr ),
489
+ feature(as),
490
+ localNodes{{dbsIds[shortNames[0 ]], createNode (dbs0Str)},
491
+ {dbsIds[shortNames[1 ]], createNode (dbs1Str)},
492
+ {dbsIds[shortNames[2 ]], createNode (dbs2Str)}},
493
+ engine (as),
494
+ origStorageEngine(arangodb::EngineSelectorFeature::ENGINE) {
458
495
arangodb::EngineSelectorFeature::ENGINE = &engine;
459
496
}
460
497
@@ -836,5 +873,3 @@ TEST_F(MaintenanceTestActionPhaseOne, removed_follower_in_plan_must_be_dropped)
836
873
}
837
874
}
838
875
}
839
-
840
- #endif
0 commit comments