ctkManagedServiceTestSuite_p.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 CTKMANAGEDSERVICETESTSUITE_P_H
  16. #define CTKMANAGEDSERVICETESTSUITE_P_H
  17. #include <QObject>
  18. #include <QWaitCondition>
  19. #include <QMutex>
  20. #include <service/cm/ctkManagedService.h>
  21. #include <ctkServiceReference.h>
  22. #include <ctkTestSuiteInterface.h>
  23. class ctkManagedServiceTestSuite;
  24. struct ctkConfigurationAdmin;
  25. class _ManagedServiceUpdateTest : public QObject, public ctkManagedService
  26. {
  27. Q_OBJECT
  28. Q_INTERFACES(ctkManagedService)
  29. public:
  30. _ManagedServiceUpdateTest(ctkManagedServiceTestSuite* ts);
  31. void updated(const ctkDictionary& properties);
  32. private:
  33. ctkManagedServiceTestSuite* const ts;
  34. };
  35. class ctkManagedServiceTestSuite : public QObject,
  36. public ctkTestSuiteInterface
  37. {
  38. Q_OBJECT
  39. Q_INTERFACES(ctkTestSuiteInterface)
  40. public:
  41. ctkManagedServiceTestSuite(ctkPluginContext* pc, long cmPluginId);
  42. private Q_SLOTS:
  43. void init();
  44. void cleanup();
  45. void testSamePidManagedService();
  46. void testGeneralManagedService();
  47. private:
  48. ctkPluginContext* context;
  49. long cmPluginId;
  50. ctkConfigurationAdmin* cm;
  51. ctkServiceReference reference;
  52. int updateCount;
  53. bool locked;
  54. QMutex mutex;
  55. QWaitCondition lock;
  56. friend class _ManagedServiceUpdateTest;
  57. };
  58. #endif // CTKMANAGEDSERVICETESTSUITE_P_H