ctkConfigurationPluginTestSuite_p.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) 2010 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 CTKCONFIGURATIONPLUGINTESTSUITE_P_H
  16. #define CTKCONFIGURATIONPLUGINTESTSUITE_P_H
  17. #include <QObject>
  18. #include <QWaitCondition>
  19. #include <QMutex>
  20. #include <service/cm/ctkConfigurationPlugin.h>
  21. #include <service/cm/ctkManagedService.h>
  22. #include <ctkTestSuiteInterface.h>
  23. class ctkConfigurationPluginTestSuite;
  24. struct ctkConfigurationAdmin;
  25. class _ConfigurationPluginTest : public QObject, public ctkConfigurationPlugin
  26. {
  27. Q_OBJECT
  28. Q_INTERFACES(ctkConfigurationPlugin)
  29. public:
  30. _ConfigurationPluginTest(const QString& prop = "plugin1");
  31. void modifyConfiguration(const ctkServiceReference& reference,
  32. ctkDictionary& properties);
  33. private:
  34. const QString prop;
  35. };
  36. class _ManagedServiceCMPluginTest : public QObject, public ctkManagedService
  37. {
  38. Q_OBJECT
  39. Q_INTERFACES(ctkManagedService)
  40. public:
  41. _ManagedServiceCMPluginTest(ctkConfigurationPluginTestSuite* ts);
  42. void updated(const ctkDictionary& properties);
  43. private:
  44. ctkConfigurationPluginTestSuite* const ts;
  45. };
  46. class ctkConfigurationPluginTestSuite : public QObject,
  47. public ctkTestSuiteInterface
  48. {
  49. Q_OBJECT
  50. Q_INTERFACES(ctkTestSuiteInterface)
  51. public:
  52. ctkConfigurationPluginTestSuite(ctkPluginContext* pc, long cmPluginId);
  53. ~ctkConfigurationPluginTestSuite();
  54. private Q_SLOTS:
  55. void init();
  56. void cleanup();
  57. void testPlugin();
  58. void testPidSpecificPlugin();
  59. void testPidSpecificMissPlugin();
  60. void testRankedPlugin();
  61. private:
  62. ctkPluginContext* context;
  63. long cmPluginId;
  64. ctkConfigurationAdmin* cm;
  65. ctkServiceReference reference;
  66. bool locked;
  67. QMutex mutex;
  68. QWaitCondition lock;
  69. bool success;
  70. friend class _ManagedServiceCMPluginTest;
  71. };
  72. #endif // CTKCONFIGURATIONPLUGINTESTSUITE_P_H