diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-08 10:32:01 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-05-08 10:32:01 +0200 |
commit | fdeb92ca128e6eb51bbcace0b47519b12a08ce93 (patch) | |
tree | f0b4162ca74d5ee1fe6209069c910e41c92de570 /tests/pipelinetest.cpp | |
parent | 2df41a3a919f1a131d311112e6fc444eff12c229 (diff) | |
download | sink-fdeb92ca128e6eb51bbcace0b47519b12a08ce93.tar.gz sink-fdeb92ca128e6eb51bbcace0b47519b12a08ce93.zip |
Run preprocessors before persising the value.
And allow preprocessors to modify the result.
Diffstat (limited to 'tests/pipelinetest.cpp')
-rw-r--r-- | tests/pipelinetest.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/pipelinetest.cpp b/tests/pipelinetest.cpp index cdd260d..9290050 100644 --- a/tests/pipelinetest.cpp +++ b/tests/pipelinetest.cpp | |||
@@ -146,13 +146,13 @@ QByteArray deleteEntityCommand(const QByteArray &uid, qint64 revision) | |||
146 | class TestProcessor : public Sink::Preprocessor | 146 | class TestProcessor : public Sink::Preprocessor |
147 | { | 147 | { |
148 | public: | 148 | public: |
149 | void newEntity(const QByteArray &uid, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &newEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE | 149 | void newEntity(const QByteArray &uid, qint64 revision, Sink::ApplicationDomain::BufferAdaptor &newEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE |
150 | { | 150 | { |
151 | newUids << uid; | 151 | newUids << uid; |
152 | newRevisions << revision; | 152 | newRevisions << revision; |
153 | } | 153 | } |
154 | 154 | ||
155 | void modifiedEntity(const QByteArray &uid, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, const Sink::ApplicationDomain::BufferAdaptor &newEntity, | 155 | void modifiedEntity(const QByteArray &uid, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, Sink::ApplicationDomain::BufferAdaptor &newEntity, |
156 | Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE | 156 | Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE |
157 | { | 157 | { |
158 | modifiedUids << uid; | 158 | modifiedUids << uid; |
@@ -198,6 +198,10 @@ private slots: | |||
198 | auto command = createEntityCommand(createEvent(entityFbb)); | 198 | auto command = createEntityCommand(createEvent(entityFbb)); |
199 | 199 | ||
200 | Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); | 200 | Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); |
201 | |||
202 | auto adaptorFactory = QSharedPointer<TestEventAdaptorFactory>::create(); | ||
203 | pipeline.setAdaptorFactory("event", adaptorFactory); | ||
204 | |||
201 | pipeline.startTransaction(); | 205 | pipeline.startTransaction(); |
202 | pipeline.newEntity(command.constData(), command.size()); | 206 | pipeline.newEntity(command.constData(), command.size()); |
203 | pipeline.commit(); | 207 | pipeline.commit(); |