浏览代码

Initial test suite for MetaType implementations.

Sascha Zelzer 14 年之前
父节点
当前提交
f6246bd0cc
共有 18 个文件被更改,包括 742 次插入0 次删除
  1. 7 0
      Libs/PluginFramework/Testing/CMakeLists.txt
  2. 39 0
      Libs/PluginFramework/Testing/MetaTypeTest/CMakeLists.txt
  3. 153 0
      Libs/PluginFramework/Testing/MetaTypeTest/ctkMTAttrPasswordTestSuite.cpp
  4. 95 0
      Libs/PluginFramework/Testing/MetaTypeTest/ctkMTAttrPasswordTestSuite_p.h
  5. 67 0
      Libs/PluginFramework/Testing/MetaTypeTest/ctkMTLocaleTestSuite.cpp
  6. 63 0
      Libs/PluginFramework/Testing/MetaTypeTest/ctkMTLocaleTestSuite_p.h
  7. 77 0
      Libs/PluginFramework/Testing/MetaTypeTest/ctkMetaTypeTestActivator.cpp
  8. 46 0
      Libs/PluginFramework/Testing/MetaTypeTest/ctkMetaTypeTestActivator_p.h
  9. 10 0
      Libs/PluginFramework/Testing/MetaTypeTest/manifest_headers.cmake
  10. 9 0
      Libs/PluginFramework/Testing/MetaTypeTest/target_libraries.cmake
  11. 3 0
      Libs/PluginFramework/Testing/MetaTypeTestPlugins/CMakeLists.txt
  12. 40 0
      Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/CMakeLists.txt
  13. 20 0
      Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/CTK-INF/metatype/testfile.xml
  14. 40 0
      Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/ctkTestPluginMTAttrPwdActivator.cpp
  15. 41 0
      Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/ctkTestPluginMTAttrPwdActivator_p.h
  16. 6 0
      Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/manifest_headers.cmake
  17. 17 0
      Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/pluginAttrPwd_test_de.ts
  18. 9 0
      Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/target_libraries.cmake

+ 7 - 0
Libs/PluginFramework/Testing/CMakeLists.txt

@@ -14,8 +14,15 @@ SET(fwtest_plugins
   pluginSL4_test
 )
 
+SET(metatypetest_plugins
+  pluginAttrPwd_test
+)
+
 ADD_SUBDIRECTORY(FrameworkTest)
 ADD_SUBDIRECTORY(FrameworkTestPlugins)
 
 ADD_SUBDIRECTORY(ConfigAdminTest)
 ADD_SUBDIRECTORY(EventAdminTest)
+
+ADD_SUBDIRECTORY(MetaTypeTest)
+ADD_SUBDIRECTORY(MetaTypeTestPlugins)

+ 39 - 0
Libs/PluginFramework/Testing/MetaTypeTest/CMakeLists.txt

@@ -0,0 +1,39 @@
+PROJECT(org_commontk_metatypetest)
+
+SET(PLUGIN_export_directive "org_commontk_metatypetest_EXPORT")
+
+SET(PLUGIN_SRCS
+  ctkMetaTypeTestActivator.cpp
+  ctkMTAttrPasswordTestSuite.cpp
+  ctkMTLocaleTestSuite.cpp
+
+  ctkMetaTypeTestActivator_p.h
+  ctkMTAttrPasswordTestSuite_p.h
+  ctkMTLocaleTestSuite_p.h
+)
+
+SET(PLUGIN_MOC_SRCS
+  ctkMetaTypeTestActivator_p.h
+  ctkMTAttrPasswordTestSuite_p.h
+  ctkMTLocaleTestSuite_p.h
+)
+
+SET(PLUGIN_resources
+  
+)
+
+ctkMacroGetTargetLibraries(PLUGIN_target_libraries)
+
+ctkMacroBuildPlugin(
+  NAME ${PROJECT_NAME}
+  EXPORT_DIRECTIVE ${PLUGIN_export_directive}
+  SRCS ${PLUGIN_SRCS}
+  MOC_SRCS ${PLUGIN_MOC_SRCS}
+  RESOURCES ${PLUGIN_resources}
+  TARGET_LIBRARIES ${PLUGIN_target_libraries} ${fwtestutil_lib}
+  TEST_PLUGIN
+)
+
+ADD_DEPENDENCIES(${PROJECT_NAME} ${metatypetest_plugins})
+
+SET(metatype_test ${PROJECT_NAME} CACHE INTERNAL "Target name for the plugin containing unit tests for MetaType implementations")

