ctkManagedServiceFactoryTestSuite_p.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #ifndef CTKMANAGEDSERVICEFACTORYTESTSUITE_P_H
  16. #define CTKMANAGEDSERVICEFACTORYTESTSUITE_P_H
  17. #include <QObject>
  18. #include <QWaitCondition>
  19. #include <QMutex>
  20. #include <service/cm/ctkManagedServiceFactory.h>
  21. #include <ctkServiceReference.h>
  22. #include <ctkTestSuiteInterface.h>
  23. struct ctkConfigurationAdmin;
  24. class ctkManagedServiceFactoryTestSuite;
  25. class _ManagedServiceFactoryUpdateTest : public QObject,
  26. public ctkManagedServiceFactory
  27. {
  28. Q_OBJECT
  29. Q_INTERFACES(ctkManagedServiceFactory)
  30. public:
  31. _ManagedServiceFactoryUpdateTest(ctkManagedServiceFactoryTestSuite* ts);
  32. void deleted(const QString& pid);
  33. QString getName();
  34. void updated(const QString& pid, const ctkDictionary& properties);
  35. private:
  36. ctkManagedServiceFactoryTestSuite* const ts;
  37. };
  38. class ctkManagedServiceFactoryTestSuite : public QObject,
  39. public ctkTestSuiteInterface
  40. {
  41. Q_OBJECT
  42. Q_INTERFACES(ctkTestSuiteInterface)
  43. public:
  44. ctkManagedServiceFactoryTestSuite(ctkPluginContext* pc, long cmPluginId);
  45. private slots:
  46. void init();
  47. void cleanup();
  48. void testSamePidManagedServiceFactory();
  49. void testGeneralManagedServiceFactory();
  50. private:
  51. ctkPluginContext* context;
  52. long cmPluginId;
  53. ctkConfigurationAdmin* cm;
  54. ctkServiceReference reference;
  55. int updateCount;
  56. bool locked;
  57. QMutex mutex;
  58. QWaitCondition lock;
  59. friend class _ManagedServiceFactoryUpdateTest;
  60. };
  61. #endif // CTKMANAGEDSERVICEFACTORYTESTSUITE_P_H