diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-10-17 13:54:29 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-10-17 13:54:29 +0200 |
commit | 833aabc562c51fa962f9f2da14f7cd4552dab22b (patch) | |
tree | 77e03e19385acccc04954ff42ce76655df027b5f /tests/dummyresourcetest.cpp | |
parent | dcfc70808ab9680a8caed6ff0fb98f978fbbef97 (diff) | |
download | sink-833aabc562c51fa962f9f2da14f7cd4552dab22b.tar.gz sink-833aabc562c51fa962f9f2da14f7cd4552dab22b.zip |
dummyresourcebenchmark values
Diffstat (limited to 'tests/dummyresourcetest.cpp')
-rw-r--r-- | tests/dummyresourcetest.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index 17df160..28e8337 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -14,6 +14,7 @@ | |||
14 | #include "test.h" | 14 | #include "test.h" |
15 | #include "testutils.h" | 15 | #include "testutils.h" |
16 | #include "adaptorfactoryregistry.h" | 16 | #include "adaptorfactoryregistry.h" |
17 | #include "notifier.h" | ||
17 | 18 | ||
18 | using namespace Sink; | 19 | using namespace Sink; |
19 | using namespace Sink::ApplicationDomain; | 20 | using namespace Sink::ApplicationDomain; |
@@ -275,6 +276,37 @@ private slots: | |||
275 | QTRY_COMPARE(model->rowCount(QModelIndex()), 0); | 276 | QTRY_COMPARE(model->rowCount(QModelIndex()), 0); |
276 | } | 277 | } |
277 | } | 278 | } |
279 | |||
280 | void testCommandResponsiveness() | ||
281 | { | ||
282 | // Test responsiveness including starting the process. | ||
283 | VERIFYEXEC(Sink::Store::removeDataFromDisk("sink.dummy.instance1")); | ||
284 | |||
285 | QTime time; | ||
286 | time.start(); | ||
287 | |||
288 | Sink::ApplicationDomain::Event event("sink.dummy.instance1"); | ||
289 | event.setProperty("uid", "testuid"); | ||
290 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | ||
291 | event.setProperty("summary", "summaryValue"); | ||
292 | |||
293 | auto notifier = QSharedPointer<Sink::Notifier>::create("sink.dummy.instance1", "sink.dummy"); | ||
294 | bool gotNotification = false; | ||
295 | int duration = 0; | ||
296 | notifier->registerHandler([&gotNotification, &duration, &time](const Sink::Notification ¬ification) { | ||
297 | if (notification.type == Sink::Notification::RevisionUpdate) { | ||
298 | gotNotification = true; | ||
299 | duration = time.elapsed(); | ||
300 | } | ||
301 | }); | ||
302 | |||
303 | Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec(); | ||
304 | // Wait for notification | ||
305 | QUICK_TRY_VERIFY(gotNotification); | ||
306 | |||
307 | QVERIFY2(duration < 100, QString::fromLatin1("Processing a create command took more than 100ms: %1").arg(duration).toLatin1()); | ||
308 | VERIFYEXEC(Sink::ResourceControl::shutdown("sink.dummy.instance1")); | ||
309 | } | ||
278 | }; | 310 | }; |
279 | 311 | ||
280 | QTEST_MAIN(DummyResourceTest) | 312 | QTEST_MAIN(DummyResourceTest) |