+ 153 - 0
Libs/PluginFramework/Testing/MetaTypeTest/ctkMTAttrPasswordTestSuite.cpp

@@ -0,0 +1,153 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=============================================================================*/
+
+
+#include "ctkMTAttrPasswordTestSuite_p.h"
+
+#include <ctkPluginContext.h>
+#include <ctkPluginConstants.h>
+#include <ctkPluginFrameworkTestUtil.h>
+
+#include <service/metatype/ctkMetaTypeInformation.h>
+#include <service/metatype/ctkMetaTypeService.h>
+
+#include <QTest>
+#include <QDebug>
+
+ctkMTAttrPasswordTestSuite::ctkMTAttrPasswordTestSuite(
+  ctkPluginContext* pc, long mtPluginId)
+  : context(pc), mtPluginId(mtPluginId), mts(0)
+{
+
+}
+
+void ctkMTAttrPasswordTestSuite::initTestCase()
+{
+  context->getPlugin(mtPluginId)->start();
+  reference = context->getServiceReference<ctkMetaTypeService>();
+  mts = context->getService<ctkMetaTypeService>(reference);
+  plugin = ctkPluginFrameworkTestUtil::installPlugin(context, "pluginAttrPwd_test");
+  plugin->start();
+}
+
+void ctkMTAttrPasswordTestSuite::cleanupTestCase()
+{
+  context->ungetService(reference);
+  context->getPlugin(mtPluginId)->stop();
+}
+
+void ctkMTAttrPasswordTestSuite::testAttributeTypePassword1()
+{
+  ctkMetaTypeInformationPtr mti = mts->getMetaTypeInformation(plugin);
+  ctkObjectClassDefinitionPtr ocd = mti->getObjectClassDefinition("org.commontk.metatype.tests.attrpwd");
+  QVERIFY(ocd);
+  QList<ctkAttributeDefinitionPtr> ads = ocd->getAttributeDefinitions(ctkObjectClassDefinition::ALL);
+  for (int i = 0; i < ads.size(); i++)
+  {
+    if (ads[i]->getID() == "password1")
+    {
+      QVERIFY2(ctkAttributeDefinition::PASSWORD == ads[i]->getType(),
+               "Attribute type is not PASSWORD");
+    }
+  }
+}
+
+void ctkMTAttrPasswordTestSuite::testAttributeTypePassword2()
+{
+  ctkMetaTypeInformationPtr mti = mts->getMetaTypeInformation(plugin);
+  ctkObjectClassDefinitionPtr ocd = mti->getObjectClassDefinition("org.commontk.metatype.tests.attrpwd");
+  QVERIFY(ocd);
+  QList<ctkAttributeDefinitionPtr> ads = ocd->getAttributeDefinitions(ctkObjectClassDefinition::ALL);
+  for (int i = 0; i < ads.size(); i++)
+  {
+    if (ads[i]->getID() == "password1")
+    {
+      QVERIFY2(ads[i]->validate("1234abcd").isNull(), "Validation should not be present when min and max are not specified and there are no enumerated constraints");
+    }
+  }
+ }
+
+void ctkMTAttrPasswordTestSuite::testAttributeTypePassword3()
+{
+  ctkMetaTypeInformationPtr mti = mts->getMetaTypeInformation(plugin);
+  ctkObjectClassDefinitionPtr ocd = mti->getObjectClassDefinition("org.commontk.metatype.tests.attrpwd");
+  QList<ctkAttributeDefinitionPtr> ads = ocd->getAttributeDefinitions(ctkObjectClassDefinition::ALL);
+  for (int i = 0; i < ads.size(); i++)
+  {
+    if (ads[i]->getID() == "password2")
+    {
+      QVERIFY2(!ads[i]->validate("password").isNull(),
+               "Validation should be present when min and max are not specified and their are enumerated constraints");
+      QVERIFY2(0 == ads[i]->validate("password").size(), "Value 'password' should have been valid");
+      QVERIFY2(ads[i]->validate("1234abcd").size() > 0, "Value '1234abcd' should not have been valid");
+    }
+  }
+}
+
+void ctkMTAttrPasswordTestSuite::testAttributeTypePassword4()
+{
+  ctkMetaTypeInformationPtr mti = mts->getMetaTypeInformation(plugin);
+  ctkObjectClassDefinitionPtr ocd = mti->getObjectClassDefinition("org.commontk.metatype.tests.attrpwd");
+  QList<ctkAttributeDefinitionPtr> ads = ocd->getAttributeDefinitions(ctkObjectClassDefinition::ALL);
+  for (int i = 0; i < ads.size(); i++)
+  {
+    if (ads[i]->getID() == "password3")
+    {
+      QVERIFY2(0 == ads[i]->validate("12345678").size(), "Value '12345678' should have been valid");
+      QVERIFY2(0 == ads[i]->validate("123456789").size(), "Value '123456789' should have been valid");
+      QVERIFY2(ads[i]->validate("1234567").size() > 0, "Value '1234567' should not have been valid");
+   }
+  }
+ }
+
+void ctkMTAttrPasswordTestSuite::testAttributeTypePassword5()
+{
+  ctkMetaTypeInformationPtr mti = mts->getMetaTypeInformation(plugin);
+  ctkObjectClassDefinitionPtr ocd = mti->getObjectClassDefinition("org.commontk.metatype.tests.attrpwd");
+  QList<ctkAttributeDefinitionPtr> ads = ocd->getAttributeDefinitions(ctkObjectClassDefinition::ALL);
+  for (int i = 0; i < ads.size(); i++)
+  {
+    if (ads[i]->getID() == "password4")
+    {
+      QVERIFY2(0 == ads[i]->validate("12345").size(), "Value '12345' should have been valid");
+      QVERIFY2(0 == ads[i]->validate("1234").size(), "Value '1234' should have been valid");
+      QVERIFY2(ads[i]->validate("123456").size() > 0, "Value '123456' should not have been valid");
+    }
+  }
+}
+
+void ctkMTAttrPasswordTestSuite::testAttributeTypePassword6()
+{
+  ctkMetaTypeInformationPtr mti = mts->getMetaTypeInformation(plugin);
+  ctkObjectClassDefinitionPtr ocd = mti->getObjectClassDefinition("org.commontk.metatype.tests.attrpwd");
+  QList<ctkAttributeDefinitionPtr> ads = ocd->getAttributeDefinitions(ctkObjectClassDefinition::ALL);
+  for (int i = 0; i < ads.size(); i++)
+  {
+    if (ads[i]->getID() == "password5")
+    {
+      QVERIFY2(0 == ads[i]->validate("123").size(), "Value '123' should have been valid");
+      QVERIFY2(ads[i]->validate("12").size() > 0, "Value '12' should not have been valid");
+      QVERIFY2(0 == ads[i]->validate("123456").size(), "Value '123456' should have been valid");
+      QVERIFY2(ads[i]->validate("1234567").size() > 0, "Value '1234567' should not have been valid");
+   }
+  }
+ }
+

