diff options
Diffstat (limited to 'tests/resourceconfigtest.cpp')
-rw-r--r-- | tests/resourceconfigtest.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/resourceconfigtest.cpp b/tests/resourceconfigtest.cpp index bebff50..021d042 100644 --- a/tests/resourceconfigtest.cpp +++ b/tests/resourceconfigtest.cpp | |||
@@ -8,6 +8,8 @@ | |||
8 | #include "modelresult.h" | 8 | #include "modelresult.h" |
9 | #include "resultprovider.h" | 9 | #include "resultprovider.h" |
10 | #include "facadefactory.h" | 10 | #include "facadefactory.h" |
11 | #include "test.h" | ||
12 | #include "testutils.h" | ||
11 | 13 | ||
12 | /** | 14 | /** |
13 | * Test of the resource configuration. | 15 | * Test of the resource configuration. |
@@ -19,9 +21,9 @@ private slots: | |||
19 | 21 | ||
20 | void initTestCase() | 22 | void initTestCase() |
21 | { | 23 | { |
24 | Sink::Test::initTest(); | ||
22 | Sink::FacadeFactory::instance().resetFactory(); | 25 | Sink::FacadeFactory::instance().resetFactory(); |
23 | ResourceConfig::clear(); | 26 | ResourceConfig::clear(); |
24 | Sink::Log::setDebugOutputLevel(Sink::Log::Trace); | ||
25 | } | 27 | } |
26 | 28 | ||
27 | void resourceManagement() | 29 | void resourceManagement() |
@@ -72,6 +74,30 @@ private slots: | |||
72 | Sink::Store::remove(res).exec().waitForFinished(); | 74 | Sink::Store::remove(res).exec().waitForFinished(); |
73 | } | 75 | } |
74 | 76 | ||
77 | void testLoadResourceStatus() | ||
78 | { | ||
79 | ResourceConfig::clear(); | ||
80 | Sink::FacadeFactory::instance().registerStaticFacades(); | ||
81 | |||
82 | auto res = Sink::ApplicationDomain::DummyResource::create(""); | ||
83 | VERIFYEXEC(Sink::Store::create(res)); | ||
84 | { | ||
85 | Sink::Query query; | ||
86 | query.liveQuery = true; | ||
87 | query.request<Sink::ApplicationDomain::SinkResource::Status>(); | ||
88 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::SinkResource>(query); | ||
89 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); | ||
90 | auto resource = model->data(model->index(0, 0, QModelIndex()), Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::SinkResource::Ptr>(); | ||
91 | QCOMPARE(resource->getStatus(), static_cast<int>(Sink::ApplicationDomain::OfflineStatus)); | ||
92 | |||
93 | //Synchronize to connect | ||
94 | VERIFYEXEC(Sink::Store::synchronize(query)); | ||
95 | QTRY_COMPARE(model->data(model->index(0, 0, QModelIndex()), Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::SinkResource::Ptr>()->getStatus(), static_cast<int>(Sink::ApplicationDomain::ConnectedStatus)); | ||
96 | } | ||
97 | |||
98 | VERIFYEXEC(Sink::Store::remove(res)); | ||
99 | } | ||
100 | |||
75 | }; | 101 | }; |
76 | 102 | ||
77 | QTEST_MAIN(ResourceConfigTest) | 103 | QTEST_MAIN(ResourceConfigTest) |