summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-03-17 09:54:55 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-03-17 09:54:55 +0100
commit461dd811bf99a0859759b39f40ea6609c0063586 (patch)
tree1eb6e0481080d95438d0728c5fae9b199283de57
parenteaf29d5080d0b1263df26e09bb3e81034bcac988 (diff)
downloadsink-461dd811bf99a0859759b39f40ea6609c0063586.tar.gz
sink-461dd811bf99a0859759b39f40ea6609c0063586.zip
Try to start and connect to a resource.
-rw-r--r--sinksh/syntax_modules/sink_selftest.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/sinksh/syntax_modules/sink_selftest.cpp b/sinksh/syntax_modules/sink_selftest.cpp
index 0609720..a1c7dcb 100644
--- a/sinksh/syntax_modules/sink_selftest.cpp
+++ b/sinksh/syntax_modules/sink_selftest.cpp
@@ -31,6 +31,8 @@
31#include "common/definitions.h" 31#include "common/definitions.h"
32#include "common/store.h" 32#include "common/store.h"
33#include "common/propertyparser.h" 33#include "common/propertyparser.h"
34#include "common/resourceaccess.h"
35#include "common/commands.h"
34 36
35#include "sinksh_utils.h" 37#include "sinksh_utils.h"
36#include "state.h" 38#include "state.h"
@@ -134,9 +136,19 @@ bool selfTest(const QStringList &args_, State &state)
134 136
135 state.printLine("Looking for resource plugins:"); 137 state.printLine("Looking for resource plugins:");
136 if (!Sink::ResourceFactory::load("sink.imap")) { 138 if (!Sink::ResourceFactory::load("sink.imap")) {
137 state.printLine("Error: Failed to load the imap resource", 1); 139 state.printLine("Failure: Failed to load the imap resource", 1);
138 } else { 140 } else {
139 state.printLine("Success: Managed to load the imap resource", 1); 141 state.printLine("Success: Managed to load the imap resource", 1);
142 state.printLine("Trying to start and connect to a resource.", 1);
143 auto resourceAccess = Sink::ResourceAccessFactory::instance().getAccess("imap.selftest.resource", "sink.imap");
144 resourceAccess->open();
145 resourceAccess->sendCommand(Sink::Commands::PingCommand).addToContext(resourceAccess).then([&](const KAsync::Error &error) {
146 if (error) {
147 state.printLine("Failure: Failed to start/connect to the resource.", 1);
148 } else {
149 state.printLine("Success: Managed to start and connect to the resource.", 1);
150 }
151 }).exec().waitForFinished();
140 } 152 }
141 153
142 return false; 154 return false;
@@ -144,7 +156,7 @@ bool selfTest(const QStringList &args_, State &state)
144 156
145Syntax::List syntax() 157Syntax::List syntax()
146{ 158{
147 Syntax syntax("selftest", QObject::tr("Selftext."), &SinkSelfTest::selfTest, Syntax::EventDriven); 159 Syntax syntax("selftest", QObject::tr("A selftest module."), &SinkSelfTest::selfTest, Syntax::EventDriven);
148 return Syntax::List() << syntax; 160 return Syntax::List() << syntax;
149} 161}
150 162