+ 95 - 0
Libs/PluginFramework/Testing/MetaTypeTest/ctkMTAttrPasswordTestSuite_p.h

@@ -0,0 +1,95 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=============================================================================*/
+
+
+#ifndef CTKMTATTRPASSWORDTESTSUITE_P_H
+#define CTKMTATTRPASSWORDTESTSUITE_P_H
+
+#include <QObject>
+
+#include <ctkServiceReference.h>
+#include <ctkTestSuiteInterface.h>
+
+class ctkPluginContext;
+struct ctkMetaTypeService;
+
+class ctkMTAttrPasswordTestSuite : public QObject,
+    public ctkTestSuiteInterface
+{
+  Q_OBJECT
+  Q_INTERFACES(ctkTestSuiteInterface)
+
+public:
+
+  ctkMTAttrPasswordTestSuite(ctkPluginContext* pc, long mtPluginId);
+
+private slots:
+
+  void initTestCase();
+  void cleanupTestCase();
+
+  /*
+   * Ensures the PASSWORD type is recognized.
+   */
+  void testAttributeTypePassword1();
+
+  /*
+   * Ensures the PASSWORD type is treated the same as the STRING type.
+   * Validation should not be present when min and max are not specified and
+   * their are no enumerated constraints.
+   */
+  void testAttributeTypePassword2();
+
+  /*
+   * Ensures the PASSWORD type is treated the same as the STRING type.
+   * Validation should be present when min and max are not specified and
+   * their are enumerated constraints.
+   */
+  void testAttributeTypePassword3();
+
+  /*
+   * Ensures the PASSWORD type is treated the same as the STRING type.
+   * PASSWORD length should be no less than min.
+   */
+  void testAttributeTypePassword4();
+
+  /*
+   * Ensures the PASSWORD type is treated the same as the STRING type.
+   * PASSWORD length should be no greater than max.
+   */
+  void testAttributeTypePassword5();
+
+  /*
+   * Ensures the PASSWORD type is treated the same as the STRING type.
+   * PASSWORD length should be no less than min and no greater than max.
+   */
+  void testAttributeTypePassword6();
+
+private:
+
+  QSharedPointer<ctkPlugin> plugin;
+  ctkPluginContext* context;
+  long mtPluginId;
+  ctkMetaTypeService* mts;
+  ctkServiceReference reference;
+};
+
+#endif // CTKMTATTRPASSWORDTESTSUITE_P_H

