10 #include <QElapsedTimer>
27 using namespace swift::misc::network;
29 namespace swiftcoretest
41 void checkSetupReader();
50 void CTestConnectivity::initTestCase() { QVERIFY2(
sApp,
"sApp not available"); }
52 void CTestConnectivity::checkSetupReader()
57 void CTestConnectivity::connectServer()
63 constexpr
int max = 5;
64 for (
int i = 0; i < max; i++)
66 bool ok = CNetworkUtils::canConnect(url, CNetworkUtils::getLongTimeoutMs());
69 int elapsedMs = timer.
elapsed();
70 qDebug() <<
"Completed" << max <<
"connection tests in" << elapsedMs <<
"ms to" << url.
getFullUrl();
74 void CTestConnectivity::pingServer()
81 constexpr
int max = 5;
82 for (
int i = 0; i < max; i++)
84 bool ok = canPing(host);
87 int elapsedMs = timer.
elapsed();
88 qDebug() <<
"Completed" << max <<
"ping tests in" << elapsedMs <<
"ms to" << url.
getFullUrl();
94 int main(
int argc,
char *argv[])
101 if (!setup) { qWarning() <<
"No setup loaded"; }
102 int r = EXIT_FAILURE;
108 #include "testconnectivity.moc"
SWIFT_CORE_EXPORT swift::core::CApplication * sApp
Single instance of application object.
void addNetworkOptions()
Add the network options.
bool hasSetupReader() const
Setup reader?
data::CGlobalSetup getGlobalSetup() const
Global setup.
bool parseCommandLineArgsAndLoadSetup()
Combined function that does a startup check, parses the command line arguments and loads the setup.
virtual bool start()
Start services, if not yet parsed call CApplication::parse.
virtual void gracefulShutdown()
Graceful shutdown.
swift::misc::network::CUrl getDbHomePageUrl() const
Home page url.
Value object encapsulating information of a location, kind of simplified CValueObject compliant versi...
const QString & getHost() const
Get host.
QString getFullUrl(bool withQuery=true) const
Qualified name.
Test connectivity such as canConnect ping and swift::core::db::CNetworkWatchdog.
Classes interacting with the swift database (aka "datastore").
Backend services of the swift project, like dealing with the network or the simulators.
Free functions in swift::misc.
qint64 elapsed() const const
QVERIFY2(condition, message)
int qExec(QObject *testObject, const QStringList &arguments)
#define SWIFTTEST_INIT(TestObject)
Implements a main() function that executes all tests in TestObject without instantiating a QApplicati...
int main(int argc, char *argv[])
main