hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
main.cpp
Go to the documentation of this file.
1 #include <gtest/gtest.h>
2 
3 #include "DRCEProtocolsTest.hpp"
9 #include "DRCECleanupTest.hpp"
10 #include "DRCEMessageConst.hpp"
11 
12 #include <Poco/Channel.h>
13 #include <Poco/ConsoleChannel.h>
14 #include <Poco/FileChannel.h>
15 #include <Poco/FormattingChannel.h>
16 #include <Poco/PatternFormatter.h>
17 #include <Poco/Logger.h>
18 #include <Poco/AutoPtr.h>
19 
20 
21 #define TEST_DEBUG 0
22 
23 namespace HCE
24 {
25 namespace drce
26 {
27 namespace tests
28 {
29 //-----------------------------------------------------------------------------
30 void loggerInitialization(const std::string& loggerName, Poco::AutoPtr<Poco::Channel> pCustomerChannel, const std::string& level)
31 {
32  Poco::AutoPtr<Poco::PatternFormatter> pPatternFormatter(new Poco::PatternFormatter("%Y-%m-%d %H:%M:%S.%i - %N[%P] - %s - %q - %t"));
33  if (pPatternFormatter)
34  {
35  Poco::AutoPtr<Poco::FormattingChannel> pChannel = new Poco::FormattingChannel(pPatternFormatter);
36  if (pChannel)
37  {
38  Poco::AutoPtr<Poco::Channel> pCustomer(pCustomerChannel);
39  pChannel->setChannel(pCustomer);
40  pChannel->open();
41  Poco::Logger::get(loggerName).setChannel(pChannel);
42  Poco::Logger::get(loggerName).setLevel(level);
43  }
44  }
45 }
46 //-----------------------------------------------------------------------------
47 } // end namespace tests
48 } // end namespace drce
49 } // end namespace HCE
50 
51 #if TEST_DEBUG == 1
52 
53 int main(int argc, char** argv)
54 {
55  // loggers intialization
56  HCE::drce::tests::loggerInitialization(Poco::Logger::ROOT, new Poco::ConsoleChannel(), "trace");
57 
58  Poco::AutoPtr<Poco::FileChannel> pFileChannel = new Poco::FileChannel();
59  pFileChannel->setProperty("path", "./tasks.log");
61 /*
62  HCE::drce::tests::DRCEProtocolsTest::testResultDataSerializator();
63  HCE::drce::tests::DRCEProtocolsTest::testInputJsonMessage();
64  HCE::drce::tests::DRCEProtocolsTest::testOutputJsonMessage();
65 
66  HCE::drce::tests::DRCEProtocolsTest::testSessionOptions();
67  HCE::drce::tests::DRCEProtocolsTest::testFilesItemList();
68 
69  HCE::drce::tests::DRCEActionTypesTest::testCreateBeforeExec();
70  HCE::drce::tests::DRCEActionTypesTest::testDeleteBeforeExec();
71  HCE::drce::tests::DRCEActionTypesTest::testReadAfterExec();
72  HCE::drce::tests::DRCEActionTypesTest::testDeleteAfterExec();
73  HCE::drce::tests::DRCEActionTypesTest::testEncodeDecodeContent();
74 
75  HCE::drce::tests::DRCERequestLocalShellTest::testEmptyCommand();
76  HCE::drce::tests::DRCERequestLocalShellTest::testInputStreamWithCommand();
77 
78  HCE::drce::tests::DRCERequestLocalShellTest::testInputStreamWithoutCommand();
79  HCE::drce::tests::DRCERequestLocalShellTest::testCommandSort();
80  HCE::drce::tests::DRCERequestLocalShellTest::testCommandLs();
81  HCE::drce::tests::DRCERequestLocalShellTest::testBadCommandLs();
82 
83  HCE::drce::tests::DRCERequestLocalShellTest::testCommandPs();
84  HCE::drce::tests::DRCERequestLocalShellTest::testCommandPhp();
85  HCE::drce::tests::DRCERequestLocalShellTest::testCommandPerl();
86  HCE::drce::tests::DRCERequestLocalShellTest::testCommandJava();
87 
88  HCE::drce::tests::DRCEFunctionalObjectTest::testApplyEnviroments();
89  HCE::drce::tests::DRCEFunctionalObjectTest::testRequestLocalShellSortInput();
90  HCE::drce::tests::DRCEFunctionalObjectTest::testRequestLocalShellSortOutput();
91  HCE::drce::tests::DRCEFunctionalObjectTest::testRequestLocalShellSort();
92 
93  HCE::drce::tests::DRCEFunctionalObjectTest::testRequestLocalShellPsInput();
94  HCE::drce::tests::DRCEFunctionalObjectTest::testRequestLocalShellPsOutput();
95 
96  HCE::drce::tests::DRCEFunctionalObjectTest::testRequestLocalShellPs();
97  HCE::drce::tests::DRCEFunctionalObjectTest::testRequestLocalShellPhpVersion();
98  HCE::drce::tests::DRCEFunctionalObjectTest::testRequestLocalShellPhpScript();
99  HCE::drce::tests::DRCEFunctionalObjectTest::testRequestLocalShellPerlVersion();
100  HCE::drce::tests::DRCEFunctionalObjectTest::testRequestLocalShellPerlScript();
101 
102  HCE::drce::tests::DRCETaskRequestsTest::testSerializeUnserializeSetTaskToExecuteRequest();
103  HCE::drce::tests::DRCETaskRequestsTest::testSerializeUnserializeCheckTaskRequest();
104  HCE::drce::tests::DRCETaskRequestsTest::testSerializeUnserializeGetTaskDataRequest();
105  HCE::drce::tests::DRCETaskRequestsTest::testSerializeUnserializeTerminateTaskRequest();
106 
107  HCE::drce::tests::DRCETaskThreadingModeTest::testTerminateTaskRequestCleanUp();
108  HCE::drce::tests::DRCETaskThreadingModeTest::testRequestLocalShellAsyncCleanUp();
109 */
110 // HCE::drce::tests::DRCETaskThreadingModeTest::testRequestLocalShellAsync();
111 // HCE::drce::tests::DRCETaskThreadingModeTest::testStressMultipleRequestsShellHost();
112 /*
113  HCE::drce::tests::DRCETaskThreadingModeTest::testResourceMonitor(); // resource monitor to stdout
114  HCE::drce::tests::DRCETaskThreadingModeTest::testCurrentTasksQueue();
115  HCE::drce::tests::DRCETaskThreadingModeTest::testListAllTasks();
116 
117  HCE::drce::tests::DRCECleanupTest::testAsyncTaskAsyncSubtasks();
118  HCE::drce::tests::DRCECleanupTest::testAsyncTaskSyncSubtasks();
119  HCE::drce::tests::DRCECleanupTest::testSyncTaskAsyncSubtasks();
120  HCE::drce::tests::DRCECleanupTest::testSyncTaskSyncSubtasks();
121  HCE::drce::tests::DRCECleanupTest::testAsyncTaskMixSubtasks();
122  HCE::drce::tests::DRCECleanupTest::testSyncTaskMixSubtasks();
123  HCE::drce::tests::DRCECleanupTest::testAsyncTaskMixSubtasksCleanup();
124  HCE::drce::tests::DRCECleanupTest::testSyncTaskMixSubtasksCleanup();
125  HCE::drce::tests::DRCECleanupTest::testRequestGetDataCleanup();
126  HCE::drce::tests::DRCECleanupTest::testRequestDeleteDataCleanup();
127  HCE::drce::tests::DRCECleanupTest::testRequestTerminateCleanup();
128  HCE::drce::tests::DRCECleanupTest::testRequestDeleteData();
129 */
130 
131  Poco::Logger::root().information("Done");
132  Poco::Logger::shutdown();
133  return 0;
134 }
135 #else
136  // svn://192.168.1.201/hce/hce_dts/trunk/api/php/bin/drce_fetch_resources.sh
137 
138 int main (int argc, char** argv)
139 {
140  // loggers intialization
141  HCE::drce::tests::loggerInitialization(Poco::Logger::ROOT, new Poco::ConsoleChannel(), "trace");
142  Poco::AutoPtr<Poco::FileChannel> pFileChannel = new Poco::FileChannel();
143  pFileChannel->setProperty("path", "./tasks.log");
145 
146  testing::InitGoogleTest(&argc, argv);
147  return RUN_ALL_TESTS();
148 }
149 
150 #endif // end TEST_DEBUG