+ 67 - 0
Libs/PluginFramework/Testing/MetaTypeTest/ctkMTLocaleTestSuite.cpp

@@ -0,0 +1,67 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=============================================================================*/
+
+
+#include "ctkMTLocaleTestSuite_p.h"
+
+#include <ctkPluginContext.h>
+#include <ctkPluginConstants.h>
+#include <ctkPluginFrameworkTestUtil.h>
+
+#include <service/metatype/ctkMetaTypeInformation.h>
+#include <service/metatype/ctkMetaTypeService.h>
+
+#include <QTest>
+#include <QDebug>
+
+ctkMTLocaleTestSuite::ctkMTLocaleTestSuite(
+  ctkPluginContext* pc, long mtPluginId)
+  : context(pc), mtPluginId(mtPluginId), mts(0)
+{
+
+}
+
+void ctkMTLocaleTestSuite::initTestCase()
+{
+  context->getPlugin(mtPluginId)->start();
+  reference = context->getServiceReference<ctkMetaTypeService>();
+  mts = context->getService<ctkMetaTypeService>(reference);
+  plugin = ctkPluginFrameworkTestUtil::installPlugin(context, "pluginAttrPwd_test");
+  plugin->start();
+}
+
+void ctkMTLocaleTestSuite::cleanupTestCase()
+{
+  context->ungetService(reference);
+  context->getPlugin(mtPluginId)->stop();
+}
+
+void ctkMTLocaleTestSuite::testLocaleList()
+{
+  ctkMetaTypeInformationPtr mti = mts->getMetaTypeInformation(plugin);
+  QList<QLocale> locales = mti->getLocales();
+  QVERIFY2(locales.size() == 1, "Should have found one locale");
+  QCOMPARE(locales[0].name(), QString("de_DE"));
+  ctkObjectClassDefinitionPtr ocd = mti->getObjectClassDefinition("org.commontk.metatype.tests.attrpwd", locales[0]);
+  QCOMPARE(ocd->getName(), QString("Objekt"));
+  QCOMPARE(ocd->getDescription(), QString("Meine Objektklassendefinition"));
+}
+

