hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DRCEFunctionalTests.cpp
Go to the documentation of this file.
1 #include <gtest/gtest.h>
2 
3 #include "DRCEProtocolsTest.hpp"
12 #include "DRCEStressTest.hpp"
13 #include "DRCECleanupTest.hpp"
14 
15 //-----------------------------------------------------------------------------
16 //-----------------------------------------------------------------------------
17 TEST(DRCEProtocolsTest, testResultDataSerializator)
18 {
20 }
21 //-----------------------------------------------------------------------------
22 TEST(DRCEProtocolsTest, testInputJsonMessage)
23 {
25 }
26 //-----------------------------------------------------------------------------
27 TEST(DRCEProtocolsTest, testTaskExecuteRequest)
28 {
30 }
31 //-----------------------------------------------------------------------------
32 TEST(DRCEProtocolsTest, testOutputJsonMessage)
33 {
35 }
36 //-----------------------------------------------------------------------------
37 TEST(DRCEProtocolsTest, testSessionOptions)
38 {
40 }
41 //-----------------------------------------------------------------------------
42 TEST(DRCEProtocolsTest, testResourceLimits)
43 {
45 }
46 //-----------------------------------------------------------------------------
47 TEST(DRCEProtocolsTest, testFilesItemList)
48 {
50 }
51 //-----------------------------------------------------------------------------
52 //-----------------------------------------------------------------------------
53 TEST(DRCEActionTypesTest, testCreateBeforeExec)
54 {
56 }
57 //-----------------------------------------------------------------------------
58 TEST(DRCEActionTypesTest, testDeleteBeforeExec)
59 {
61 }
62 //-----------------------------------------------------------------------------
63 TEST(DRCEActionTypesTest, testReadAfterExec)
64 {
66 }
67 //-----------------------------------------------------------------------------
68 TEST(DRCEActionTypesTest, testDeleteAfterExec)
69 {
71 }
72 //-----------------------------------------------------------------------------
73 //-----------------------------------------------------------------------------
74 TEST(DRCERequestLocalShellTest, testEmptyCommand)
75 {
77 }
78 //-----------------------------------------------------------------------------
79 TEST(DRCERequestLocalShellTest, testInputStreamWithCommand)
80 {
82 }
83 //-----------------------------------------------------------------------------
84 TEST(DRCERequestLocalShellTest, testInputStreamWithoutCommand)
85 {
87 }
88 //-----------------------------------------------------------------------------
89 TEST(DRCERequestLocalShellTest, testCommandSort)
90 {
92 }
93 //-----------------------------------------------------------------------------
94 TEST(DRCERequestLocalShellTest, testBadCommandLs)
95 {
97 }
98 //-----------------------------------------------------------------------------
99 TEST(DRCERequestLocalShellTest, testCommandLs)
100 {
102 }
103 //-----------------------------------------------------------------------------
104 TEST(DRCERequestLocalShellTest, testCommandPs)
105 {
107 }
108 //-----------------------------------------------------------------------------
109 TEST(DRCERequestLocalShellTest, testCommandPhp)
110 {
112 }
113 //-----------------------------------------------------------------------------
114 TEST(DRCERequestLocalShellTest, testCommandPerl)
115 {
117 }
118 //-----------------------------------------------------------------------------
119 TEST(DRCERequestLocalShellTest, testCommandJava)
120 {
122 }
123 //-----------------------------------------------------------------------------
124 //-----------------------------------------------------------------------------
125 TEST(DRCEFunctionalObjectTest, testApplyEnviroments)
126 {
128 }
129 //-----------------------------------------------------------------------------
130 TEST(DRCEFunctionalObjectTest, testRequestLocalShellSortInput)
131 {
133 }
134 //-----------------------------------------------------------------------------
135 TEST(DRCEFunctionalObjectTest, testRequestLocalShellSortOutput)
136 {
138 }
139 //-----------------------------------------------------------------------------
140 TEST(DRCEFunctionalObjectTest, testRequestLocalShellSort)
141 {
143 }
144 //-----------------------------------------------------------------------------
145 TEST(DRCEFunctionalObjectTest, testRequestLocalShellPsInput)
146 {
148 }
149 //-----------------------------------------------------------------------------
150 TEST(DRCEFunctionalObjectTest, testRequestLocalShellPsOutput)
151 {
153 }
154 //-----------------------------------------------------------------------------
155 TEST(DRCEFunctionalObjectTest, testRequestLocalShellPs)
156 {
158 }
159 //-----------------------------------------------------------------------------
160 TEST(DRCEFunctionalObjectTest, testRequestLocalShellPhpVersion)
161 {
163 }
164 //-----------------------------------------------------------------------------
165 TEST(DRCEFunctionalObjectTest, testRequestLocalShellPhpScript)
166 {
168 }
169 //-----------------------------------------------------------------------------
170 TEST(DRCEFunctionalObjectTest, testRequestLocalShellPerlVersion)
171 {
173 }
174 //-----------------------------------------------------------------------------
175 TEST(DRCEFunctionalObjectTest, testRequestLocalShellPerlScript)
176 {
178 }
179 //-----------------------------------------------------------------------------
180 //-----------------------------------------------------------------------------
181 TEST(DRCETaskRequestsTest, testSerializeUnserializeSetTaskToExecuteRequest)
182 {
184 }
185 //-----------------------------------------------------------------------------
186 TEST(DRCETaskRequestsTest, testSerializeUnserializeCheckTaskRequest)
187 {
189 }
190 //-----------------------------------------------------------------------------
191 TEST(DRCETaskRequestsTest, testSerializeUnserializeGetTaskDataRequest)
192 {
194 }
195 //-----------------------------------------------------------------------------
196 TEST(DRCETaskRequestsTest, testSerializeUnserializeTerminateTaskRequest)
197 {
199 }
200 //-----------------------------------------------------------------------------
201 //-----------------------------------------------------------------------------
202 Poco::SharedPtr<HCE::drce::DRCEFunctionalObject> pFunctionalObject = nullptr;
203 Poco::SharedPtr<HCE::drce::DRCENodeOptions> pNodeOptions = nullptr;
204 static unsigned int requestId = 0;
205 
206 class LocalShellAsyncRequestTest : public ::testing::Test
207 {
208 protected:
209  static void SetUpTestCase(void)
210  {
212  pFunctionalObject = Poco::SharedPtr<HCE::drce::DRCEFunctionalObject>(new HCE::drce::DRCEFunctionalObject(
213  pNodeOptions->getNodeName(),
214  pNodeOptions->getHomeDir(),
215  pNodeOptions->getTasksDataDir(),
216  pNodeOptions->getTasksStatusDir(),
217  pNodeOptions->getNodeHost(),
218  pNodeOptions->getNodePort()));
219  requestId = 500;
220  }
221  static void TearDownTestCase(void)
222  {
223  pFunctionalObject = nullptr;
224  pNodeOptions = nullptr;
225  }
226  void SetUp(void)
227  {
228  ++requestId;
229  }
230  void TearDown(void)
231  {
233  }
234 };
235 //-----------------------------------------------------------------------------
236 TEST_F(LocalShellAsyncRequestTest, testTaskRequestTimeLimitsSyncWithTimeMax)
237 {
238  HCE::drce::tests::DRCETaskThreadingModeTest::testTaskRequestTimeLimits(*pFunctionalObject, requestId, HCE::drce::SessionOptions::ThreadMode::tmSync, 40000);
239 }
240 //-----------------------------------------------------------------------------
241 TEST_F(LocalShellAsyncRequestTest, testTaskRequestTimeLimitsAsyncWithTimeMax)
242 {
243  HCE::drce::tests::DRCETaskThreadingModeTest::testTaskRequestTimeLimits(*pFunctionalObject, requestId, HCE::drce::SessionOptions::ThreadMode::tmAsync, 40000);
244 }
245 //-----------------------------------------------------------------------------
246 TEST_F(LocalShellAsyncRequestTest, testTaskRequestTimeLimitsSyncWithoutTimeMax)
247 {
249 }
250 //-----------------------------------------------------------------------------
251 TEST_F(LocalShellAsyncRequestTest, testTaskRequestTimeLimitsAsyncWithoutTimeMax)
252 {
253  HCE::drce::tests::DRCETaskThreadingModeTest::testTaskRequestTimeLimits(*pFunctionalObject, requestId, HCE::drce::SessionOptions::ThreadMode::tmAsync, 0);
254 }
255 //-----------------------------------------------------------------------------
256 TEST_F(LocalShellAsyncRequestTest, testTaskRequestExpiredTimeSync)
257 {
259  requestId, HCE::drce::SessionOptions::ThreadMode::tmSync, HCE::drce::SessionOptions::CleanupFlag::cfNotDelete);
260 }
261 //-----------------------------------------------------------------------------
262 TEST_F(LocalShellAsyncRequestTest, testTaskRequestExpiredTimeAsync)
263 {
265  requestId, HCE::drce::SessionOptions::ThreadMode::tmAsync, HCE::drce::SessionOptions::CleanupFlag::cfNotDelete);
266 }
267 //-----------------------------------------------------------------------------
268 TEST_F(LocalShellAsyncRequestTest, testTaskRequestExpiredTimeSyncWithCleanup)
269 {
271  requestId, HCE::drce::SessionOptions::ThreadMode::tmSync, HCE::drce::SessionOptions::CleanupFlag::cfDelete);
272 }
273 //-----------------------------------------------------------------------------
274 TEST_F(LocalShellAsyncRequestTest, testTaskRequestExpiredTimeAsyncWithCleanup)
275 {
277  requestId, HCE::drce::SessionOptions::ThreadMode::tmAsync, HCE::drce::SessionOptions::CleanupFlag::cfDelete);
278 }
279 //-----------------------------------------------------------------------------
280 //-----------------------------------------------------------------------------
281 TEST_F(LocalShellAsyncRequestTest, testExecuteSyncRequest)
282 {
284 }
285 //-----------------------------------------------------------------------------
286 TEST_F(LocalShellAsyncRequestTest, testSetTaskToExecuteRequest)
287 {
290  while (pFunctionalObject->getAsyncTasksCount())
291  {
292  Poco::Thread::sleep(10000);
293  std::cout << "wait ..." << std::endl;
294  }
295  Poco::Thread::sleep(10000);
297 }
298 //-----------------------------------------------------------------------------
299 TEST_F(LocalShellAsyncRequestTest, testGetTaskDataRequest)
300 {
302 }
303 //-----------------------------------------------------------------------------
304 TEST_F(LocalShellAsyncRequestTest, testCheckTaskRequest)
305 {
307 }
308 //-----------------------------------------------------------------------------
309 TEST_F(LocalShellAsyncRequestTest, testExecuteNotification)
310 {
312 }
313 //-----------------------------------------------------------------------------
314 TEST_F(LocalShellAsyncRequestTest, testTerminateTaskRequestUseDefaultAlgorithm)
315 {
316  HCE::drce::tests::DRCETaskThreadingModeTest::testTerminateTaskRequest(*pFunctionalObject, requestId, HCE::drce::DRCETaskRequestTerminate::AlgorithmType::atDefault);
317 }
318 //-----------------------------------------------------------------------------
319 TEST_F(LocalShellAsyncRequestTest, testTerminateTaskRequestUseCustomAlgorithm)
320 {
321  HCE::drce::tests::DRCETaskThreadingModeTest::testTerminateTaskRequest(*pFunctionalObject, requestId, HCE::drce::DRCETaskRequestTerminate::AlgorithmType::atCustom);
322 }
323 //-----------------------------------------------------------------------------
324 TEST_F(LocalShellAsyncRequestTest, testDeleteTaskDataRequest)
325 {
327 }
328 //-----------------------------------------------------------------------------
329 TEST_F(LocalShellAsyncRequestTest, testTerminateExpiredTaskSync)
330 {
332 }
333 //-----------------------------------------------------------------------------
334 TEST_F(LocalShellAsyncRequestTest, testTerminateExpiredTaskAsync)
335 {
337 }
338 //-----------------------------------------------------------------------------
339 TEST_F(LocalShellAsyncRequestTest, testParallelAsyncExecution)
340 {
342 }
343 //-----------------------------------------------------------------------------
344 /*
345 TEST_F(LocalShellAsyncRequestTest, testMaxThreadLimits)
346 {
347  HCE::drce::tests::DRCETaskThreadingModeTest::testMaxThreadLimits(*pFunctionalObject, requestId, 5, 5);
348 }
349 */
350 //-----------------------------------------------------------------------------
351 //-----------------------------------------------------------------------------
352 TEST_F(LocalShellAsyncRequestTest, testMultipleRequests)
353 {
354  HCE::drce::tests::DRCEStressTest::testMultipleRequests(*pFunctionalObject, HCE::drce::SessionOptions::SessionType::stHostShell, 10);
355 }
356 //-----------------------------------------------------------------------------
357 TEST_F(LocalShellAsyncRequestTest, testRequestsTimeDelay)
358 {
359  HCE::drce::tests::DRCEStressTest::testRequestsTimeDelay(*pFunctionalObject, HCE::drce::SessionOptions::SessionType::stHostShell, 10, 10);
360 }
361 //-----------------------------------------------------------------------------
362 TEST_F(LocalShellAsyncRequestTest, testResourceLimitsAsync)
363 {
365  HCE::drce::SessionOptions::SessionType::stHostShell,
366  HCE::drce::SessionOptions::ThreadMode::tmAsync);
367 }
368 //-----------------------------------------------------------------------------
369 TEST_F(LocalShellAsyncRequestTest, testResourceLimitsSync)
370 {
372  HCE::drce::SessionOptions::SessionType::stHostShell,
373  HCE::drce::SessionOptions::ThreadMode::tmSync);
374 }
375 //-----------------------------------------------------------------------------
376 TEST_F(LocalShellAsyncRequestTest, testResourceUsageLimitsAsync)
377 {
379  HCE::drce::SessionOptions::SessionType::stHostShell,
380  HCE::drce::SessionOptions::ThreadMode::tmAsync);
381 }
382 //-----------------------------------------------------------------------------
383 TEST_F(LocalShellAsyncRequestTest, testResourceUsageLimitsSync)
384 {
386  HCE::drce::SessionOptions::SessionType::stHostShell,
387  HCE::drce::SessionOptions::ThreadMode::tmSync);
388 }
389 //-----------------------------------------------------------------------------
390 //-----------------------------------------------------------------------------
391 TEST(TaskRequestTest, testTerminateTaskRequestCleanUp)
392 {
394 }
395 //-----------------------------------------------------------------------------
396 TEST(TaskRequestTest, testRequestLocalShellAsyncCleanUp)
397 {
399 }
400 //-----------------------------------------------------------------------------
401 TEST(TaskRequestTest, testCurrentTasksQueue)
402 {
404 }
405 //-----------------------------------------------------------------------------
406 TEST(TaskRequestTest, testListAllTasks)
407 {
409 }
410 //-----------------------------------------------------------------------------
411 //-----------------------------------------------------------------------------
412 TEST(DRCECleanupTest, testAsyncTaskAsyncSubtasks)
413 {
415 }
416 //-----------------------------------------------------------------------------
417 TEST(DRCECleanupTest, testAsyncTaskSyncSubtasks)
418 {
420 }
421 //-----------------------------------------------------------------------------
422 TEST(DRCECleanupTest, testSyncTaskAsyncSubtasks)
423 {
425 }
426 //-----------------------------------------------------------------------------
427 TEST(DRCECleanupTest, testSyncTaskSyncSubtasks)
428 {
430 }
431 //-----------------------------------------------------------------------------
432 TEST(DRCECleanupTest, testAsyncTaskMixSubtasks)
433 {
435 }
436 //-----------------------------------------------------------------------------
437 TEST(DRCECleanupTest, testSyncTaskMixSubtasks)
438 {
440 }
441 //-----------------------------------------------------------------------------
442 TEST(DRCECleanupTest, testAsyncTaskMixSubtasksCleanup)
443 {
445 }
446 //-----------------------------------------------------------------------------
447 TEST(DRCECleanupTest, testSyncTaskMixSubtasksCleanup)
448 {
450 }
451 //-----------------------------------------------------------------------------
452 TEST(DRCECleanupTest, testRequestGetDataCleanup)
453 {
455 }
456 //-----------------------------------------------------------------------------
457 TEST(DRCECleanupTest, testRequestDeleteDataCleanup)
458 {
460 }
461 //-----------------------------------------------------------------------------
462 TEST(DRCECleanupTest, testRequestTerminateCleanup)
463 {
465 }
466 //-----------------------------------------------------------------------------
467 TEST(DRCECleanupTest, testRequestDeleteData)
468 {
470 }
471 //-----------------------------------------------------------------------------
472 //-----------------------------------------------------------------------------