Torc  0.1
torchttpservicetest.cpp
Go to the documentation of this file.
1 /* Class TorcHTTPServiceTest
2 *
3 * This file is part of the Torc project.
4 *
5 * Copyright (C) Mark Kendall 2012-18
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 * USA.
21 */
22 
23 // Torc
24 #include "torcadminthread.h"
25 #include "torchttpservicetest.h"
26 
35  : QObject(),
36  TorcHTTPService(this, "test", "test", TorcHTTPServiceTest::staticMetaObject)
37 {
38 }
39 
41 {
42  return tr("Test");
43 }
44 
45 void TorcHTTPServiceTest::SubscriberDeleted(QObject *Subscriber)
46 {
48 }
49 
52 {
53 }
54 
57 {
58  return Value;
59 }
60 
63 {
64  return Value;
65 }
66 
69 {
70  return Value;
71 }
72 
74 unsigned long long TorcHTTPServiceTest::EchoUnsignedLongLong(unsigned long long Value)
75 {
76  return Value;
77 }
78 
80 QStringList TorcHTTPServiceTest::EchoStringList(const QString &Value1, const QString &Value2, const QString &Value3)
81 {
82  QStringList result;
83  result << Value1 << Value2 << Value3;
84  return result;
85 }
86 
89 {
90  QVariantMap level1;
91  QVariantMap level2;
92  QStringList level3;
93 
94  level3 << "A" << "B" << "C";
95  level2.insert("LevelThree", level3);
96 
97  level1.insert("One float", 1.1234);
98  level1.insert("Two text", "Two");
99  level1.insert("Three int", 3);
100  level1.insert("LevelTwo", level2);
101 
102  return level1;
103 }
104 
107 {
108  return QDateTime::currentDateTime();
109 }
110 
113 {
114  return QDateTime::currentDateTimeUtc();
115 }
116 
119 {
120  QVariantHash result;
121  result.insert("foo", "bar");
122  return result;
123 }
124 
127 {
128  return nullptr;
129 }
130 
132 void TorcHTTPServiceTest::GetUnsupportedParameter(QStringList Unsupported)
133 {
134  (void)Unsupported;
135 }
136 
141 {
142  public:
145  m_test(nullptr)
146  {
147  }
148 
149  void Create(void)
150  {
151  m_test = new TorcHTTPServiceTest();
152  }
153 
154  void Destroy(void)
155  {
156  delete m_test;
157  }
158 
159  private:
160  TorcHTTPServiceTest *m_test;
161 
163 
164 
void GetUnsupportedParameter(QStringList Unsupported)
This function should be rejected at startup.
QDateTime GetTimeNow(void)
Returns the current time.
A factory class for automatically running objects outside of the main loop.
QVariantHash GetUnsupportedHash(void)
This function should be rejected at startup.
void GetVoid(void)
Returns a void.
TorcServiceTestObject TorcServiceTestObject
void SubscriberDeleted(QObject *Subscriber)
QStringList EchoStringList(const QString &Value1, const QString &Value2, const QString &Value3)
Returns the given strings as a list or array.
QVariantMap GetVariantMap(void)
Returns a complex, nested data type.
#define TORC_ADMIN_LOW_PRIORITY
QDateTime GetTimeNowUtc(void)
Returns the current time in Utc.
unsigned long long EchoUnsignedLongLong(unsigned long long Value)
Returns the given large unsigned integer.
void * GetUnsupportedPointer(void)
This function should be rejected at startup.
void HandleSubscriberDeleted(QObject *Subscriber)
float EchoFloat(float Value)
Returns the given float.
bool EchoBool(bool Value)
Returns the given Boolean value.
int EchoInt(int Value)
Returns the given Integer.
Creates a TorcHTTPServiceTest singleton.
Implements an HTTP service for testing purposes.