+ 63 - 0
Libs/PluginFramework/Testing/MetaTypeTest/ctkMTLocaleTestSuite_p.h

@@ -0,0 +1,63 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=============================================================================*/
+
+
+#ifndef CTKMTLOCALETESTSUITE_P_H
+#define CTKMTLOCALETESTSUITE_P_H
+
+#include <QObject>
+
+#include <ctkServiceReference.h>
+#include <ctkTestSuiteInterface.h>
+
+class ctkPluginContext;
+struct ctkMetaTypeService;
+
+class ctkMTLocaleTestSuite : public QObject,
+    public ctkTestSuiteInterface
+{
+  Q_OBJECT
+  Q_INTERFACES(ctkTestSuiteInterface)
+
+public:
+
+  ctkMTLocaleTestSuite(ctkPluginContext* pc, long mtPluginId);
+
+private slots:
+
+  void initTestCase();
+  void cleanupTestCase();
+
+  /*
+   *
+   */
+  void testLocaleList();
+
+private:
+
+  QSharedPointer<ctkPlugin> plugin;
+  ctkPluginContext* context;
+  long mtPluginId;
+  ctkMetaTypeService* mts;
+  ctkServiceReference reference;
+};
+
+#endif // CTKMTLOCALETESTSUITE_P_H

+ 77 - 0
Libs/PluginFramework/Testing/MetaTypeTest/ctkMetaTypeTestActivator.cpp

@@ -0,0 +1,77 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=============================================================================*/
+
+#include "ctkMetaTypeTestActivator_p.h"
+
+#include <ctkPluginContext.h>
+#include <ctkPluginConstants.h>
+
+#include "ctkMTAttrPasswordTestSuite_p.h"
+#include "ctkMTLocaleTestSuite_p.h"
+
+#include <QtPlugin>
+#include <QStringList>
+
+void ctkMetaTypeTestActivator::start(ctkPluginContext* context)
+{
+  QString symbolicName = context->getProperty("metatype.impl").toString();
+  if (symbolicName.isEmpty())
+  {
+    throw std::logic_error("Framework property 'metatype.impl' containing the symbolic "
+                           "name of the MetaType implementation not found!");
+  }
+
+  long mtPluginId = -1;
+  foreach(QSharedPointer<ctkPlugin> p, context->getPlugins())
+  {
+    if (p->getSymbolicName() == symbolicName)
+    {
+      mtPluginId = p->getPluginId();
+      break;
+    }
+  }
+
+  if (mtPluginId < 0)
+  {
+    QString msg = QString("The MetaType implementation '%1' is not installed.")
+        .arg(symbolicName);
+    throw std::logic_error(msg.toStdString());
+  }
+
+  ctkDictionary props;
+
+  attrPwdTestSuite = new ctkMTAttrPasswordTestSuite(context, mtPluginId);
+  props.clear();
+  props.insert(ctkPluginConstants::SERVICE_PID, attrPwdTestSuite->metaObject()->className());
+  context->registerService<ctkTestSuiteInterface>(attrPwdTestSuite, props);
+
+  localeTestSuite = new ctkMTLocaleTestSuite(context, mtPluginId);
+  props.clear();
+  props.insert(ctkPluginConstants::SERVICE_PID, localeTestSuite->metaObject()->className());
+  context->registerService<ctkTestSuiteInterface>(localeTestSuite, props);
+}
+
+void ctkMetaTypeTestActivator::stop(ctkPluginContext* context)
+{
+  Q_UNUSED(context);
+}
+
+Q_EXPORT_PLUGIN2(org_commontk_metatypetest, ctkMetaTypeTestActivator)

+ 46 - 0
Libs/PluginFramework/Testing/MetaTypeTest/ctkMetaTypeTestActivator_p.h

@@ -0,0 +1,46 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=============================================================================*/
+
+
+#ifndef CTKMETATYPETESTACTIVATOR_H
+#define CTKMETATYPETESTACTIVATOR_H
+
+#include <ctkPluginActivator.h>
+
+
+class ctkMetaTypeTestActivator : public QObject,
+    public ctkPluginActivator
+{
+  Q_OBJECT
+  Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+  void start(ctkPluginContext* context);
+  void stop(ctkPluginContext* context);
+
+private:
+
+  QObject* attrPwdTestSuite;
+  QObject* localeTestSuite;
+};
+
+#endif // CTKMETATYPETESTACTIVATOR_H

+ 10 - 0
Libs/PluginFramework/Testing/MetaTypeTest/manifest_headers.cmake

@@ -0,0 +1,10 @@
+set(Plugin-ActivationPolicy "eager")
+set(Plugin-Name "MetaType TestSuite")
+set(Plugin-Version "0.9")
+set(Plugin-Description "Test plugin for the CTK Configuration Admin specs")
+set(Plugin-Vendor "CommonTK")
+set(Plugin-DocURL "http://www.commontk.org")
+set(Plugin-ContactAddress "http://www.commontk.org")
+set(Plugin-Category "test")
+set(Plugin-Copyright "German Cancer Research Center, Division of Medical and Biological Informatics")
+set(Plugin-License "http://www.apache.org/licenses/LICENSE-2.0.html")

+ 9 - 0
Libs/PluginFramework/Testing/MetaTypeTest/target_libraries.cmake

@@ -0,0 +1,9 @@
+#
+# See CMake/ctkMacroGetTargetLibraries.cmake
+# 
+# This file should list the libraries required to build the current CTK plugin.
+# 
+
+SET(target_libraries
+  CTKPluginFramework
+  )

+ 3 - 0
Libs/PluginFramework/Testing/MetaTypeTestPlugins/CMakeLists.txt

@@ -0,0 +1,3 @@
+foreach(test_plugin ${metatypetest_plugins})
+  ADD_SUBDIRECTORY(${test_plugin})
+endforeach()

+ 40 - 0
Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/CMakeLists.txt

@@ -0,0 +1,40 @@
+PROJECT(pluginAttrPwd_test)
+
+SET(PLUGIN_export_directive "pluginAttrPwd_test_EXPORT")
+
+SET(PLUGIN_SRCS
+  ctkTestPluginMTAttrPwdActivator_p.h
+  ctkTestPluginMTAttrPwdActivator.cpp
+)
+
+# Files which should be processed by Qts moc
+SET(PLUGIN_MOC_SRCS
+  ctkTestPluginMTAttrPwdActivator_p.h
+)
+
+# QRC Files which should be compiled into the plugin
+SET(PLUGIN_resources
+)
+
+SET(PLUGIN_cached_resources
+  CTK-INF/metatype/testfile.xml
+)
+
+SET(PLUGIN_ts_files
+  ${PROJECT_NAME}_de.ts
+)
+
+#Compute the plugin dependencies
+ctkMacroGetTargetLibraries(PLUGIN_target_libraries)
+
+ctkMacroBuildPlugin(
+  NAME ${PROJECT_NAME}
+  EXPORT_DIRECTIVE ${PLUGIN_export_directive}
+  SRCS ${PLUGIN_SRCS} ${PLUGIN_qm_files}
+  MOC_SRCS ${PLUGIN_MOC_SRCS}
+  RESOURCES ${PLUGIN_resources}
+  CACHED_RESOURCEFILES ${PLUGIN_cached_resources}
+  TRANSLATIONS ${PLUGIN_ts_files}
+  TARGET_LIBRARIES ${PLUGIN_target_libraries}
+  TEST_PLUGIN
+)

+ 20 - 0
Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/CTK-INF/metatype/testfile.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<md:MetaData 
+		xmlns:md="http://www.org.osgi/xmlns/metatype/v1.0.0/md" 
+		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xsi:schemaLocation="http://www.org.osgi/xmlns/metatype/v1.0.0/md metatype.xsd"
+  localization="CTK-INF/l10n/pluginAttrPwd_test"
+  context="ctkTestPluginMTAttrPwdActivator">
+ <OCD id="ocd1" name="Object" description="My object class definition">
+		<AD default="password" id="password1" type="Password"/>
+		<AD default="password" id="password2" type="Password">
+			<Option label="password" value="password"/>
+		</AD>
+		<AD default="password" id="password3" min="8" type="Password"/>
+		<AD default="password" id="password4" max="5" type="Password"/>
+		<AD default="password" id="password5" max="6" min="3" type="Password"/>
+	</OCD>
+	<Designate pid="org.commontk.metatype.tests.attrpwd">
+		<Object ocdref="ocd1"/>
+	</Designate>
+</md:MetaData>

+ 40 - 0
Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/ctkTestPluginMTAttrPwdActivator.cpp

@@ -0,0 +1,40 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=============================================================================*/
+
+
+#include "ctkTestPluginMTAttrPwdActivator_p.h"
+#include <QtPlugin>
+
+void ctkTestPluginMTAttrPwdActivator::start(ctkPluginContext* context)
+{
+  Q_UNUSED(context)
+  Q_UNUSED(QT_TR_NOOP("Object"));
+  Q_UNUSED(QT_TR_NOOP("My object class definition"));
+}
+
+void ctkTestPluginMTAttrPwdActivator::stop(ctkPluginContext* context)
+{
+  Q_UNUSED(context)
+}
+
+Q_EXPORT_PLUGIN2(pluginAttrPwd_test, ctkTestPluginMTAttrPwdActivator)
+
+

+ 41 - 0
Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/ctkTestPluginMTAttrPwdActivator_p.h

@@ -0,0 +1,41 @@
+/*=============================================================================
+
+  Library: CTK
+
+  Copyright (c) German Cancer Research Center,
+    Division of Medical and Biological Informatics
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=============================================================================*/
+
+
+#ifndef CTKTESTPLUGINMTATTRPWDACTIVATOR_P_H
+#define CTKTESTPLUGINMTATTRPWDACTIVATOR_P_H
+
+#include <ctkPluginActivator.h>
+
+class ctkTestPluginMTAttrPwdActivator :
+  public QObject, public ctkPluginActivator
+{
+  Q_OBJECT
+  Q_INTERFACES(ctkPluginActivator)
+
+public:
+
+  void start(ctkPluginContext* context);
+  void stop(ctkPluginContext* context);
+
+}; // ctkTestPluginMTAttrPwdActivator
+
+#endif // CTKTESTPLUGINMTATTRPWDACTIVATOR_P_H

+ 6 - 0
Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/manifest_headers.cmake

@@ -0,0 +1,6 @@
+set(Plugin-Name "Test MetaType Password Attribute")
+set(Plugin-Version "1.0.0")
+set(Plugin-Description "Test plugin for MetaType implementations")
+set(Plugin-Vendor "CommonTK")
+set(Plugin-ContactAddress "http://www.commontk.org")
+set(Plugin-Category "test")

+ 17 - 0
Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/pluginAttrPwd_test_de.ts

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="de_DE">
+<context>
+    <name>ctkTestPluginMTAttrPwdActivator</name>
+    <message>
+        <location filename="ctkTestPluginMTAttrPwdActivator.cpp" line="29"/>
+        <source>Object</source>
+        <translation>Objekt</translation>
+    </message>
+    <message>
+        <location filename="ctkTestPluginMTAttrPwdActivator.cpp" line="30"/>
+        <source>My object class definition</source>
+        <translation>Meine Objektklassendefinition</translation>
+    </message>
+</context>
+</TS>

+ 9 - 0
Libs/PluginFramework/Testing/MetaTypeTestPlugins/pluginAttrPwd_test/target_libraries.cmake

@@ -0,0 +1,9 @@
+# See CMake/ctkMacroGetTargetLibraries.cmake
+#
+# This file should list the libraries required to build the current CTK plugin.
+# For specifying required plugins, see the manifest_headers.cmake file.
+#
+
+SET(target_libraries
+  CTKPluginFramework
+)