diff --git a/Documentation/Doxygen/3-DeveloperManual/Application/BlueBerryExtensionPointReference.dox b/Documentation/Doxygen/3-DeveloperManual/Application/BlueBerryExtensionPointReference.dox
index 2631060b56..066fc9c444 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Application/BlueBerryExtensionPointReference.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Application/BlueBerryExtensionPointReference.dox
@@ -1,99 +1,94 @@
/**
\page BlueBerryExtPointsIndex BlueBerry Extension-Point Reference
BlueBerry Platform Extension Points
The following extension points can be used to extend the capabilities
of the platform infrastructure:
Platform Core Expressions
- \subpage xp_org_blueberry_core_expressions_definitions
- \subpage xp_org_blueberry_core_expressions_commonExpression
- \subpage xp_org_blueberry_core_expressions_propertyTesters
Platform Runtime
- \subpage xp_org_blueberry_osgi_applications
- \subpage xp_org_blueberry_core_runtime_products
Workbench
- \subpage xp_org_blueberry_ui_editors
- \subpage xp_org_blueberry_ui_elementFactories
- \subpage xp_org_blueberry_ui_keywords
- \subpage xp_org_blueberry_ui_menus
- \subpage xp_org_blueberry_ui_perspectiveExtensions
- \subpage xp_org_blueberry_ui_perspectives
- \subpage xp_org_blueberry_ui_preferencePages
- \subpage xp_org_blueberry_ui_presentationFactories
- \subpage xp_org_blueberry_ui_services
- \subpage xp_org_blueberry_ui_tweaklets
- \subpage xp_org_blueberry_ui_views
Other
- \subpage xp_org_blueberry_tests
\page xp_org_blueberry_core_expressions_definitions org.blueberry.core.expressions.definitions
\htmlinclude org_blueberry_core_expressions_definitions.html
\page xp_org_blueberry_core_expressions_commonExpression org.blueberry.core.expressions.commonExpression
\htmlinclude org_blueberry_core_expressions_commonExpression.html
\page xp_org_blueberry_core_expressions_propertyTesters org.blueberry.core.expressions.propertyTesters
\htmlinclude org_blueberry_core_expressions_propertyTesters.html
-
\page xp_org_blueberry_osgi_applications org.blueberry.osgi.applications
\htmlinclude org_blueberry_osgi_applications.html
\page xp_org_blueberry_core_runtime_products org.blueberry.core.runtime.products
\htmlinclude org_blueberry_core_runtime_products.html
-
\page xp_org_blueberry_ui_elementFactories org.blueberry.ui.elementFactories
\htmlinclude org_blueberry_ui_elementFactories.html
\page xp_org_blueberry_ui_menus org.blueberry.ui.menus
\htmlinclude org_blueberry_ui_menus.html
\page xp_org_blueberry_ui_perspectiveExtensions org.blueberry.ui.perspectiveExtensions
\htmlinclude org_blueberry_ui_perspectiveExtensions.html
\page xp_org_blueberry_ui_editors org.blueberry.ui.editors
\htmlinclude org_blueberry_ui_editors.html
\page xp_org_blueberry_ui_perspectives org.blueberry.ui.perspectives
\htmlinclude org_blueberry_ui_perspectives.html
\page xp_org_blueberry_ui_presentationFactories org.blueberry.ui.presentationFactories
\htmlinclude org_blueberry_ui_presentationFactories.html
\page xp_org_blueberry_ui_services org.blueberry.ui.services
\htmlinclude org_blueberry_ui_services.html
\page xp_org_blueberry_ui_keywords org.blueberry.ui.keywords
\htmlinclude org_blueberry_ui_keywords.html
\page xp_org_blueberry_ui_preferencePages org.blueberry.ui.preferencePages
\htmlinclude org_blueberry_ui_preferencePages.html
\page xp_org_blueberry_ui_tweaklets org.blueberry.ui.tweaklets
\htmlinclude org_blueberry_ui_tweaklets.html
\page xp_org_blueberry_ui_views org.blueberry.ui.views
\htmlinclude org_blueberry_ui_views.html
-\page xp_org_blueberry_tests org.blueberry.tests
-\htmlinclude org_blueberry_tests.html
-
*/
diff --git a/Modules/AppUtil/include/mitkBaseApplication.h b/Modules/AppUtil/include/mitkBaseApplication.h
index e1a36b1964..9b263db6d9 100644
--- a/Modules/AppUtil/include/mitkBaseApplication.h
+++ b/Modules/AppUtil/include/mitkBaseApplication.h
@@ -1,321 +1,317 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef mitkBaseApplication_h
#define mitkBaseApplication_h
#include
#include
#include
#include
class ctkPluginContext;
class ctkPluginFramework;
class QCoreApplication;
class QTranslator;
namespace mitk
{
/**
* A utility class for starting BlueBerry applications.
*
* In the simplest case, create an instance of this class and call run().
* This will launch a CTK plugin framework instance and execute the
* default application registered by a plug-in via the
* org.blueberry.osgi.applications extension point.
*
* This class contains many convenience methods to:
* - Put the application in \emph{safe mode} which catches unhandled
* exceptions thrown in the Qt event loop and displays an error
* message.
* - Put the application in \emph{single mode} which by default
* sends the command line arguments to an already running instance
* of the same application instead of creating a second instance.
* - Add a list of library names which should be pre-loaded at
* application start-up, e.g. to speed up the initial launch during
* the caching process of the plug-in meta-data.
* - Set a custom provisioning file to start a specific set of CTK
* plug-ins during application start-up.
* - Set and get CTK plugin framework properties
*
* The behavior can further be customized by deriving from BaseApplication
* and overriding specific methods, such as:
* - initializeLibraryPaths() to add specific library / plugin search paths
* - defineOptions(Poco::Util::OptionSet&) to define a custom set of
* command line options
* - getQApplication() to provide a custom QCoreApplication instance
*
* A simple but complete example:
*
* #include
*
* int main(int argc, char* argv[])
* {
* mitk::BaseApplication app(argc, argv);
* app.setApplicationName("MyApp");
* app.setOrganizationName("MyOrganization");
*
* // Run the workbench
* return app.run();
* }
*
*/
class MITKAPPUTIL_EXPORT BaseApplication : public Poco::Util::Application
{
public:
// Command line arguments
static const QString ARG_APPLICATION;
static const QString ARG_CLEAN;
static const QString ARG_CONSOLELOG;
static const QString ARG_DEBUG;
static const QString ARG_FORCE_PLUGIN_INSTALL;
static const QString ARG_HOME;
static const QString ARG_NEWINSTANCE;
static const QString ARG_NO_LAZY_REGISTRY_CACHE_LOADING;
static const QString ARG_NO_REGISTRY_CACHE;
static const QString ARG_PLUGIN_CACHE;
static const QString ARG_PLUGIN_DIRS;
static const QString ARG_PRELOAD_LIBRARY;
static const QString ARG_PRODUCT;
static const QString ARG_PROVISIONING;
static const QString ARG_REGISTRY_MULTI_LANGUAGE;
static const QString ARG_SPLASH_IMAGE;
static const QString ARG_STORAGE_DIR;
- static const QString ARG_TESTAPPLICATION;
- static const QString ARG_TESTPLUGIN;
static const QString ARG_XARGS;
// BlueBerry specific plugin framework properties
static const QString PROP_APPLICATION;
static const QString PROP_FORCE_PLUGIN_INSTALL;
static const QString PROP_NEWINSTANCE;
static const QString PROP_NO_LAZY_REGISTRY_CACHE_LOADING;
static const QString PROP_NO_REGISTRY_CACHE;
static const QString PROP_PRODUCT;
static const QString PROP_REGISTRY_MULTI_LANGUAGE;
- static const QString PROP_TESTAPPLICATION;
- static const QString PROP_TESTPLUGIN;
BaseApplication(int argc, char **argv);
~BaseApplication() override;
/**
* Initialize the Qt library such that a QCoreApplication
* instance is available and e.g. Qt widgets can be created.
*
* This is usually not called directly by the user.
*/
void initializeQt();
/**
* Launches the BlueBerry framework and runs the default application
* or the one specified in the PROP_APPLICATION framework property.
*
* @return The return code of the application after it was shut down.
*/
int run() override;
void printHelp(const std::string &name, const std::string &value);
/**
* Set the application name. Same as QCoreApplication::setApplicationName.
* @param name The application name.
*/
void setApplicationName(const QString &name);
QString getApplicationName() const;
/**
* Set the organization name. Same as QCoreApplication::setOrganizationName.
* @param name The organization name.
*/
void setOrganizationName(const QString &name);
QString getOrganizationName() const;
/**
* Set the organization domain. Same as QCoreApplication::setOrganizationDomain.
* @param name The organization domain.
*/
void setOrganizationDomain(const QString &name);
QString getOrganizationDomain() const;
/**
* Put the application in single mode, which by default only allows
* a single instance of the application to be created.
*
* Calling this method after run() has been called has no effect.
*
* @param singleMode
*/
void setSingleMode(bool singleMode);
bool getSingleMode() const;
/**
* Put the application in safe mode, catching exceptions from the
* Qt event loop.
*
* @param safeMode
*/
void setSafeMode(bool safeMode);
bool getSafeMode() const;
/**
* Set a list of library names or absoulte file paths
* which should be loaded at application start-up. The name
* and file path may contain a library version appended at the
* end and separated by a '$' charactger.
*
* For example liborg_mitk_gui_qt_common$1.0
.
* Platform specific suffixes are appended automatically.
*
* @param libraryBaseNames A list of library base names.
*/
void setPreloadLibraries(const QStringList &libraryBaseNames);
/**
* Get the list of library base names which should be pre-loaded.
*
* @return A list of pre-loaded libraries.
*/
QStringList getPreloadLibraries() const;
/**
* Set the path to the provisioning file.
*
* By default a provisioning file located in the same directory
* as the executable and named .provisioning
* is loaded if it exists. To disable parsing of provisioning
* files, use an empty string as the argument. Use a
* null QString (QString::null
) to reset to the
* default behaviour.
*
* @param filePath An absolute file path to the provisioning file.
*/
void setProvisioningFilePath(const QString &filePath);
/**
* Get the file path to the provisioning file.
* @return The provisioning file path.
*/
QString getProvisioningFilePath() const;
void setProperty(const QString &property, const QVariant &value);
QVariant getProperty(const QString &property) const;
void installTranslator(QTranslator*);
bool isRunning();
void sendMessage(const QByteArray);
protected:
void initialize(Poco::Util::Application &self) override;
void uninitialize() override;
int getArgc() const;
char **getArgv() const;
/**
* Get the framework storage directory for the CTK plugin
* framework. This method is called in the initialize(Poco::Util::Application&)
* method. It must not be called without a QCoreApplications instance.
*
* @return The CTK Plugin Framework storage directory.
*/
virtual QString getCTKFrameworkStorageDir() const;
/**
* Initialize the CppMicroServices library.
*
* The default implementation set the CppMicroServices storage
* path to the current ctkPluginConstants::FRAMEWORK_STORAGE property
* value.
*
* This method is called in the initialize(Poco::Util::Application&)
* after the CTK Plugin Framework storage directory property
* was set.
*/
virtual void initializeCppMicroServices();
/**
* Get the QCoreApplication object.
*
* This method is called in the initialize(Poco::Util::Application&)
* method and must create a QCoreApplication instance if the
* global qApp variable is not initialized yet.
*
* @return The current QCoreApplication instance. This method
* never returns null.
*/
virtual QCoreApplication *getQApplication() const;
/**
* Add plugin library search paths to the CTK Plugin Framework.
*
* This method is called in the nitialize(Poco::Util::Application&)
* method after getQApplication() was called.
*/
virtual void initializeLibraryPaths();
/**
* Runs the application for which the platform was started. The platform
* must be running.
*
* The given argument is passed to the application being run. If it is an invalid QVariant
* then the command line arguments used in starting the platform, and not consumed
* by the platform code, are passed to the application as a QStringList
.
*
* @param argument the argument passed to the application. May be invalid
* @return the result of running the application
* @throws std::exception if anything goes wrong
*/
int main(const std::vector &args) override;
/**
* Define command line arguments
* @param options
*/
void defineOptions(Poco::Util::OptionSet &options) override;
QSharedPointer getFramework() const;
ctkPluginContext *getFrameworkContext() const;
/**
* Get the initial properties for the CTK plugin framework.
*
* The returned map contains the initial framework properties for
* initializing the CTK plugin framework. The value of specific
* properties may change at runtime and differ from the initial
* value.
*
* @return The initial CTK Plugin Framework properties.
*/
QHash getFrameworkProperties() const;
/*
* Initialize and display the splash screen if an image filename is given
*
*/
void initializeSplashScreen(QCoreApplication * application) const;
private:
struct Impl;
Impl* d;
};
}
#endif // MITKBASEAPPLICATION_H
diff --git a/Modules/AppUtil/src/mitkBaseApplication.cpp b/Modules/AppUtil/src/mitkBaseApplication.cpp
index 316bd28185..c5b3252693 100644
--- a/Modules/AppUtil/src/mitkBaseApplication.cpp
+++ b/Modules/AppUtil/src/mitkBaseApplication.cpp
@@ -1,865 +1,853 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace
{
void outputQtMessage(QtMsgType type, const QMessageLogContext&, const QString& msg)
{
auto message = msg.toStdString();
switch (type)
{
case QtDebugMsg:
MITK_DEBUG << message;
break;
case QtInfoMsg:
MITK_INFO << message;
break;
case QtWarningMsg:
MITK_WARN << message;
break;
case QtCriticalMsg:
MITK_ERROR << message;
break;
case QtFatalMsg:
MITK_ERROR << message;
abort();
default:
MITK_INFO << message;
break;
}
}
}
namespace mitk
{
const QString BaseApplication::ARG_APPLICATION = "BlueBerry.application";
const QString BaseApplication::ARG_CLEAN = "BlueBerry.clean";
const QString BaseApplication::ARG_CONSOLELOG = "BlueBerry.consoleLog";
const QString BaseApplication::ARG_DEBUG = "BlueBerry.debug";
const QString BaseApplication::ARG_FORCE_PLUGIN_INSTALL = "BlueBerry.forcePlugins";
const QString BaseApplication::ARG_HOME = "BlueBerry.home";
const QString BaseApplication::ARG_NEWINSTANCE = "BlueBerry.newInstance";
const QString BaseApplication::ARG_NO_LAZY_REGISTRY_CACHE_LOADING = "BlueBerry.noLazyRegistryCacheLoading";
const QString BaseApplication::ARG_NO_REGISTRY_CACHE = "BlueBerry.noRegistryCache";
const QString BaseApplication::ARG_PLUGIN_CACHE = "BlueBerry.plugin_cache_dir";
const QString BaseApplication::ARG_PLUGIN_DIRS = "BlueBerry.plugin_dirs";
const QString BaseApplication::ARG_PRELOAD_LIBRARY = "BlueBerry.preloadLibrary";
const QString BaseApplication::ARG_PRODUCT = "BlueBerry.product";
const QString BaseApplication::ARG_PROVISIONING = "BlueBerry.provisioning";
const QString BaseApplication::ARG_REGISTRY_MULTI_LANGUAGE = "BlueBerry.registryMultiLanguage";
const QString BaseApplication::ARG_SPLASH_IMAGE = "BlueBerry.splashscreen";
const QString BaseApplication::ARG_STORAGE_DIR = "BlueBerry.storageDir";
- const QString BaseApplication::ARG_TESTAPPLICATION = "BlueBerry.testapplication";
- const QString BaseApplication::ARG_TESTPLUGIN = "BlueBerry.testplugin";
const QString BaseApplication::ARG_XARGS = "xargs";
const QString BaseApplication::PROP_APPLICATION = "blueberry.application";
const QString BaseApplication::PROP_FORCE_PLUGIN_INSTALL = BaseApplication::ARG_FORCE_PLUGIN_INSTALL;
const QString BaseApplication::PROP_NEWINSTANCE = BaseApplication::ARG_NEWINSTANCE;
const QString BaseApplication::PROP_NO_LAZY_REGISTRY_CACHE_LOADING = BaseApplication::ARG_NO_LAZY_REGISTRY_CACHE_LOADING;
const QString BaseApplication::PROP_NO_REGISTRY_CACHE = BaseApplication::ARG_NO_REGISTRY_CACHE;
const QString BaseApplication::PROP_PRODUCT = "blueberry.product";
const QString BaseApplication::PROP_REGISTRY_MULTI_LANGUAGE = BaseApplication::ARG_REGISTRY_MULTI_LANGUAGE;
- const QString BaseApplication::PROP_TESTAPPLICATION = "BlueBerry.testapplication";
- const QString BaseApplication::PROP_TESTPLUGIN = "BlueBerry.testplugin";
class SplashCloserCallback : public QRunnable
{
public:
SplashCloserCallback(QSplashScreen* splashscreen)
: m_Splashscreen(splashscreen)
{
}
void run() override
{
this->m_Splashscreen->close();
}
private:
QSplashScreen *m_Splashscreen; // Owned by BaseApplication::Impl
};
struct BaseApplication::Impl
{
ctkProperties m_FWProps;
QCoreApplication *m_QApp;
int m_Argc;
char **m_Argv;
#ifdef Q_OS_MAC
std::vector m_Argv_macOS;
#endif
QString m_AppName;
QString m_OrgaName;
QString m_OrgaDomain;
bool m_SingleMode;
bool m_SafeMode;
QSplashScreen *m_Splashscreen;
SplashCloserCallback *m_SplashscreenClosingCallback;
QStringList m_PreloadLibs;
QString m_ProvFile;
Impl(int argc, char **argv)
: m_Argc(argc),
m_Argv(argv),
#ifdef Q_OS_MAC
m_Argv_macOS(),
#endif
m_SingleMode(false),
m_SafeMode(true),
m_Splashscreen(nullptr),
m_SplashscreenClosingCallback(nullptr)
{
#ifdef Q_OS_MAC
/* On macOS the process serial number is passed as an command line argument (-psn_)
in certain circumstances. This option causes a Poco exception. We remove it, if present. */
m_Argv_macOS.reserve(argc);
const char psn[] = "-psn";
for (decltype(argc) i = 0; i < argc; ++i)
{
if (0 == strncmp(argv[i], psn, sizeof(psn)))
continue;
m_Argv_macOS.push_back(argv[i]);
}
m_Argc = static_cast(m_Argv_macOS.size());
m_Argv = m_Argv_macOS.data();
#endif
}
~Impl()
{
delete m_SplashscreenClosingCallback;
delete m_Splashscreen;
delete m_QApp;
}
QVariant getProperty(const QString &property) const
{
auto iter = m_FWProps.find(property);
return m_FWProps.end() != iter
? iter.value()
: QVariant();
}
void handleBooleanOption(const std::string &name, const std::string &)
{
auto fwKey = QString::fromStdString(name);
// Translate some keys to proper framework properties
if (ARG_CONSOLELOG == fwKey)
fwKey = ctkPluginFrameworkLauncher::PROP_CONSOLE_LOG;
// For all other options we use the command line option name as the
// framework property key.
m_FWProps[fwKey] = true;
}
void handlePreloadLibraryOption(const std::string &, const std::string &value)
{
m_PreloadLibs.push_back(QString::fromStdString(value));
}
void handleClean(const std::string &, const std::string &)
{
m_FWProps[ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN] = ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT;
}
void initializeCTKPluginFrameworkProperties(Poco::Util::LayeredConfiguration &configuration)
{
// Add all configuration key/value pairs as framework properties
Poco::Util::LayeredConfiguration::Keys keys;
Poco::Util::LayeredConfiguration::Keys keyStack;
configuration.keys(keyStack);
std::vector keyChain;
while (!keyStack.empty())
{
const auto currSubKey = keyStack.back();
if (!keyChain.empty() && keyChain.back() == currSubKey)
{
keyChain.pop_back();
keyStack.pop_back();
continue;
}
Poco::Util::LayeredConfiguration::Keys subKeys;
configuration.keys(currSubKey, subKeys);
if (subKeys.empty())
{
std::string finalKey;
keyStack.pop_back();
for (const auto key : keyChain)
finalKey += key + '.';
finalKey += currSubKey;
keys.push_back(finalKey);
}
else
{
keyChain.push_back(currSubKey);
for (const auto key : subKeys)
keyStack.push_back(key);
}
}
for (const auto key : keys)
{
if (configuration.hasProperty(key))
{
// .ini and command line options overwrite already inserted keys
auto qKey = QString::fromStdString(key);
m_FWProps[qKey] = QString::fromStdString(configuration.getString(key));
}
}
}
void parseProvisioningFile(const QString &filePath)
{
// Skip parsing if the file path is empty
if (filePath.isEmpty())
return;
auto consoleLog = this->getProperty(ctkPluginFrameworkLauncher::PROP_CONSOLE_LOG).toBool();
// Read initial plugins from a provisioning file
QFileInfo provFile(filePath);
QStringList pluginsToStart;
if (provFile.exists())
{
MITK_INFO(consoleLog) << "Using provisioning file: " << qPrintable(provFile.absoluteFilePath());
ProvisioningInfo provInfo(provFile.absoluteFilePath());
// It can still happen that the encoding is not compatible with the fromUtf8 function (i.e. when
// manipulating the LANG variable). The QStringList in provInfo is empty then.
if (provInfo.getPluginDirs().empty())
{
MITK_ERROR << "Cannot search for provisioning file, the retrieved directory list is empty.\n"
<< "This can happen if there are some special non-ASCII characters in the install path.";
}
else
{
for(const auto pluginPath : provInfo.getPluginDirs())
ctkPluginFrameworkLauncher::addSearchPath(pluginPath);
auto pluginUrlsToStart = provInfo.getPluginsToStart();
for (const auto url : pluginUrlsToStart)
pluginsToStart.push_back(url.toString());
}
}
else
{
MITK_INFO(consoleLog) << "Provisionig file does not exist.";
}
if (!pluginsToStart.isEmpty())
{
m_FWProps[ctkPluginFrameworkLauncher::PROP_PLUGINS] = pluginsToStart;
// Use transient start with declared activation policy (this helps when the provisioning file
// changes and some plug-ins should not be installed in the application any more).
ctkPlugin::StartOptions startOptions(ctkPlugin::START_TRANSIENT | ctkPlugin::START_ACTIVATION_POLICY);
m_FWProps[ctkPluginFrameworkLauncher::PROP_PLUGINS_START_OPTIONS] = static_cast(startOptions);
}
}
};
BaseApplication::BaseApplication(int argc, char **argv)
: Application(),
d(new Impl(argc, argv))
{
}
BaseApplication::~BaseApplication()
{
delete d;
}
void BaseApplication::printHelp(const std::string &, const std::string &)
{
Poco::Util::HelpFormatter help(this->options());
help.setAutoIndent();
help.setCommand(this->commandName());
help.format(std::cout);
exit(EXIT_OK);
}
void BaseApplication::setApplicationName(const QString &name)
{
if (nullptr != qApp)
qApp->setApplicationName(name);
d->m_AppName = name;
}
QString BaseApplication::getApplicationName() const
{
return nullptr != qApp
? qApp->applicationName()
: d->m_AppName;
}
void BaseApplication::setOrganizationName(const QString &name)
{
if (nullptr != qApp)
qApp->setOrganizationName(name);
d->m_OrgaName = name;
}
QString BaseApplication::getOrganizationName() const
{
return nullptr != qApp
? qApp->organizationName()
: d->m_OrgaName;
}
void BaseApplication::setOrganizationDomain(const QString &domain)
{
if (nullptr != qApp)
qApp->setOrganizationDomain(domain);
d->m_OrgaDomain = domain;
}
QString BaseApplication::getOrganizationDomain() const
{
return nullptr != qApp
? qApp->organizationDomain()
: d->m_OrgaDomain;
}
void BaseApplication::setSingleMode(bool singleMode)
{
if (nullptr != qApp)
return;
d->m_SingleMode = singleMode;
}
bool BaseApplication::getSingleMode() const
{
return d->m_SingleMode;
}
void BaseApplication::setSafeMode(bool safeMode)
{
if (nullptr != qApp && nullptr == d->m_QApp)
return;
d->m_SafeMode = safeMode;
nullptr == d->m_QApp && getSingleMode()
? static_cast(d->m_QApp)->setSafeMode(safeMode)
: static_cast(d->m_QApp)->setSafeMode(safeMode);
}
bool BaseApplication::getSafeMode() const
{
return d->m_SafeMode;
}
void BaseApplication::setPreloadLibraries(const QStringList &libraryBaseNames)
{
d->m_PreloadLibs = libraryBaseNames;
}
QStringList BaseApplication::getPreloadLibraries() const
{
return d->m_PreloadLibs;
}
void BaseApplication::setProvisioningFilePath(const QString &filePath)
{
d->m_ProvFile = filePath;
}
QString BaseApplication::getProvisioningFilePath() const
{
auto provFilePath = d->m_ProvFile;
// A null QString means look up a default provisioning file
if (provFilePath.isNull() && nullptr != qApp)
{
QFileInfo appFilePath(QCoreApplication::applicationFilePath());
QDir basePath(QCoreApplication::applicationDirPath());
auto provFileName = appFilePath.baseName() + ".provisioning";
QFileInfo provFile(basePath.absoluteFilePath(provFileName));
#ifdef Q_OS_MAC
/*
* On macOS, if started from the build directory, the .provisioning file is located at:
*
* The executable path is:
*
* In this case we have to cdUp threetimes.
*
* During packaging the MitkWorkbench.provisioning file is placed at the same
* level like the executable. Nothing has to be done.
*/
if (!provFile.exists())
{
basePath.cdUp();
basePath.cdUp();
basePath.cdUp();
provFile = basePath.absoluteFilePath(provFileName);
}
#endif
if (provFile.exists())
{
provFilePath = provFile.absoluteFilePath();
}
#ifdef CMAKE_INTDIR
else
{
basePath.cdUp();
provFile.setFile(basePath.absoluteFilePath(provFileName));
if (provFile.exists())
provFilePath = provFile.absoluteFilePath();
}
#endif
}
return provFilePath;
}
void BaseApplication::initializeQt()
{
if (nullptr != qApp)
return;
// If parameters have been set before, we have to store them to hand them
// through to the application
auto appName = this->getApplicationName();
auto orgName = this->getOrganizationName();
auto orgDomain = this->getOrganizationDomain();
// Create a QCoreApplication instance
this->getQApplication();
// Provide parameters to QCoreApplication
this->setApplicationName(appName);
this->setOrganizationName(orgName);
this->setOrganizationDomain(orgDomain);
qInstallMessageHandler(outputQtMessage);
}
void BaseApplication::initialize(Poco::Util::Application &self)
{
// 1. Call the super-class method
Poco::Util::Application::initialize(self);
// 2. Initialize the Qt framework (by creating a QCoreApplication)
this->initializeQt();
// 3. Seed the random number generator, once at startup.
QTime time = QTime::currentTime();
qsrand((uint)time.msec());
// 4. Load the "default" configuration, which involves parsing
// an optional .ini file and parsing any
// command line arguments
this->loadConfiguration();
// 5. Add configuration data from the command line and the
// optional .ini file as CTK plugin
// framework properties.
d->initializeCTKPluginFrameworkProperties(this->config());
// 6. Initialize splash screen if an image path is provided
// in the .ini file
this->initializeSplashScreen(qApp);
// 7. Set the custom CTK Plugin Framework storage directory
QString storageDir = this->getCTKFrameworkStorageDir();
if (!storageDir.isEmpty())
d->m_FWProps[ctkPluginConstants::FRAMEWORK_STORAGE] = storageDir;
// 8. Set the library search paths and the pre-load library property
this->initializeLibraryPaths();
auto preloadLibs = this->getPreloadLibraries();
if (!preloadLibs.isEmpty())
d->m_FWProps[ctkPluginConstants::FRAMEWORK_PRELOAD_LIBRARIES] = preloadLibs;
// 9. Initialize the CppMicroServices library.
// The initializeCppMicroServices() method reuses the
// FRAMEWORK_STORAGE property, so we call it after the
// getCTKFrameworkStorageDir method.
this->initializeCppMicroServices();
// 10. Parse the (optional) provisioning file and set the
// correct framework properties.
d->parseProvisioningFile(this->getProvisioningFilePath());
// 11. Set the CTK Plugin Framework properties
ctkPluginFrameworkLauncher::setFrameworkProperties(d->m_FWProps);
}
void BaseApplication::uninitialize()
{
auto pfw = this->getFramework();
if (pfw)
{
pfw->stop();
// Wait for up to 10 seconds for the CTK plugin framework to stop
pfw->waitForStop(10000);
}
Poco::Util::Application::uninitialize();
}
int BaseApplication::getArgc() const
{
return d->m_Argc;
}
char **BaseApplication::getArgv() const
{
return d->m_Argv;
}
QString BaseApplication::getCTKFrameworkStorageDir() const
{
QString storageDir;
if (this->getSingleMode())
{
// This function checks if an instance is already running and either sends a message to
// it containing the command line arguments or checks if a new instance was forced by
// providing the BlueBerry.newInstance command line argument. In the latter case, a path
// to a temporary directory for the new application's storage directory is returned.
storageDir = handleNewAppInstance(static_cast(d->m_QApp),
d->m_Argc, d->m_Argv, ARG_NEWINSTANCE);
}
if (storageDir.isEmpty())
{
// This is a new instance and no other instance is already running. We specify the
// storage directory here (this is the same code as in berryInternalPlatform.cpp)
// so that we can re-use the location for the persistent data location of the
// the CppMicroServices library.
// Append a hash value of the absolute path of the executable to the data location.
// This allows to start the same application from different build or install trees.
storageDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/" +
this->getOrganizationName() + "/" + this->getApplicationName() + '_';
storageDir += QString::number(qHash(QCoreApplication::applicationDirPath())) + "/";
}
return storageDir;
}
void BaseApplication::initializeCppMicroServices()
{
auto storageDir = this->getProperty(ctkPluginConstants::FRAMEWORK_STORAGE).toString();
if (!storageDir.isEmpty())
us::ModuleSettings::SetStoragePath((storageDir + "us" + QDir::separator()).toStdString());
}
QCoreApplication *BaseApplication::getQApplication() const
{
if (nullptr == qApp)
{
vtkOpenGLRenderWindow::SetGlobalMaximumNumberOfMultiSamples(0);
auto defaultFormat = QVTKOpenGLWidget::defaultFormat();
defaultFormat.setSamples(0);
QSurfaceFormat::setDefaultFormat(defaultFormat);
#ifdef Q_OS_OSX
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
#endif
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
d->m_QApp = this->getSingleMode()
? static_cast(new QmitkSingleApplication(d->m_Argc, d->m_Argv, this->getSafeMode()))
: static_cast(new QmitkSafeApplication(d->m_Argc, d->m_Argv, this->getSafeMode()));
}
return qApp;
}
void BaseApplication::initializeLibraryPaths()
{
QStringList suffixes;
suffixes << "plugins";
#ifdef Q_OS_WINDOWS
suffixes << "bin/plugins";
#ifdef CMAKE_INTDIR
suffixes << "bin/" CMAKE_INTDIR "/plugins";
#endif
#else
suffixes << "lib/plugins";
#ifdef CMAKE_INTDIR
suffixes << "lib/" CMAKE_INTDIR "/plugins";
#endif
#endif
#ifdef Q_OS_MAC
suffixes << "../../plugins";
#endif
// We add a couple of standard library search paths for plug-ins
QDir appDir(QCoreApplication::applicationDirPath());
// Walk one directory up and add bin and lib sub-dirs; this might be redundant
appDir.cdUp();
for (const auto suffix : suffixes)
ctkPluginFrameworkLauncher::addSearchPath(appDir.absoluteFilePath(suffix));
}
int BaseApplication::main(const std::vector &args)
{
// Start the plugin framework and all installed plug-ins according to their auto-start setting
QStringList arguments;
for (auto const &arg : args)
arguments.push_back(QString::fromStdString(arg));
if (nullptr != d->m_Splashscreen)
{
// A splash screen is displayed. Create the closing callback.
d->m_SplashscreenClosingCallback = new SplashCloserCallback(d->m_Splashscreen);
}
return ctkPluginFrameworkLauncher::run(d->m_SplashscreenClosingCallback, QVariant::fromValue(arguments)).toInt();
}
void BaseApplication::defineOptions(Poco::Util::OptionSet &options)
{
Poco::Util::Option helpOption("help", "h", "print this help text");
helpOption.callback(Poco::Util::OptionCallback(this, &BaseApplication::printHelp));
options.addOption(helpOption);
Poco::Util::Option newInstanceOption(ARG_NEWINSTANCE.toStdString(), "", "forces a new instance of this application");
newInstanceOption.callback(Poco::Util::OptionCallback(d, &Impl::handleBooleanOption));
options.addOption(newInstanceOption);
Poco::Util::Option cleanOption(ARG_CLEAN.toStdString(), "", "cleans the plugin cache");
cleanOption.callback(Poco::Util::OptionCallback(d, &Impl::handleClean));
options.addOption(cleanOption);
Poco::Util::Option productOption(ARG_PRODUCT.toStdString(), "", "the id of the product to be launched");
productOption.argument("").binding(PROP_PRODUCT.toStdString());
options.addOption(productOption);
Poco::Util::Option appOption(ARG_APPLICATION.toStdString(), "", "the id of the application extension to be executed");
appOption.argument("").binding(PROP_APPLICATION.toStdString());
options.addOption(appOption);
Poco::Util::Option provOption(ARG_PROVISIONING.toStdString(), "", "the location of a provisioning file");
provOption.argument("").binding(ARG_PROVISIONING.toStdString());
options.addOption(provOption);
Poco::Util::Option storageDirOption(ARG_STORAGE_DIR.toStdString(), "", "the location for storing persistent application data");
storageDirOption.argument("").binding(ctkPluginConstants::FRAMEWORK_STORAGE.toStdString());
options.addOption(storageDirOption);
Poco::Util::Option consoleLogOption(ARG_CONSOLELOG.toStdString(), "", "log messages to the console");
consoleLogOption.callback(Poco::Util::OptionCallback(d, &Impl::handleBooleanOption));
options.addOption(consoleLogOption);
Poco::Util::Option debugOption(ARG_DEBUG.toStdString(), "", "enable debug mode");
debugOption.argument("", false).binding(ctkPluginFrameworkLauncher::PROP_DEBUG.toStdString());
options.addOption(debugOption);
Poco::Util::Option forcePluginOption(ARG_FORCE_PLUGIN_INSTALL.toStdString(), "", "force installing plug-ins with same symbolic name");
forcePluginOption.callback(Poco::Util::OptionCallback(d, &Impl::handleBooleanOption));
options.addOption(forcePluginOption);
Poco::Util::Option preloadLibsOption(ARG_PRELOAD_LIBRARY.toStdString(), "", "preload a library");
preloadLibsOption.argument("")
.repeatable(true)
.callback(Poco::Util::OptionCallback(d, &Impl::handlePreloadLibraryOption));
options.addOption(preloadLibsOption);
- Poco::Util::Option testPluginOption(ARG_TESTPLUGIN.toStdString(), "", "the plug-in to be tested");
- testPluginOption.argument("").binding(PROP_TESTPLUGIN.toStdString());
- options.addOption(testPluginOption);
-
- Poco::Util::Option testAppOption(ARG_TESTAPPLICATION.toStdString(), "", "the application to be tested");
- testAppOption.argument("").binding(PROP_TESTAPPLICATION.toStdString());
- options.addOption(testAppOption);
-
Poco::Util::Option noRegistryCacheOption(ARG_NO_REGISTRY_CACHE.toStdString(), "", "do not use a cache for the registry");
noRegistryCacheOption.callback(Poco::Util::OptionCallback(d, &Impl::handleBooleanOption));
options.addOption(noRegistryCacheOption);
Poco::Util::Option noLazyRegistryCacheLoadingOption(ARG_NO_LAZY_REGISTRY_CACHE_LOADING.toStdString(), "", "do not use lazy cache loading for the registry");
noLazyRegistryCacheLoadingOption.callback(Poco::Util::OptionCallback(d, &Impl::handleBooleanOption));
options.addOption(noLazyRegistryCacheLoadingOption);
Poco::Util::Option registryMultiLanguageOption(ARG_REGISTRY_MULTI_LANGUAGE.toStdString(), "", "enable multi-language support for the registry");
registryMultiLanguageOption.callback(Poco::Util::OptionCallback(d, &Impl::handleBooleanOption));
options.addOption(registryMultiLanguageOption);
Poco::Util::Option splashScreenOption(ARG_SPLASH_IMAGE.toStdString(), "", "optional picture to use as a splash screen");
splashScreenOption.argument("").binding(ARG_SPLASH_IMAGE.toStdString());
options.addOption(splashScreenOption);
Poco::Util::Option xargsOption(ARG_XARGS.toStdString(), "", "Extended argument list");
xargsOption.argument("").binding(ARG_XARGS.toStdString());
options.addOption(xargsOption);
Poco::Util::Application::defineOptions(options);
}
QSharedPointer BaseApplication::getFramework() const
{
return ctkPluginFrameworkLauncher::getPluginFramework();
}
ctkPluginContext *BaseApplication::getFrameworkContext() const
{
auto framework = getFramework();
return framework
? framework->getPluginContext()
: nullptr;
}
void BaseApplication::initializeSplashScreen(QCoreApplication * application) const
{
auto pixmapFileNameProp = d->getProperty(ARG_SPLASH_IMAGE);
if (!pixmapFileNameProp.isNull())
{
auto pixmapFileName = pixmapFileNameProp.toString();
QFileInfo checkFile(pixmapFileName);
if (checkFile.exists() && checkFile.isFile())
{
QPixmap pixmap(checkFile.absoluteFilePath());
d->m_Splashscreen = new QSplashScreen(pixmap, Qt::WindowStaysOnTopHint);
d->m_Splashscreen->show();
application->processEvents();
}
}
}
QHash BaseApplication::getFrameworkProperties() const
{
return d->m_FWProps;
}
int BaseApplication::run()
{
this->init(d->m_Argc, d->m_Argv);
return Application::run();
}
void BaseApplication::setProperty(const QString &property, const QVariant &value)
{
d->m_FWProps[property] = value;
}
QVariant BaseApplication::getProperty(const QString &property) const
{
return d->getProperty(property);
}
void BaseApplication::installTranslator(QTranslator* translator)
{
this->getQApplication()->installTranslator(translator);
}
bool BaseApplication::isRunning()
{
auto app = dynamic_cast(this->getQApplication());
if (nullptr != app)
app->isRunning();
mitkThrow() << "Method not implemented.";
}
void BaseApplication::sendMessage(const QByteArray msg)
{
auto app = dynamic_cast(this->getQApplication());
if (nullptr != app)
app->sendMessage(msg);
mitkThrow() << "Method not implemented.";
}
}
diff --git a/Plugins/Testing/org.blueberry.core.runtime.tests/CMakeLists.txt b/Plugins/Testing/org.blueberry.core.runtime.tests/CMakeLists.txt
deleted file mode 100644
index 4f06c8b200..0000000000
--- a/Plugins/Testing/org.blueberry.core.runtime.tests/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-project(org_blueberry_core_runtime_tests)
-
-mitk_create_plugin(
- EXPORT_DIRECTIVE BERRY_RUNTIME_TESTS
- TEST_PLUGIN
-)
-
-target_link_libraries(${PROJECT_NAME} optimized CppUnit debug CppUnitd)
-
-MACRO_TEST_PLUGIN()
diff --git a/Plugins/Testing/org.blueberry.core.runtime.tests/files.cmake b/Plugins/Testing/org.blueberry.core.runtime.tests/files.cmake
deleted file mode 100644
index 904a56991c..0000000000
--- a/Plugins/Testing/org.blueberry.core.runtime.tests/files.cmake
+++ /dev/null
@@ -1,30 +0,0 @@
-set(MOC_H_FILES
- src/berryCoreRuntimeTestSuite.h
- src/berryPluginActivator.h
-)
-
-set(CACHED_RESOURCE_FILES
- plugin.xml
-)
-
-set(SRC_CPP_FILES
- berryCoreRuntimeTestSuite.cpp
- berryPreferencesServiceTest.cpp
- berryPreferencesTest.cpp
-
- berryPluginActivator.cpp
-)
-
-set(INTERNAL_CPP_FILES
-
-)
-
-set(CPP_FILES )
-
-foreach(file ${SRC_CPP_FILES})
- set(CPP_FILES ${CPP_FILES} src/${file})
-endforeach(file ${SRC_CPP_FILES})
-
-foreach(file ${INTERNAL_CPP_FILES})
- set(CPP_FILES ${CPP_FILES} src/internal/${file})
-endforeach(file ${INTERNAL_CPP_FILES})
diff --git a/Plugins/Testing/org.blueberry.core.runtime.tests/manifest_headers.cmake b/Plugins/Testing/org.blueberry.core.runtime.tests/manifest_headers.cmake
deleted file mode 100644
index 5b1f7b7e14..0000000000
--- a/Plugins/Testing/org.blueberry.core.runtime.tests/manifest_headers.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-set(Plugin-Name "Core Runtime Test Bundle")
-set(Plugin-Version "0.9")
-set(Plugin-Vendor "German Cancer Research Center (DKFZ)")
-set(Plugin-ContactAddress "http://www.mitk.org")
-set(Require-Plugin org.blueberry.test org.blueberry.core.runtime)
-
diff --git a/Plugins/Testing/org.blueberry.core.runtime.tests/plugin.xml b/Plugins/Testing/org.blueberry.core.runtime.tests/plugin.xml
deleted file mode 100644
index a788a9f121..0000000000
--- a/Plugins/Testing/org.blueberry.core.runtime.tests/plugin.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryCoreRuntimeTestSuite.cpp b/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryCoreRuntimeTestSuite.cpp
deleted file mode 100644
index 595ff7f254..0000000000
--- a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryCoreRuntimeTestSuite.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#include
-#include
-#include
-
-#include "berryCoreRuntimeTestSuite.h"
-
-#include "berryPreferencesTest.h"
-#include "berryPreferencesServiceTest.h"
-
-namespace berry {
-
-CoreRuntimeTestSuite::CoreRuntimeTestSuite(const CoreRuntimeTestSuite& other)
-{
-
-}
-
-CoreRuntimeTestSuite::CoreRuntimeTestSuite()
-: CppUnit::TestSuite("CoreRuntimeTestSuite")
-{
- addTest(PreferencesTest::Suite());
- addTest(PreferencesServiceTest::Suite());
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryCoreRuntimeTestSuite.h b/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryCoreRuntimeTestSuite.h
deleted file mode 100644
index 7032be05da..0000000000
--- a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryCoreRuntimeTestSuite.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#ifndef BERRYCORERUNTIMETESTSUITE_H_
-#define BERRYCORERUNTIMETESTSUITE_H_
-
-#include
-
-#include
-
-Q_DECLARE_INTERFACE(CppUnit::Test, "CppUnit.Test")
-
-namespace berry {
-
-class CoreRuntimeTestSuite : public QObject, public CppUnit::TestSuite
-{
- Q_OBJECT
- Q_INTERFACES(CppUnit::Test)
-
-public:
-
- CoreRuntimeTestSuite();
- CoreRuntimeTestSuite(const CoreRuntimeTestSuite& other);
-};
-
-}
-
-#endif /* BERRYCORERUNTIMETESTSUITE_H_ */
diff --git a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPluginActivator.cpp b/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPluginActivator.cpp
deleted file mode 100644
index 4d01f61999..0000000000
--- a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPluginActivator.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include
-#include "berryPluginActivator.h"
-#include "berryCoreRuntimeTestSuite.h"
-
-namespace berry {
-
-void org_blueberry_core_runtime_tests_Activator::start(ctkPluginContext* context)
-{
- BERRY_REGISTER_EXTENSION_CLASS(CoreRuntimeTestSuite, context)
-}
-
-void org_blueberry_core_runtime_tests_Activator::stop(ctkPluginContext* context)
-{
- Q_UNUSED(context)
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPluginActivator.h b/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPluginActivator.h
deleted file mode 100644
index 7a5e6ca163..0000000000
--- a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPluginActivator.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#ifndef BERRYPLUGINACTIVATOR_H
-#define BERRYPLUGINACTIVATOR_H
-
-#include
-#include
-
-namespace berry {
-
-class org_blueberry_core_runtime_tests_Activator :
- public QObject, public ctkPluginActivator
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org_blueberry_core_runtime_tests")
- Q_INTERFACES(ctkPluginActivator)
-
-public:
-
- void start(ctkPluginContext* context);
- void stop(ctkPluginContext* context);
-
-};
-
-typedef org_blueberry_core_runtime_tests_Activator PluginActivator;
-
-}
-
-#endif // BERRYPLUGINACTIVATOR_H
diff --git a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPreferencesServiceTest.cpp b/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPreferencesServiceTest.cpp
deleted file mode 100644
index ba0dc787f8..0000000000
--- a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPreferencesServiceTest.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include "berryPreferencesServiceTest.h"
-#include
-#include
-#include
-
-#include "berryLog.h"
-
-#include
-#include
-
-#include "Poco/File.h"
-#include "Poco/Path.h"
-#include "Poco/AutoPtr.h"
-
-#include
-#include
-#include
-
-using namespace std;
-
-namespace berry
-{
-
- PreferencesServiceTest::PreferencesServiceTest(const std::string& testName)
- : berry::TestCase(testName)
- {}
-
- CppUnit::Test* PreferencesServiceTest::Suite()
- {
- CppUnit::TestSuite* suite = new CppUnit::TestSuite("PreferencesServiceTest");
-
- CppUnit_addTest(suite, PreferencesServiceTest, TestAll);
- return suite;
- }
-
-
- void PreferencesServiceTest::TestAll()
- {
- try
- {
- IPreferencesService::Pointer prefService = Platform::GetServiceRegistry().GetServiceById(IPreferencesService::ID);
- assert(prefService.IsNotNull());
-
- /// Test for: IPreferences::GetSystemPreferences()
- IPreferences::Pointer sysPrefs = prefService->GetSystemPreferences();
- assert(sysPrefs.IsNotNull());
-
- /// Test for: IPreferences::GetUserPreferences(std::string name)
- IPreferences::Pointer testUserPrefs = prefService->GetUserPreferences("testUser");
- assert(testUserPrefs.IsNotNull());
-
- /// Test for: IPreferences::GetUsers()
- std::vector userList = prefService->GetUsers();
- // userList should now contain "testUser"
- bool userListContainsTestUser = false;
- for (std::vector::iterator it = userList.begin()
- ; it != userList.end(); it++)
- {
- if(*it == "testUser")
- {
- userListContainsTestUser = true;
- break;
- }
- }
- assert(userListContainsTestUser);
-
- IBerryPreferencesService::Pointer berryPrefService = prefService.Cast();
- // optional test for IBerryPreferencesService
- if(berryPrefService.IsNotNull())
- {
- /// Test for: IBerryPreferencesService::ExportPreferences(Poco::File f, std::string name="")
-
- // write general prefs
- std::string sysPrefsExportFilePath = Poco::Path::temp() + Poco::Path::separator() + "systemBerryPreferences";
- Poco::File sysPrefsExportFile(sysPrefsExportFilePath);
- sysPrefs->PutInt("testNumber", 1);
- berryPrefService->ExportPreferences(sysPrefsExportFile);
- // assert somethings was written
- assert(sysPrefsExportFile.getSize() > 0);
-
- // write testUser prefs
- std::string testUserPrefsExportFilePath = Poco::Path::temp() + Poco::Path::separator() + "testUserBerryPreferences";
- Poco::File testUserPrefsExportFile(testUserPrefsExportFilePath);
- testUserPrefs->PutInt("testNumber", 2);
- berryPrefService->ExportPreferences(testUserPrefsExportFile, "testUser");
- assert(testUserPrefsExportFile.getSize() > 0);
-
- /// Test for: IBerryPreferencesService::ImportPreferences(Poco::File f, std::string name="")
-
- // import general prefs
- // change testNumber value
- sysPrefs->PutInt("testNumber", 3);
- berryPrefService->ImportPreferences(sysPrefsExportFile);
- // "testNumber" preference should now again be overwritten with its old value 1
- assert(sysPrefs->GetInt("testNumber", 3) == 1);
-
- // import testUser prefs
- // change testNumber value
- testUserPrefs->PutInt("testNumber", 4);
- berryPrefService->ImportPreferences(testUserPrefsExportFile, "testUser");
- // "testNumber" preference should now again be overwritten with its old value 2
- assert(testUserPrefs->GetInt("testNumber", 4) == 2);
-
- // delete files again
- sysPrefsExportFile.remove();
- testUserPrefsExportFile.remove();
- }
- }
- catch (Poco::CreateFileException& e)
- {
- std::string msg = "Failed to create preferences file: ";
- msg.append(e.what());
- this->fail( msg );
- }
- catch (std::exception& e)
- {
- this->fail( e.what() );
- }
- catch (...)
- {
- this->fail( "unknown exception occured" );
- }
- }
-}
diff --git a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPreferencesServiceTest.h b/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPreferencesServiceTest.h
deleted file mode 100644
index 286abb9010..0000000000
--- a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPreferencesServiceTest.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#ifndef BERRYPREFERENCESSERVICETEST_H_
-#define BERRYPREFERENCESSERVICETEST_H_
-
-#include
-
-namespace berry {
-
-class PreferencesServiceTest : public berry::TestCase
-{
-public:
-
- static CppUnit::Test* Suite();
-
- PreferencesServiceTest(const std::string& testName);
-
- void TestAll();
-};
-
-}
-
-#endif /* BERRYPREFERENCESSERVICETEST_H_ */
diff --git a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPreferencesTest.cpp b/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPreferencesTest.cpp
deleted file mode 100644
index cecc437691..0000000000
--- a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPreferencesTest.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include "berryPreferencesTest.h"
-
-#include
-#include
-#include
-
-#include
-#include
-
-#include "berryLog.h"
-
-#include "Poco/File.h"
-#include "Poco/Path.h"
-
-#include
-#include
-#include
-
-using namespace std;
-
-namespace berry
-{
-
- PreferencesTest::PreferencesTest(const std::string& testName)
- : berry::TestCase(testName)
- {}
-
- CppUnit::Test* PreferencesTest::Suite()
- {
- CppUnit::TestSuite* suite = new CppUnit::TestSuite("PreferencesTest");
-
- CppUnit_addTest(suite, PreferencesTest, TestAll);
- return suite;
- }
-
- // simple class for testing berry changed events
- class TestPreferencesChangedListener
- {
- public:
- TestPreferencesChangedListener(IBerryPreferences* _berryPrefNode) : numCalled(0), berryPrefNode(_berryPrefNode)
- {
- berryPrefNode->OnChanged.AddListener(
- berry::MessageDelegate1 (
- this, &TestPreferencesChangedListener::PreferencesChanged )
- );
- };
-
- ~TestPreferencesChangedListener()
- {
- berryPrefNode->OnChanged.RemoveListener(
- berry::MessageDelegate1 (
- this, &TestPreferencesChangedListener::PreferencesChanged )
- );
- };
-
- void PreferencesChanged(const IBerryPreferences*)
- {
- ++numCalled;
- }
- int numCalled;
- IBerryPreferences* berryPrefNode;
- };
-
- void PreferencesTest::TestAll()
- {
- IPreferencesService::Pointer prefService = Platform::GetServiceRegistry().GetServiceById(IPreferencesService::ID);
- assert(prefService.IsNotNull());
-
- /// Test for: IPreferences::GetSystemPreferences()
- IPreferences::Pointer root = prefService->GetSystemPreferences();
- assert(root.IsNotNull());
-
- {
- BERRY_INFO << "testing Preferences::Node(), Preferences::NodeExists(), Preferences::Parent(), "
- "Preferences::ChildrenNames(), Preferences::RemoveNode()";
-
- berry::IPreferences::Pointer editorsNode(0);
- editorsNode = root->Node("/editors");
- assert(editorsNode.IsNotNull());
-
- assert(editorsNode->NodeExists("/editors"));
-
- assert(editorsNode->Parent() == root);
-
- berry::IPreferences::Pointer editorsGeneralNode = root->Node("/editors/general");
- assert(editorsNode->NodeExists("/editors/general"));
-
- berry::IPreferences::Pointer editorsSyntaxNode = root->Node("/editors/syntax");
- assert(editorsGeneralNode->NodeExists("/editors/syntax"));
-
- berry::IPreferences::Pointer editorsFontNode = root->Node("/editors/font");
- assert(editorsSyntaxNode->NodeExists("/editors/font"));
-
- vector childrenNames;
- childrenNames.push_back("general");
- childrenNames.push_back("syntax");
- childrenNames.push_back("font");
- assert(editorsNode->ChildrenNames() == childrenNames);
-
- editorsFontNode->RemoveNode();
- try {
- editorsFontNode->Parent();
- failmsg("this should throw a Poco::IllegalStateException");
- }
- catch (Poco::IllegalStateException)
- {
- // expected
- }
- }
-
- // testing methods
- // Preferences::put*()
- // Preferences::get*()
- {
- BERRY_INFO << "testing Preferences::put*(), Preferences::get*(), OnChanged";
-
- assert(root->NodeExists("/editors/general"));
- berry::IPreferences::Pointer editorsGeneralNode = root->Node("/editors/general");
-
- IBerryPreferences::Pointer berryEditorsGeneralNode = editorsGeneralNode.Cast< IBerryPreferences >();
- assert(berryEditorsGeneralNode.IsNotNull());
-
- TestPreferencesChangedListener listener(berryEditorsGeneralNode.GetPointer());
-
- std::string strKey = "Bad words";std::string strValue = "badword1 badword2";
- editorsGeneralNode->Put(strKey, strValue);
-
- assert(listener.numCalled == 1);
- assert(editorsGeneralNode->Get(strKey, "") == strValue);
- assert(editorsGeneralNode->Get("wrong key", "default value") == "default value");
-
- strKey = "Show Line Numbers";bool bValue = true;
- editorsGeneralNode->PutBool(strKey, bValue);
- assert(listener.numCalled == 2);
- assert(editorsGeneralNode->GetBool(strKey, !bValue) == bValue);
-
- strKey = "backgroundcolor"; strValue = "#00FF00";
- editorsGeneralNode->PutByteArray(strKey, strValue);
- assert(listener.numCalled == 3);
- assert(editorsGeneralNode->GetByteArray(strKey, "") == strValue);
-
- strKey = "update time"; double dValue = 1.23;
- editorsGeneralNode->PutDouble(strKey, dValue);
- assert(editorsGeneralNode->GetDouble(strKey, 0.0) == dValue);
-
- strKey = "update time float"; float fValue = 1.23f;
- editorsGeneralNode->PutFloat(strKey, fValue);
- assert(editorsGeneralNode->GetFloat(strKey, 0.0f) == fValue);
-
- strKey = "Break on column"; int iValue = 80;
- editorsGeneralNode->PutInt(strKey, iValue);
- assert(editorsGeneralNode->GetInt(strKey, 0) == iValue);
-
- strKey = "Maximum number of words"; long lValue = 11000000;
- editorsGeneralNode->PutLong(strKey, lValue);
- assert(editorsGeneralNode->GetLong(strKey, 0) == lValue);
- }
-
- }
-
-}
diff --git a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPreferencesTest.h b/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPreferencesTest.h
deleted file mode 100644
index 7cddaf0d04..0000000000
--- a/Plugins/Testing/org.blueberry.core.runtime.tests/src/berryPreferencesTest.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#ifndef BERRYPREFERENCESTEST_H_
-#define BERRYPREFERENCESTEST_H_
-
-#include
-
-namespace berry {
-
-class PreferencesTest : public berry::TestCase
-{
-public:
-
- PreferencesTest(const std::string& testName);
-
- static CppUnit::Test* Suite();
-
- void TestAll();
-
-};
-
-}
-
-#endif /* BERRYPREFERENCESTEST_H_ */
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/CMakeLists.txt b/Plugins/Testing/org.blueberry.osgi.tests/CMakeLists.txt
deleted file mode 100755
index a7a9a5798b..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-project(org_blueberry_osgi_tests)
-
-mitk_create_plugin(
- EXPORT_DIRECTIVE BERRY_OSGI_TESTS
- TEST_PLUGIN
-)
-
-target_link_libraries(${PROJECT_NAME} optimized CppUnit debug CppUnitd)
-
-MACRO_TEST_PLUGIN()
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/files.cmake b/Plugins/Testing/org.blueberry.osgi.tests/files.cmake
deleted file mode 100644
index 197cf50487..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/files.cmake
+++ /dev/null
@@ -1,31 +0,0 @@
-set(MOC_H_FILES
- src/berryOSGiCoreTestSuite.h
- src/berryPluginActivator.h
-)
-
-set(CACHED_RESOURCE_FILES
- plugin.xml
-)
-
-set(SRC_CPP_FILES
- berryMessageTest.cpp
- berryObjectTest.cpp
- berryOSGiCoreTestSuite.cpp
- berryPluginActivator.cpp
- berrySmartPointerTest.cpp
- berryWeakPointerTest.cpp
-)
-
-set(INTERNAL_CPP_FILES
-
-)
-
-set(CPP_FILES )
-
-foreach(file ${SRC_CPP_FILES})
- set(CPP_FILES ${CPP_FILES} src/${file})
-endforeach(file ${SRC_CPP_FILES})
-
-foreach(file ${INTERNAL_CPP_FILES})
- set(CPP_FILES ${CPP_FILES} src/internal/${file})
-endforeach(file ${INTERNAL_CPP_FILES})
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/manifest_headers.cmake b/Plugins/Testing/org.blueberry.osgi.tests/manifest_headers.cmake
deleted file mode 100644
index b4779358f4..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/manifest_headers.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-set(Plugin-Name "OSGi Test Bundle")
-set(Plugin-Version "0.9")
-set(Plugin-Vendor "German Cancer Research Center (DKFZ)")
-set(Plugin-ContactAddress "http://www.mitk.org")
-set(Require-Plugin org.blueberry.test)
-
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/plugin.xml b/Plugins/Testing/org.blueberry.osgi.tests/plugin.xml
deleted file mode 100644
index a866ea07e1..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/plugin.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/src/berryMessageTest.cpp b/Plugins/Testing/org.blueberry.osgi.tests/src/berryMessageTest.cpp
deleted file mode 100755
index f0cdb6ac21..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/src/berryMessageTest.cpp
+++ /dev/null
@@ -1,327 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include "berryMessageTest.h"
-
-#include
-//#include
-
-#include
-#include
-
-namespace berry
-{
-
-struct MessageReceiver
-{
- bool received;
-
- MessageReceiver() : received(false) {}
-
- void PureSignal() { received = true; }
- bool PureSignalWithReturn() { received = true; return received; }
-
- void Message1(int i) { received = (i != 0); }
- bool Message1WithReturn(int i) { received = (i != 0); return received; }
-
- void Message2(int i, float d) { received = (i != 0 && d != 0); }
- bool Message2WithReturn(int i, float d) { received = (i != 0 && d!= 0); return received; }
-
- void Message3(int i, float d, double e) { received = (i != 0 && d != 0 && e != 0); }
- bool Message3WithReturn(int i, float d, double e) { received = (i != 0 && d != 0 && e != 0); return received; }
-
- void Message4(int i, float d, double e, bool b) { received = (i != 0 && d != 0 && e != 0 && b); }
- bool Message4WithReturn(int i, float d, double e, bool b) { received = (i != 0 && d != 0 && e != 0 && b); return received; }
-
-};
-
-MessageTest::MessageTest(const std::string& testName)
-: TestCase(testName)
-{
-
-}
-
-CppUnit::Test* MessageTest::Suite()
-{
- CppUnit::TestSuite* suite = new CppUnit::TestSuite("MessageTest");
-
- CppUnit_addTest(suite, MessageTest, TestMessage);
- CppUnit_addTest(suite, MessageTest, TestMessageWithReturn);
- CppUnit_addTest(suite, MessageTest, TestMessage1);
- CppUnit_addTest(suite, MessageTest, TestMessage1WithReturn);
- CppUnit_addTest(suite, MessageTest, TestMessage2);
- CppUnit_addTest(suite, MessageTest, TestMessage2WithReturn);
- CppUnit_addTest(suite, MessageTest, TestMessage3);
- CppUnit_addTest(suite, MessageTest, TestMessage3WithReturn);
- CppUnit_addTest(suite, MessageTest, TestMessage4);
- CppUnit_addTest(suite, MessageTest, TestMessage4WithReturn);
-
- return suite;
-}
-
- void MessageTest::TestMessage()
- {
- berry::Message<> msg;
-
- MessageReceiver receiver;
- MessageReceiver receiver2;
-
- typedef berry::MessageDelegate Delegate;
-
- msg += Delegate(&receiver, &MessageReceiver::PureSignal);
- assertEqual(1, (long)msg.GetListeners().size());
- msg += Delegate(&receiver2, &MessageReceiver::PureSignal);
- // duplicate entry
- msg += Delegate(&receiver, &MessageReceiver::PureSignal);
- assertEqual(2, (long)msg.GetListeners().size());
-
- msg.Send();
- assert(receiver.received && receiver2.received);
-
- receiver.received = false;
- receiver2.received = false;
- msg -= Delegate(&receiver, &MessageReceiver::PureSignal);
- assertEqual(1, (long)msg.GetListeners().size());
-
- msg.Send();
- assert(receiver.received == false && receiver2.received);
- }
-
- void MessageTest::TestMessageWithReturn()
- {
- berry::Message msg;
-
- MessageReceiver receiver;
- typedef berry::MessageDelegate Delegate;
- msg += Delegate(&receiver, &MessageReceiver::PureSignalWithReturn);
- msg();
- assert(receiver.received);
-
- receiver.received = false;
- typedef berry::Message::ListenerList Listeners;
- const Listeners& listeners = msg.GetListeners();
- bool valueReturned = false;
- for (Listeners::const_iterator iter = listeners.begin();
- iter != listeners.end(); ++iter)
- {
- valueReturned = (*iter)->Execute();
- if (valueReturned) break;
- }
- assert(valueReturned);
- }
-
- void MessageTest::TestMessage1()
- {
- berry::Message1 msg;
-
- MessageReceiver receiver;
- MessageReceiver receiver2;
-
- typedef berry::MessageDelegate1 Delegate;
-
- msg += Delegate(&receiver, &MessageReceiver::Message1);
- assertEqual(1, (long)msg.GetListeners().size());
- msg += Delegate(&receiver2, &MessageReceiver::Message1);
- // duplicate entry
- msg += Delegate(&receiver, &MessageReceiver::Message1);
- assertEqual(2, (long)msg.GetListeners().size());
-
- msg.Send(1);
- assert(receiver.received && receiver2.received);
-
- receiver.received = false;
- receiver2.received = false;
- msg -= Delegate(&receiver, &MessageReceiver::Message1);
- assertEqual(1, (long)msg.GetListeners().size());
-
- msg.Send(1);
- assert(receiver.received == false && receiver2.received);
- }
-
- void MessageTest::TestMessage1WithReturn()
- {
- berry::Message1 msg;
-
- MessageReceiver receiver;
- typedef berry::MessageDelegate1 Delegate;
- msg += Delegate(&receiver, &MessageReceiver::Message1WithReturn);
- msg(1);
- assert(receiver.received);
-
- receiver.received = false;
- typedef berry::Message1::ListenerList Listeners;
- const Listeners& listeners = msg.GetListeners();
- bool valueReturned = false;
- for (Listeners::const_iterator iter = listeners.begin();
- iter != listeners.end(); ++iter)
- {
- valueReturned = (*iter)->Execute(1);
- if (valueReturned) break;
- }
- assert(valueReturned);
- }
-
- void MessageTest::TestMessage2()
- {
- berry::Message2 msg;
-
- MessageReceiver receiver;
- MessageReceiver receiver2;
-
- typedef berry::MessageDelegate2 Delegate;
-
- msg += Delegate(&receiver, &MessageReceiver::Message2);
- assertEqual(1, (long)msg.GetListeners().size());
- msg += Delegate(&receiver2, &MessageReceiver::Message2);
- // duplicate entry
- msg += Delegate(&receiver, &MessageReceiver::Message2);
- assertEqual(2, (long)msg.GetListeners().size());
-
- msg.Send(1, 1.0);
- assert(receiver.received && receiver2.received);
-
- receiver.received = false;
- receiver2.received = false;
- msg -= Delegate(&receiver, &MessageReceiver::Message2);
- assertEqual(1, (long)msg.GetListeners().size());
-
- msg.Send(1, 1.0);
- assert(receiver.received == false && receiver2.received);
- }
-
- void MessageTest::TestMessage2WithReturn()
- {
- berry::Message2 msg;
-
- MessageReceiver receiver;
- typedef berry::MessageDelegate2 Delegate;
- msg += Delegate(&receiver, &MessageReceiver::Message2WithReturn);
- msg(1, 2);
- assert(receiver.received);
-
- receiver.received = false;
- typedef berry::Message2::ListenerList Listeners;
- const Listeners& listeners = msg.GetListeners();
- bool valueReturned = false;
- for (Listeners::const_iterator iter = listeners.begin();
- iter != listeners.end(); ++iter)
- {
- valueReturned = (*iter)->Execute(1, 0.4f);
- if (valueReturned) break;
- }
- assert(valueReturned);
- }
-
- void MessageTest::TestMessage3()
- {
- berry::Message3 msg;
-
- MessageReceiver receiver;
- MessageReceiver receiver2;
-
- typedef berry::MessageDelegate3 Delegate;
-
- msg += Delegate(&receiver, &MessageReceiver::Message3);
- assertEqual(1, (long)msg.GetListeners().size());
- msg += Delegate(&receiver2, &MessageReceiver::Message3);
- // duplicate entry
- msg += Delegate(&receiver, &MessageReceiver::Message3);
- assertEqual(2, (long)msg.GetListeners().size());
-
- msg.Send(1, 1.0, 2.0);
- assert(receiver.received && receiver2.received);
-
- receiver.received = false;
- receiver2.received = false;
- msg -= Delegate(&receiver, &MessageReceiver::Message3);
- assertEqual(1, (long)msg.GetListeners().size());
-
- msg.Send(1, -1.0, 5.0);
- assert(receiver.received == false && receiver2.received);
- }
-
- void MessageTest::TestMessage3WithReturn()
- {
- berry::Message3 msg;
-
- MessageReceiver receiver;
- typedef berry::MessageDelegate3 Delegate;
- msg += Delegate(&receiver, &MessageReceiver::Message3WithReturn);
- msg(1, -2, 0.2);
- assert(receiver.received);
-
- receiver.received = false;
- typedef berry::Message3::ListenerList Listeners;
- const Listeners& listeners = msg.GetListeners();
- bool valueReturned = false;
- for (Listeners::const_iterator iter = listeners.begin();
- iter != listeners.end(); ++iter)
- {
- valueReturned = (*iter)->Execute(1, 23.5, -12.2);
- if (valueReturned) break;
- }
- assert(valueReturned);
- }
-
- void MessageTest::TestMessage4()
- {
- berry::Message4 msg;
-
- MessageReceiver receiver;
- MessageReceiver receiver2;
-
- typedef berry::MessageDelegate4 Delegate;
-
- msg += Delegate(&receiver, &MessageReceiver::Message4);
- assertEqual(1, (long)msg.GetListeners().size());
- msg += Delegate(&receiver2, &MessageReceiver::Message4);
- // duplicate entry
- msg += Delegate(&receiver, &MessageReceiver::Message4);
- assertEqual(2, (long)msg.GetListeners().size());
-
- msg.Send(1, 5.4f, -1.0f, true);
- assert(receiver.received && receiver2.received);
-
- receiver.received = false;
- receiver2.received = false;
- msg -= Delegate(&receiver, &MessageReceiver::Message4);
- assertEqual(1, (long)msg.GetListeners().size());
-
- msg.Send(1, 0.2f, 12.0f, true);
- assert(receiver.received == false && receiver2.received);
- }
-
- void MessageTest::TestMessage4WithReturn()
- {
- berry::Message4 msg;
-
- MessageReceiver receiver;
- typedef berry::MessageDelegate4 Delegate;
- msg += Delegate(&receiver, &MessageReceiver::Message4WithReturn);
- msg(1, 4.1f, -1, true);
- assert(receiver.received);
-
- receiver.received = false;
- typedef berry::Message4::ListenerList Listeners;
- const Listeners& listeners = msg.GetListeners();
- bool valueReturned = false;
- for (Listeners::const_iterator iter = listeners.begin();
- iter != listeners.end(); ++iter)
- {
- valueReturned = (*iter)->Execute(1, -34.21f, 2, true);
- if (valueReturned) break;
- }
- assert(valueReturned);
- }
-
-
-}
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/src/berryMessageTest.h b/Plugins/Testing/org.blueberry.osgi.tests/src/berryMessageTest.h
deleted file mode 100644
index 9ef394df41..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/src/berryMessageTest.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#ifndef BERRYMESSAGETEST_H_
-#define BERRYMESSAGETEST_H_
-
-#include
-
-namespace berry {
-
-class MessageTest : public TestCase {
-
-public:
-
- MessageTest(const std::string& testName);
-
- static CppUnit::Test* Suite();
-
- void TestMessage();
- void TestMessageWithReturn();
- void TestMessage1();
- void TestMessage1WithReturn();
- void TestMessage2();
- void TestMessage2WithReturn();
- void TestMessage3();
- void TestMessage3WithReturn();
- void TestMessage4();
- void TestMessage4WithReturn();
-
-};
-
-}
-
-#endif /* BERRYMESSAGETEST_H_ */
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/src/berryOSGiCoreTestSuite.cpp b/Plugins/Testing/org.blueberry.osgi.tests/src/berryOSGiCoreTestSuite.cpp
deleted file mode 100644
index 5b9c1cfea5..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/src/berryOSGiCoreTestSuite.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#include
-#include
-#include
-
-#include "berryOSGiCoreTestSuite.h"
-
-#include "berryObjectTest.h"
-#include "berrySmartPointerTest.h"
-#include "berryWeakPointerTest.h"
-#include "berryMessageTest.h"
-
-namespace berry {
-
-OSGiCoreTestSuite::OSGiCoreTestSuite()
-: CppUnit::TestSuite("OSGiCoreTestSuite")
-{
- addTest(ObjectTest::Suite());
- addTest(SmartPointerTest::Suite());
- addTest(WeakPointerTest::Suite());
- addTest(MessageTest::Suite());
-}
-
-OSGiCoreTestSuite::OSGiCoreTestSuite(const OSGiCoreTestSuite& other)
-{
- Q_UNUSED(other)
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/src/berryOSGiCoreTestSuite.h b/Plugins/Testing/org.blueberry.osgi.tests/src/berryOSGiCoreTestSuite.h
deleted file mode 100644
index fe203aaf5c..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/src/berryOSGiCoreTestSuite.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#ifndef BERRYOSGICORETESTSUITE_H_
-#define BERRYOSGICORETESTSUITE_H_
-
-#include
-
-#include
-
-Q_DECLARE_INTERFACE(CppUnit::Test, "CppUnit.Test")
-
-namespace berry {
-
-class OSGiCoreTestSuite : public QObject, public CppUnit::TestSuite
-{
- Q_OBJECT
- Q_INTERFACES(CppUnit::Test)
-
-public:
-
- OSGiCoreTestSuite();
- OSGiCoreTestSuite(const OSGiCoreTestSuite& other);
-};
-
-}
-
-#endif /* BERRYOSGICORETESTSUITE_H_ */
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/src/berryObjectTest.cpp b/Plugins/Testing/org.blueberry.osgi.tests/src/berryObjectTest.cpp
deleted file mode 100755
index 4c9e0402d4..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/src/berryObjectTest.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include "berryObjectTest.h"
-
-#include
-#include
-#include
-//#include
-
-namespace berry
-{
-
-class TestObject: public Object
-{
-public:
- TestObject() :
- Object()
- {
- }
-};
-
-/**
- * used for listening to destroy events
- */
-struct ObjectListener
-{
- bool m_ObjectDeleted;
-
- ObjectListener() :
- m_ObjectDeleted(false)
- {
-
- }
-
- void DestroyListener()
- {
- m_ObjectDeleted = true;
- }
-
-};
-
-CppUnit::Test* ObjectTest::Suite()
-{
- CppUnit::TestSuite* suite = new CppUnit::TestSuite("ObjectTest");
-
- CppUnit_addTest(suite, ObjectTest, TestReferenceCount);
- CppUnit_addTest(suite, ObjectTest, TestAddDestroyListener);
- CppUnit_addTest(suite, ObjectTest, TestRemoveDestroyListener);
-
- return suite;
-}
-
-ObjectTest::ObjectTest(const std::string& testName) :
- TestCase(testName)
-{
-
-}
-
-void ObjectTest::TestReferenceCount()
-{
- TestObject* obj = new TestObject();
- assertEqual(obj->GetReferenceCount(), 0);
-
- obj->Register();
- assertEqual(obj->GetReferenceCount(), 1);
-
- obj->SetReferenceCount(3);
- assertEqual(obj->GetReferenceCount(), 3);
-
- obj->SetReferenceCount(0);
-}
-
-void ObjectTest::TestAddDestroyListener()
-{
- TestObject* obj = new TestObject();
-
- ObjectListener objectListener;
-
- obj->AddDestroyListener(berry::MessageDelegate(
- &objectListener, &ObjectListener::DestroyListener));
- delete obj;
- assertEqual(true, objectListener.m_ObjectDeleted);
-}
-
-void ObjectTest::TestRemoveDestroyListener()
-{
- TestObject* obj = new TestObject();
-
- ObjectListener objectListener;
-
- obj->AddDestroyListener(berry::MessageDelegate(
- &objectListener, &ObjectListener::DestroyListener));
- obj->RemoveDestroyListener(berry::MessageDelegate(
- &objectListener, &ObjectListener::DestroyListener));
- delete obj;
- assertEqual(false, objectListener.m_ObjectDeleted);
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/src/berryObjectTest.h b/Plugins/Testing/org.blueberry.osgi.tests/src/berryObjectTest.h
deleted file mode 100644
index 78cdd44d83..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/src/berryObjectTest.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#ifndef BERRYOBJECTTEST_H_
-#define BERRYOBJECTTEST_H_
-
-#include
-
-namespace berry {
-
-class ObjectTest : public TestCase
-{
-public:
-
- static CppUnit::Test* Suite();
-
- ObjectTest(const std::string& testName);
-
- void TestReferenceCount();
- void TestAddDestroyListener();
- void TestRemoveDestroyListener();
-};
-
-}
-
-#endif /* BERRYOBJECTTEST_H_ */
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/src/berryPluginActivator.cpp b/Plugins/Testing/org.blueberry.osgi.tests/src/berryPluginActivator.cpp
deleted file mode 100644
index 56bfcaf1fb..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/src/berryPluginActivator.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include
-#include "berryPluginActivator.h"
-#include "berryOSGiCoreTestSuite.h"
-
-namespace berry {
-
-void org_blueberry_osgi_tests_Activator::start(ctkPluginContext* context)
-{
- Q_UNUSED(context)
-
- BERRY_REGISTER_EXTENSION_CLASS(OSGiCoreTestSuite, context)
-}
-
-void org_blueberry_osgi_tests_Activator::stop(ctkPluginContext* context)
-{
- Q_UNUSED(context)
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/src/berryPluginActivator.h b/Plugins/Testing/org.blueberry.osgi.tests/src/berryPluginActivator.h
deleted file mode 100644
index ff480c83e5..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/src/berryPluginActivator.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#ifndef BERRYPLUGINACTIVATOR_H
-#define BERRYPLUGINACTIVATOR_H
-
-#include
-#include
-
-namespace berry {
-
-class org_blueberry_osgi_tests_Activator :
- public QObject, public ctkPluginActivator
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org_blueberry_osgi_tests")
- Q_INTERFACES(ctkPluginActivator)
-
-public:
-
- void start(ctkPluginContext* context);
- void stop(ctkPluginContext* context);
-
-};
-
-typedef org_blueberry_osgi_tests_Activator PluginActivator;
-
-}
-
-#endif // BERRYPLUGINACTIVATOR_H
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/src/berrySmartPointerTest.cpp b/Plugins/Testing/org.blueberry.osgi.tests/src/berrySmartPointerTest.cpp
deleted file mode 100755
index 7db7b57055..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/src/berrySmartPointerTest.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#include "berrySmartPointerTest.h"
-
-#include
-#include
-
-#include
-#include
-#include
-
-#include
-//#include
-
-namespace berry
-{
-
-class TestObject : public berry::Object
-{
-public:
- TestObject() : Object(), m_Val(0) {}
- TestObject(int value) : m_Val(value) {}
-
- bool operator==(const Object* o) const
- {
- if (const TestObject* to = dynamic_cast(o))
- return m_Val == to->m_Val;
-
- return false;
- }
-
-private:
-
- int m_Val;
-};
-
-
-SmartPointerTest::SmartPointerTest(const std::string& testName)
-: TestCase(testName)
-{}
-
-CppUnit::Test* SmartPointerTest::Suite()
-{
- CppUnit::TestSuite* suite = new CppUnit::TestSuite("SmartPointerTest");
-
- CppUnit_addTest(suite, SmartPointerTest, TestConstructors);
- CppUnit_addTest(suite, SmartPointerTest, TestCasting);
- CppUnit_addTest(suite, SmartPointerTest, TestReferenceCounting);
- CppUnit_addTest(suite, SmartPointerTest, TestOperators);
-
- return suite;
-}
-
-
- void SmartPointerTest::TestConstructors()
- {
- {
- // standard constructor
- berry::SmartPointer testobj;
- assertNullPtr(testobj.GetPointer());
- }
-
-
- {
- // standard pointer constructor
- berry::SmartPointer testobj(new TestObject());
- assertNotNullPtr(testobj.GetPointer());
- assertEqual(1, testobj->GetReferenceCount());
-
- // copy constructor
- berry::SmartPointer testobj2 = testobj;
- assertEqual(testobj.GetPointer(), testobj2.GetPointer());
- assertEqual(2, testobj2->GetReferenceCount());
- }
-
- {
- // WeakPointer constructor
- berry::WeakPointer ptr_weak;
- try {
- berry::SmartPointer testobj(ptr_weak);
- failmsg("this should throw a BadWeakPointerException");
- }
- catch (BadWeakPointerException )
- {
- // expected
- }
- }
-
- {
- // const_cast template constructor
- berry::SmartPointer testobj(new TestObject());
- berry::SmartPointer obj(testobj);
- assertNotNullPtr(obj.GetPointer());
- assertEqual(2, obj->GetReferenceCount());
- assert(typeid(*(obj.GetPointer())) == typeid(TestObject));
- }
- }
-
- void SmartPointerTest::TestCasting()
- // cast tests
- {
- berry::SmartPointer obj(new TestObject());
- assertNotNullPtr(obj.GetPointer());
- assertEqual(1, obj->GetReferenceCount());
-
- berry::SmartPointer testobj = obj.Cast();
- assertNotNullPtr(testobj.GetPointer());
- assertEqual(2, testobj->GetReferenceCount());
- assertEqual(testobj.GetPointer(), obj.GetPointer());
- }
-
- void SmartPointerTest::TestReferenceCounting()
- // reference count tests
- {
- berry::SmartPointer obj(new TestObject());
- {
- berry::SmartPointer tmpobj = obj;
- }
- assertEqual(1, obj->GetReferenceCount());
- }
-
- void SmartPointerTest::TestOperators()
- {
- // operator tests
- {
- berry::SmartPointer obj(new TestObject(1));
- berry::SmartPointer testobj(new TestObject(2));
- berry::SmartPointer nullobj;
-
- // boolean conversions
- assert(obj.IsNotNull());
- assert(false == obj.IsNull());
- assert(obj);
- assert(false == !obj);
-
- // != operators
- assert(obj != 0);
-
- try
- {
- obj != 1;
- failmsg("should throw a std::invalid_argument exception");
- }
- catch (std::invalid_argument)
- { //expectted }
-
- }
-
- // operator!=(R)
- assert(obj != testobj.GetPointer());
-
- // operator!=(const berry::SmartPointer&)
- assert(obj != testobj);
-
- // == operators
- // operator==(int)
- assert((obj == 0) == false);
- try {
- obj == 1;
- failmsg("should throw a std::invalid_argument exception");
- }
- catch (std::invalid_argument)
- { // expected }
-
- }
- // operator==(R)
- assert((obj == testobj.GetPointer()) == false);
- // operator==(R)
- assert(obj == obj.GetPointer());
- // operator==(R)
- assert((obj == nullobj.GetPointer()) == false);
- // operator==(const berry::SmartPointer&)
- assert((obj == testobj) == false);
- // operator==(const berry::SmartPointer&)
- assert(obj == obj);
- // operator==(const berry::SmartPointer&)
- assert((obj == nullobj) == false);
- }
-
- {
- // = operators
- berry::SmartPointer obj(new TestObject(1));
- berry::SmartPointer testobj(new TestObject(2));
-
- obj = testobj;
- // operator=(const berry::SmartPointer&)
- assert(obj == testobj);
- assertEqual(2, obj->GetReferenceCount());
-
- // operator=(Object*)
- obj = testobj.GetPointer();
- assert(obj == testobj);
- assertEqual(2, obj->GetReferenceCount());
- }
-
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/src/berrySmartPointerTest.h b/Plugins/Testing/org.blueberry.osgi.tests/src/berrySmartPointerTest.h
deleted file mode 100644
index a31b1def1c..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/src/berrySmartPointerTest.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#ifndef BERRYSMARTPOINTERTEST_H_
-#define BERRYSMARTPOINTERTEST_H_
-
-#include
-
-namespace berry {
-
-class SmartPointerTest : public TestCase
-{
-public:
-
- SmartPointerTest(const std::string& testName);
-
- static CppUnit::Test* Suite();
-
- void TestConstructors();
- void TestCasting();
- void TestReferenceCounting();
- void TestOperators();
-
-};
-
-}
-
-#endif /* BERRYSMARTPOINTERTEST_H_ */
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/src/berryWeakPointerTest.cpp b/Plugins/Testing/org.blueberry.osgi.tests/src/berryWeakPointerTest.cpp
deleted file mode 100644
index 095cb240ba..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/src/berryWeakPointerTest.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include
-#include
-#include
-#include
-//#include
-
-#include "berryWeakPointerTest.h"
-
-#include
-#include
-
-namespace berry
-{
-
-struct TestObject: public Object
-{
-
- /** creating a test object in order to test the weakpointer functions */
-
- TestObject()
- { }
-
-};
-
-WeakPointerTest::WeakPointerTest(const std::string& testName) :
- TestCase(testName)
-{
-
-}
-
-CppUnit::Test* WeakPointerTest::Suite()
-{
- CppUnit::TestSuite* suite = new CppUnit::TestSuite("WeakPointerTest");
-
- CppUnit_addTest(suite, WeakPointerTest, TestReferenceCounting);
- CppUnit_addTest(suite, WeakPointerTest, TestConstructorAndLock);
- CppUnit_addTest(suite, WeakPointerTest, TestOperators);
-
- return suite;
-}
-
-void WeakPointerTest::TestReferenceCounting()
-{
-
- SmartPointer ptr_smart(new TestObject());
-
- WeakPointer ptr_weak(ptr_smart);
- assertEqual(1, ptr_smart->GetReferenceCount());
-
- /* Testing the Object reference counter after returning a smartpointer
- * to an object, Reference counter should be increased to 2 */
- SmartPointer ptr_smart2(ptr_weak);
- assertEqual(2, ptr_smart->GetReferenceCount());
-}
-
-void WeakPointerTest::TestConstructorAndLock()
-{
- SmartPointer* ptr_smart = new SmartPointer (
- new TestObject);
- WeakPointer ptr_weak(*ptr_smart);
- WeakPointer ptr_weak2(ptr_weak);
- {
- SmartPointer ptr_smart1(ptr_weak);
- SmartPointer ptr_smart2(ptr_weak2);
- assertEqual(ptr_smart1.GetPointer(), ptr_smart2.GetPointer());
- }
- assertEqual(1, (*ptr_smart)->GetReferenceCount());
- delete ptr_smart;
- assert(ptr_weak2.Lock() == 0);
-}
-
-void WeakPointerTest::TestOperators()
-{
- SmartPointer ptr_smart(new TestObject);
- SmartPointer ptr_smart2(new TestObject);
- {
- WeakPointer ptr_weak(ptr_smart);
- WeakPointer ptr_weak2(ptr_smart2);
- ptr_weak = ptr_weak2;
- SmartPointer ptr_smart3(ptr_weak2);
- SmartPointer ptr_smart4(ptr_weak);
- assertEqual(ptr_smart3.GetPointer(), ptr_smart4.GetPointer());
- }
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.osgi.tests/src/berryWeakPointerTest.h b/Plugins/Testing/org.blueberry.osgi.tests/src/berryWeakPointerTest.h
deleted file mode 100644
index 49999b0e39..0000000000
--- a/Plugins/Testing/org.blueberry.osgi.tests/src/berryWeakPointerTest.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#ifndef BERRYWEAKPOINTERTEST_H_
-#define BERRYWEAKPOINTERTEST_H_
-
-#include
-
-namespace berry {
-
-class WeakPointerTest : public TestCase
-{
-public:
-
- WeakPointerTest(const std::string& testName);
-
- static CppUnit::Test* Suite();
-
- void TestReferenceCounting();
- void TestConstructorAndLock();
- void TestOperators();
-};
-
-}
-
-#endif /* BERRYWEAKPOINTERTEST_H_ */
diff --git a/Plugins/Testing/org.blueberry.ui.tests/CMakeLists.txt b/Plugins/Testing/org.blueberry.ui.tests/CMakeLists.txt
deleted file mode 100644
index f57bb14965..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-project(org_blueberry_ui_tests)
-
-mitk_create_plugin(
- EXPORT_DIRECTIVE BERRY_UI_TESTS
- TEST_PLUGIN
-)
-
-target_link_libraries(${PROJECT_NAME} optimized CppUnit debug CppUnitd)
-
-add_dependencies(${PROJECT_NAME} org_blueberry_ui_qt)
-
-MACRO_TEST_UIPLUGIN()
diff --git a/Plugins/Testing/org.blueberry.ui.tests/documentation/doxygen/modules.dox b/Plugins/Testing/org.blueberry.ui.tests/documentation/doxygen/modules.dox
deleted file mode 100644
index 8cbf496b3a..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/documentation/doxygen/modules.dox
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- \defgroup org_blueberry_ui_tests org.blueberry.ui.tests
- \ingroup BlueBerryPlugins
-
- \brief Describe your plugin here.
-
-*/
-
-/**
- \defgroup org_blueberry_ui_tests_internal Internal
- \ingroup org_blueberry_ui_tests
-
- \brief This subcategory includes the internal classes of the org.blueberry.ui.tests plugin. Other
- plugins must not rely on these classes. They contain implementation details and their interface
- may change at any time. We mean it.
-*/
diff --git a/Plugins/Testing/org.blueberry.ui.tests/files.cmake b/Plugins/Testing/org.blueberry.ui.tests/files.cmake
deleted file mode 100644
index 2bc694a110..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/files.cmake
+++ /dev/null
@@ -1,45 +0,0 @@
-set(MOC_H_FILES
- src/berryPluginActivator.h
- src/berryUiTestSuite.h
-
- src/api/berryMockViewPart.h
- src/api/berrySaveableMockViewPart.h
-)
-
-set(CACHED_RESOURCE_FILES
- plugin.xml
- icons/view.gif
-)
-
-set(SRC_CPP_FILES
-
- berryPluginActivator.cpp
- berryUiTestSuite.cpp
-
- # API Tests
- api/berryIPageLayoutTest.cpp
- api/berryIViewPartTest.cpp
- api/berryIWorkbenchPartTest.cpp
- api/berryMockSelectionProvider.cpp
- api/berryMockViewPart.cpp
- api/berryMockWorkbenchPart.cpp
- api/berrySaveableMockViewPart.cpp
- api/berryUiApiTestSuite.cpp
- api/berryXMLMementoTest.cpp
-
-)
-
-set(INTERNAL_CPP_FILES
-
-)
-
-set(CPP_FILES )
-
-foreach(file ${SRC_CPP_FILES})
- set(CPP_FILES ${CPP_FILES} src/${file})
-endforeach(file ${SRC_CPP_FILES})
-
-foreach(file ${INTERNAL_CPP_FILES})
- set(CPP_FILES ${CPP_FILES} src/internal/${file})
-endforeach(file ${INTERNAL_CPP_FILES})
-
diff --git a/Plugins/Testing/org.blueberry.ui.tests/icons/view.gif b/Plugins/Testing/org.blueberry.ui.tests/icons/view.gif
deleted file mode 100755
index efc77a7f75..0000000000
Binary files a/Plugins/Testing/org.blueberry.ui.tests/icons/view.gif and /dev/null differ
diff --git a/Plugins/Testing/org.blueberry.ui.tests/manifest_headers.cmake b/Plugins/Testing/org.blueberry.ui.tests/manifest_headers.cmake
deleted file mode 100644
index a62f14f395..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/manifest_headers.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-set(Plugin-Name "UI Automated Tests")
-set(Plugin-Version "0.9")
-set(Plugin-Vendor "German Cancer Research Center (DKFZ)")
-set(Plugin-ContactAddress "http://www.mitk.org")
-set(Require-Plugin org.blueberry.uitest)
-
diff --git a/Plugins/Testing/org.blueberry.ui.tests/plugin.xml b/Plugins/Testing/org.blueberry.ui.tests/plugin.xml
deleted file mode 100644
index d3902f6dfc..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/plugin.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIPageLayoutTest.cpp b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIPageLayoutTest.cpp
deleted file mode 100644
index f7ab8f4ee7..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIPageLayoutTest.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include "berryIPageLayoutTest.h"
-
-#include
-#include
-
-#include
-
-namespace berry
-{
-
-IPageLayoutTest::IPageLayoutTest(const std::string& testName) :
- UITestCase(testName)
-{
-
-}
-
-CppUnit::Test* IPageLayoutTest::Suite()
-{
- CppUnit::TestSuite* suite = new CppUnit::TestSuite("IPageLayoutTest");
-
- CppUnit_addTest(suite, IPageLayoutTest, TestGetDescriptor);
-
- return suite;
-}
-
-void IPageLayoutTest::TestGetDescriptor()
-{
- this->IgnoreLeakingObjects();
- //this->LeakDetailsOn();
-
- EmptyPerspective::SetLastPerspective("");
- OpenTestWindow(EmptyPerspective::PERSP_ID);
- assertEqual(EmptyPerspective::PERSP_ID, EmptyPerspective::GetLastPerspective());
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIPageLayoutTest.h b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIPageLayoutTest.h
deleted file mode 100644
index 6fb416f071..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIPageLayoutTest.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#ifndef BERRYIPAGELAYOUTTEST_H_
-#define BERRYIPAGELAYOUTTEST_H_
-
-#include
-
-#include
-
-namespace berry {
-
-/**
- * Test cases for the IPageLayout
API.
- *
- * @since 3.2
- */
-class IPageLayoutTest : public UITestCase {
-
-public:
-
- friend class CppUnit::TestCaller;
-
- IPageLayoutTest(const std::string& testName);
-
- static CppUnit::Test* Suite();
-
- void TestGetDescriptor();
-
-};
-
-}
-
-#endif /* BERRYIPAGELAYOUTTEST_H_ */
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIViewPartTest.cpp b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIViewPartTest.cpp
deleted file mode 100644
index 1ef4c88b2b..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIViewPartTest.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include "berryIViewPartTest.h"
-
-#include "berrySaveableMockViewPart.h"
-
-#include
-
-#include
-
-namespace berry
-{
-
-IViewPartTest::IViewPartTest(const std::string& testName) :
- IWorkbenchPartTest(testName)
-{
-
-}
-
-CppUnit::Test* IViewPartTest::Suite()
-{
- CppUnit::TestSuite* suite = new CppUnit::TestSuite("IViewPartTest");
-
- CppUnit_addTest(suite, IViewPartTest, TestOpenAndCloseSaveNotNeeded);
- CppUnit_addTest(suite, IViewPartTest, TestOpenAndClose);
- CppUnit_addTest(suite, IViewPartTest, TestOpenAndWindowClose);
-
- return suite;
-}
-
-void IViewPartTest::TestOpenAndCloseSaveNotNeeded()
-{
- this->IgnoreLeakingObjects();
- //this->LeakDetailsOn();
-
- CallHistory::Pointer history;
-
- {
- // Open a part.
- SaveableMockViewPart::Pointer part = fPage->ShowView(
- SaveableMockViewPart::ID).Cast ();
-
- part->SetDirty(true);
- part->SetSaveNeeded(false);
- ClosePart(fPage, part);
-
- history = part->GetCallHistory();
- }
-
- // TODO: This verifies the 3.0 disposal order. However, there may be a bug here.
- // That is, it may be necessary to change this and dispose the contribution items
- // after the view's dispose method in order to ensure that the site is never returning
- // a disposed contribution item. See bug 94457 for details.
- std::vector callOrder;
- callOrder.push_back("SetInitializationData");
- callOrder.push_back("Init");
- callOrder.push_back("CreatePartControl");
- callOrder.push_back("SetFocus");
- callOrder.push_back("IsSaveOnCloseNeeded");
- callOrder.push_back("WidgetDisposed");
- //callOrder.push_back("ToolbarContributionItemWidgetDisposed");
- //callOrder.push_back("ToolbarContributionItemDisposed");
- callOrder.push_back("PartDestructor");
- assert(history->VerifyOrder(callOrder));
- // TODO enable assert when saveable support is complete
- //assert(history->Contains("DoSave"));
-}
-
-MockWorkbenchPart::Pointer IViewPartTest::OpenPart(IWorkbenchPage::Pointer page)
-{
- return page->ShowView(MockViewPart::ID).Cast ();
-}
-
-void IViewPartTest::ClosePart(IWorkbenchPage::Pointer page,
- MockWorkbenchPart::Pointer part)
-{
- page->HideView(part.Cast ());
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIViewPartTest.h b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIViewPartTest.h
deleted file mode 100644
index d9cf70d068..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIViewPartTest.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#ifndef BERRYIVIEWPARTTEST_H_
-#define BERRYIVIEWPARTTEST_H_
-
-#include "berryIWorkbenchPartTest.h"
-
-#include
-
-namespace berry
-{
-
-/**
- * This is a test for IViewPart. Since IViewPart is an
- * interface this test verifies the IViewPart lifecycle rather
- * than the implementation.
- */
-class IViewPartTest: public IWorkbenchPartTest
-{
-
-public:
-
- friend class CppUnit::TestCaller;
-
- /**
- * Constructor for IViewPartTest
- */
- IViewPartTest(const std::string& testName);
-
- static CppUnit::Test* Suite();
-
- /**
- * Tests that the view is closed without saving if isSaveOnCloseNeeded()
- * returns false. This also tests some disposal behaviors specific to
- * views: namely, that the contribution items are disposed in the correct
- * order with respect to the disposal of the view.
- *
- * @see ISaveablePart#isSaveOnCloseNeeded()
- */
- void TestOpenAndCloseSaveNotNeeded();
-
-protected:
-
- /**
- * @see IWorkbenchPartTest#openPart(IWorkbenchPage)
- */
- MockWorkbenchPart::Pointer OpenPart(IWorkbenchPage::Pointer page);
-
- /**
- * @see IWorkbenchPartTest#closePart(IWorkbenchPage, MockWorkbenchPart)
- */
- void ClosePart(IWorkbenchPage::Pointer page, MockWorkbenchPart::Pointer part);
-
-};
-
-}
-
-#endif /* BERRYIVIEWPARTTEST_H_ */
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIWorkbenchPartTest.cpp b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIWorkbenchPartTest.cpp
deleted file mode 100644
index 691de05bb3..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIWorkbenchPartTest.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include "berryIWorkbenchPartTest.h"
-
-namespace berry
-{
-
-void IWorkbenchPartTest::DoSetUp()
-{
- UITestCase::DoSetUp();
- fWindow = OpenTestWindow();
- fPage = fWindow->GetActivePage();
-}
-
-void IWorkbenchPartTest::DoTearDown()
-{
- fPage = 0;
- fWindow = 0;
- UITestCase::DoTearDown();
-}
-
-IWorkbenchPartTest::IWorkbenchPartTest(const std::string& testName) :
- UITestCase(testName)
-{
-
-}
-
-void IWorkbenchPartTest::TestOpenAndClose()
-{
- this->IgnoreLeakingObjects();
-
- CallHistory::Pointer history;
- std::vector callOrder;
- {
- // Open a part.
- MockWorkbenchPart::Pointer part = OpenPart(fPage);
- assert(part->IsSiteInitialized());
- history = part->GetCallHistory();
-
- callOrder.push_back("SetInitializationData");
- callOrder.push_back("Init");
- callOrder.push_back("CreatePartControl");
- callOrder.push_back("SetFocus");
-
- assert(history->VerifyOrder(callOrder));
-
- // Close the part.
- ClosePart(fPage, part);
- }
-
- callOrder.push_back("WidgetDisposed");
- callOrder.push_back("PartDestructor");
- assert(history->VerifyOrder(callOrder));
-}
-
-void IWorkbenchPartTest::TestOpenAndWindowClose()
-{
- this->IgnoreLeakingObjects();
-
- CallHistory::Pointer history;
- std::vector callOrder;
- {
- // Open a new window
- IWorkbenchWindow::Pointer newWindow = OpenTestWindow();
-
- // Open a part.
- MockWorkbenchPart::Pointer part = OpenPart(newWindow->GetActivePage());
- assert(part->IsSiteInitialized());
- history = part->GetCallHistory();
-
- callOrder.push_back("SetInitializationData");
- callOrder.push_back("Init");
- callOrder.push_back("CreatePartControl");
- callOrder.push_back("SetFocus");
-
- assert(history->VerifyOrder(callOrder));
-
- // Close the window.
- newWindow->Close();
- }
-
- // The Qt widget for the window is deleted
- // asynchronously, so the "WidgetDisposed"
- // call may come after the part destructor
- //callOrder.push_back("WidgetDisposed");
- callOrder.push_back("PartDestructor");
- assert(history->VerifyOrder(callOrder));
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIWorkbenchPartTest.h b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIWorkbenchPartTest.h
deleted file mode 100644
index 5ff79c661a..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryIWorkbenchPartTest.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#ifndef BERRYIWORKBENCHPARTTEST_H_
-#define BERRYIWORKBENCHPARTTEST_H_
-
-#include
-#include
-#include
-
-#include "berryMockWorkbenchPart.h"
-
-namespace berry {
-
-/**
- * This is a test for IWorkbenchPart. Since IWorkbenchPart is an
- * interface this test verifies the IWorkbenchPart lifecycle rather
- * than the implementation.
- */
-class IWorkbenchPartTest : public UITestCase {
-
-protected:
-
- IWorkbenchWindow::Pointer fWindow;
- IWorkbenchPage::Pointer fPage;
-
- void DoSetUp();
- void DoTearDown();
-
- /**
- * Opens a part. Subclasses should override
- */
- virtual MockWorkbenchPart::Pointer OpenPart(IWorkbenchPage::Pointer page) = 0;
-
- /**
- * Closes a part. Subclasses should override
- */
- virtual void ClosePart(IWorkbenchPage::Pointer page, MockWorkbenchPart::Pointer part) = 0;
-
-public:
-
- /**
- * Constructor for IActionDelegateTest
- */
- IWorkbenchPartTest(const std::string& testName);
-
- void TestOpenAndClose();
-
- void TestOpenAndWindowClose();
-
-};
-
-}
-
-#endif /* BERRYIWORKBENCHPARTTEST_H_ */
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockSelectionProvider.cpp b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockSelectionProvider.cpp
deleted file mode 100644
index 5a15443c7e..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockSelectionProvider.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include "berryMockSelectionProvider.h"
-
-namespace berry
-{
-
-struct EmptyStructuredSelection : public IStructuredSelection
-{
-
- EmptyStructuredSelection()
- : elements(new ContainerType())
- {}
-
- Object::Pointer GetFirstElement() const
- {
- return Object::Pointer(0);
- }
-
- iterator Begin() const
- {
- return elements->begin();
- }
-
- iterator End() const
- {
- return elements->end();
- }
-
- int Size() const
- {
- return elements->size();
- }
-
- bool IsEmpty() const
- {
- return true;
- }
-
- ContainerType::Pointer ToVector() const
- {
- return elements;
- }
-
-private:
-
- ContainerType::Pointer elements;
-};
-
-MockSelectionProvider::MockSelectionProvider()
-: emptySelection(new EmptyStructuredSelection())
-{
-
-}
-
-void MockSelectionProvider::FireSelection()
-{
- SelectionChangedEvent::Pointer event(new SelectionChangedEvent(
- ISelectionProvider::Pointer(this), emptySelection));
- FireSelection(event);
-}
-
-void MockSelectionProvider::FireSelection(SelectionChangedEvent::Pointer event)
-{
- listeners.selectionChanged(event);
-}
-
-void MockSelectionProvider::AddSelectionChangedListener(
- ISelectionChangedListener::Pointer listener)
-{
- listeners.AddListener(listener);
-}
-
-ISelection::ConstPointer MockSelectionProvider::GetSelection() const
-{
- return emptySelection;
-}
-
-void MockSelectionProvider::RemoveSelectionChangedListener(
- ISelectionChangedListener::Pointer listener)
-{
- listeners.RemoveListener(listener);
-}
-
-void MockSelectionProvider::SetSelection(ISelection::Pointer /*selection*/)
-{
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockSelectionProvider.h b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockSelectionProvider.h
deleted file mode 100644
index fe1b1c4473..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockSelectionProvider.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#ifndef BERRYMOCKSELECTIONPROVIDER_H_
-#define BERRYMOCKSELECTIONPROVIDER_H_
-
-#include
-#include
-
-namespace berry
-{
-
-class MockSelectionProvider: public ISelectionProvider
-{
-
-private:
-
- ISelectionChangedListener::Events listeners;
- IStructuredSelection::Pointer emptySelection;
-
-public:
-
- berryObjectMacro(MockSelectionProvider);
-
- MockSelectionProvider();
-
- /**
- * Fires out a selection to all listeners.
- */
- void FireSelection();
-
- /**
- * Fires out a selection to all listeners.
- */
- void FireSelection(SelectionChangedEvent::Pointer event);
-
- /**
- * @see ISelectionProvider#addSelectionChangedListener(ISelectionChangedListener)
- */
- void AddSelectionChangedListener(ISelectionChangedListener::Pointer listener);
-
- /**
- * @see ISelectionProvider#getSelection()
- */
- ISelection::ConstPointer GetSelection() const;
-
- /**
- * @see ISelectionProvider#removeSelectionChangedListener(ISelectionChangedListener)
- */
- void RemoveSelectionChangedListener(
- ISelectionChangedListener::Pointer listener);
-
- /**
- * @see ISelectionProvider#setSelection(ISelection)
- */
- void SetSelection(ISelection::Pointer /*selection*/);
-};
-
-}
-
-#endif /* BERRYMOCKSELECTIONPROVIDER_H_ */
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockViewPart.cpp b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockViewPart.cpp
deleted file mode 100644
index 1e4403e480..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockViewPart.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include "berryMockViewPart.h"
-
-namespace berry
-{
-
-const std::string MockViewPart::ID = "org.blueberry.ui.tests.api.MockViewPart";
-const std::string MockViewPart::ID2 = MockViewPart::ID + "2";
-const std::string MockViewPart::ID3 = MockViewPart::ID + "3";
-const std::string MockViewPart::ID4 = MockViewPart::ID + "4";
-const std::string MockViewPart::IDMULT = MockViewPart::ID + "Mult";
-const std::string MockViewPart::NAME = "Mock View 1";
-
-MockViewPart::MockViewPart()
-{
-
-}
-
-MockViewPart::MockViewPart(const MockViewPart& other)
-{
- Q_UNUSED(other)
- throw std::runtime_error("Copy constructor not implemented");
-}
-
-IViewSite::Pointer MockViewPart::GetViewSite()
-{
- return GetSite().Cast ();
-}
-
-void MockViewPart::Init(IViewSite::Pointer site, IMemento::Pointer /*memento*/)
- throw (PartInitException)
-{
- SetSite(site);
- callTrace->Add("Init");
- SetSiteInitialized();
- //AddToolbarContributionItem();
-}
-
-void MockViewPart::CreatePartControl(void* parent)
-{
- MockWorkbenchPart::CreatePartControl(parent);
-
- // Button addAction = new Button(parent, SWT.PUSH);
- // addAction.setText("Add Action to Tool Bar");
- // addAction.addSelectionListener(new SelectionAdapter() {
- // public void widgetSelected(SelectionEvent e) {
- // IActionBars bars = getViewSite().getActionBars();
- // bars.getToolBarManager().add(new DummyAction());
- // bars.updateActionBars();
- // }
- // });
- //
- // Button removeAction = new Button(parent, SWT.PUSH);
- // removeAction.setText("Remove Action from Tool Bar");
- // removeAction.addSelectionListener(new SelectionAdapter() {
- // public void widgetSelected(SelectionEvent e) {
- // IActionBars bars = getViewSite().getActionBars();
- // IToolBarManager tbm = bars.getToolBarManager();
- // IContributionItem[] items = tbm.getItems();
- // if (items.length > 0) {
- // IContributionItem item = items[items.length-1];
- // if (item instanceof ActionContributionItem) {
- // if (((ActionContributionItem) item).getAction() instanceof DummyAction) {
- // tbm.remove(item);
- // bars.updateActionBars();
- // }
- // }
- // }
- // }
- // });
-}
-
-MockViewPart::~MockViewPart()
-{
- // // Test for bug 94457: The contribution items must still be in the toolbar manager at the
- // // time the part is disposed. (Changing this behavior would be a breaking change for some
- // // clients).
- // Assert.assertTrue(
- // "Contribution items should not be removed from the site until after the part is disposed",
- // getViewSite().getActionBars().getToolBarManager().find(
- // toolbarItem.getId()) == toolbarItem);
-}
-
-void MockViewPart::ToolbarContributionItemWidgetDisposed()
-{
- callTrace->Add("ToolbarContributionItemWidgetDisposed");
-}
-
-void MockViewPart::ToolbarContributionItemDisposed()
-{
- callTrace->Add("ToolbarContributionItemDisposed");
-}
-
-void MockViewPart::SaveState(IMemento::Pointer /*memento*/)
-{
- // do nothing
-}
-
-IWorkbenchPartSite::Pointer MockViewPart::GetSite() const
-{
- return MockWorkbenchPart::GetSite();
-}
-
-std::string MockViewPart::GetPartName() const
-{
- return MockWorkbenchPart::GetPartName();
-}
-
-std::string MockViewPart::GetContentDescription() const
-{
- return MockWorkbenchPart::GetContentDescription();
-}
-
-std::string MockViewPart::GetTitleToolTip() const
-{
- return MockWorkbenchPart::GetTitleToolTip();
-}
-
-std::string MockViewPart::GetPartProperty(const std::string& key) const
-{
- return MockWorkbenchPart::GetPartProperty(key);
-}
-
-void MockViewPart::SetPartProperty(const std::string& key,
- const std::string& value)
-{
- MockWorkbenchPart::SetPartProperty(key, value);
-}
-
-const std::map& MockViewPart::GetPartProperties() const
-{
- return MockWorkbenchPart::GetPartProperties();
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockViewPart.h b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockViewPart.h
deleted file mode 100644
index 5067f2e3ad..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockViewPart.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#ifndef BERRYMOCKVIEWPART_H_
-#define BERRYMOCKVIEWPART_H_
-
-#include "berryMockWorkbenchPart.h"
-
-#include
-#include
-
-
-namespace berry
-{
-
-class MockViewPart: public QObject, public MockWorkbenchPart, public IViewPart
-{
- Q_OBJECT
- Q_INTERFACES(berry::IExecutableExtension berry::IViewPart)
-
-public:
-
- berryObjectMacro(MockViewPart);
-
- static const std::string ID; // = "org.blueberry.ui.tests.api.MockViewPart";
- static const std::string ID2; // = ID + "2";
- static const std::string ID3; // = ID + "3";
- static const std::string ID4; // = ID + "4";
- static const std::string IDMULT; // = ID + "Mult";
- static const std::string NAME; // = "Mock View 1";
-
- MockViewPart();
- MockViewPart(const MockViewPart& other);
-
- /**
- * @see IViewPart#getViewSite()
- */
- IViewSite::Pointer GetViewSite();
-
- /**
- * @see IViewPart#Init(IViewSite, IMemento)
- */
- void Init(IViewSite::Pointer site, IMemento::Pointer /*memento*/)
- throw (PartInitException);
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.tests.api.MockWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- void CreatePartControl(void* parent);
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.tests.api.MockPart#dispose()
- */
- ~MockViewPart();
-
- void ToolbarContributionItemWidgetDisposed();
-
- void ToolbarContributionItemDisposed();
-
- /**
- * @see IViewPart#saveState(IMemento)
- */
- void SaveState(IMemento::Pointer /*memento*/);
-
- /**
- * @see IWorkbenchPart#GetSite()
- */
- IWorkbenchPartSite::Pointer GetSite() const;
-
- /**
- * @see IWorkbenchPart#GetTitle()
- */
- std::string GetPartName() const;
-
- std::string GetContentDescription() const;
-
- /**
- * @see IWorkbenchPart#GetTitleToolTip()
- */
- std::string GetTitleToolTip() const;
-
- std::string GetPartProperty(const std::string& key) const;
-
- void SetPartProperty(const std::string& key, const std::string& value);
-
- const std::map& GetPartProperties() const;
-
-private:
-
- // ContributionItem toolbarItem = new ContributionItem("someId") {
- //
- // private DisposeListener disposeListener = new DisposeListener() {
- // public void widgetDisposed(DisposeEvent e) {
- // toolbarContributionItemWidgetDisposed();
- // }
- //
- // public void fill(ToolBar parent, int index) {
- // super.fill(parent, index);
- //
- // ToolItem item = new ToolItem(parent, index);
- //
- // item.addDisposeListener(disposeListener);
- // item.setImage(WorkbenchImages.getImage(ISharedImages.IMG_DEF_VIEW));
- // }
- //
- // public void dispose() {
- // toolbarContributionItemDisposed();
- // super.dispose();
- // }
- // };
- //
- // class DummyAction extends Action {
- // public DummyAction() {
- // setText("Monkey");
- // setImageDescriptor(getViewSite().getWorkbenchWindow()
- // .getWorkbench().getSharedImages()
- // .getImageDescriptor(
- // ISharedImages.IMG_TOOL_DELETE));
- // }
- // };
- //
- //
- //
- // void AddToolbarContributionItem() {
- // getViewSite().getActionBars().getToolBarManager().add(toolbarItem);
- // }
-
-
-protected:
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.tests.api.MockWorkbenchPart#getActionBars()
- */
- // IActionBars GetActionBars() {
- // return getViewSite().getActionBars();
- // }
-};
-
-}
-
-#endif /* BERRYMOCKVIEWPART_H_ */
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockWorkbenchPart.cpp b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockWorkbenchPart.cpp
deleted file mode 100644
index 4353c1fd5f..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockWorkbenchPart.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include "berryMockWorkbenchPart.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace berry
-{
-
-MockWorkbenchPart::MockWorkbenchPart()
-: titleImage(0), parentWidget(0),
- disposeListener(new GuiTk::ControlDestroyedAdapter(this, &MockWorkbenchPart::ControlDestroyed))
-, siteState(false)
-{
- callTrace = new CallHistory();
- selectionProvider = new MockSelectionProvider();
-}
-
-void MockWorkbenchPart::SetSite(IWorkbenchPartSite::Pointer site)
-{
- this->site = site;
- site->SetSelectionProvider(selectionProvider);
-}
-
-IWorkbenchPartSite::Pointer MockWorkbenchPart::GetSite() const
-{
- return site;
-}
-
-std::string MockWorkbenchPart::GetPartName() const
-{
- return title;
-}
-
-std::string MockWorkbenchPart::GetContentDescription() const
-{
- return title;
-}
-
-std::string MockWorkbenchPart::GetTitleToolTip() const
-{
- return title;
-}
-
-CallHistory::Pointer MockWorkbenchPart::GetCallHistory() const
-{
- return callTrace;
-}
-
-ISelectionProvider::Pointer MockWorkbenchPart::GetSelectionProvider()
-{
- return selectionProvider;
-}
-
-void MockWorkbenchPart::SetInitializationData(
- IConfigurationElement::Pointer config, const std::string& /*propertyName*/,
- Object::Pointer data)
-{
-
- callTrace->Add("SetInitializationData");
-
- this->config = config;
- this->data = data;
-
- // Icon.
- std::string strIcon;
- if (config->GetAttribute("icon", strIcon))
- {
- ImageDescriptor::Pointer imageDesc = ImageDescriptor::CreateFromFile(
- strIcon, config->GetContributor());
- titleImage = imageDesc->CreateImage();
- }
-
- config->GetAttribute("name", title);
-}
-
-void MockWorkbenchPart::ControlDestroyed(GuiTk::ControlEvent::Pointer)
-{
- callTrace->Add("WidgetDisposed");
- parentWidget = 0;
-}
-
-void MockWorkbenchPart::AddPropertyListener(
- IPropertyChangeListener::Pointer listener)
-{
- propertyEvent.AddListener(listener);
-}
-
-void MockWorkbenchPart::RemovePropertyListener(
- IPropertyChangeListener::Pointer listener)
-{
- propertyEvent.RemoveListener(listener);
-}
-
-void MockWorkbenchPart::CreatePartControl(void* parent)
-{
- callTrace->Add("CreatePartControl");
-
- this->parentWidget = parent;
- Tweaklets::Get(GuiWidgetsTweaklet::KEY)->AddControlListener(parent,
- disposeListener);
-}
-
-MockWorkbenchPart::~MockWorkbenchPart()
-{
- callTrace->Add("PartDestructor");
-
- if (parentWidget)
- {
- Tweaklets::Get(GuiWidgetsTweaklet::KEY)->RemoveControlListener(parentWidget,
- disposeListener);
- }
-}
-
-void* MockWorkbenchPart::GetTitleImage() const
-{
- return titleImage;
-}
-
-void MockWorkbenchPart::SetFocus()
-{
- callTrace->Add("SetFocus");
-}
-
-void MockWorkbenchPart::FireSelection()
-{
- selectionProvider->FireSelection();
-}
-
-bool MockWorkbenchPart::IsSiteInitialized()
-{
- return siteState;
-}
-
-void MockWorkbenchPart::SetSiteInitialized()
-{
- SetSiteInitialized(
- // GetSite()->GetKeyBindingService() != 0 &&
- (GetSite()->GetPage() != 0) && (GetSite()->GetSelectionProvider() != 0)
- && (GetSite()->GetWorkbenchWindow() != 0) // &&
- // TestActionBars(GetActionBars())
- );
-}
-
-IConfigurationElement::Pointer MockWorkbenchPart::GetConfig()
-{
- return config;
-}
-
-Object::Pointer MockWorkbenchPart::GetData()
-{
- return data;
-}
-
-void MockWorkbenchPart::FirePropertyChange(int propertyId)
-{
- ObjectInt::Pointer value(new ObjectInt(propertyId));
- PropertyChangeEvent::Pointer event(new PropertyChangeEvent(Object::Pointer(
- this), IWorkbenchPartConstants::INTEGER_PROPERTY, value, value));
- propertyEvent.propertyChange(event);
-}
-
-void MockWorkbenchPart::SetSiteInitialized(bool initialized)
-{
- siteState = initialized;
-}
-
-std::string MockWorkbenchPart::GetPartProperty(const std::string& key) const
-{
- std::map::const_iterator i = properties.find(key);
- if (i != properties.end()) return i->second;
- return "";
-}
-
-void MockWorkbenchPart::SetPartProperty(const std::string& key,
- const std::string& value)
-{
- properties[key] = value;
-}
-
-const std::map& MockWorkbenchPart::GetPartProperties() const
-{
- return properties;
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockWorkbenchPart.h b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockWorkbenchPart.h
deleted file mode 100644
index 1884a4ef0b..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryMockWorkbenchPart.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#ifndef BERRYWORKBENCHMOCKPART_H_
-#define BERRYWORKBENCHMOCKPART_H_
-
-#include
-
-#include "berryMockSelectionProvider.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace berry
-{
-
-/**
- * Base class for mock intro and workbench parts.
- *
- * @since 3.0
- */
-class MockWorkbenchPart: public virtual IWorkbenchPart, public IExecutableExtension
-{
-
-public:
-
- berryObjectMacro(MockWorkbenchPart);
-
- MockWorkbenchPart();
-
- void SetSite(IWorkbenchPartSite::Pointer site);
-
- IWorkbenchPartSite::Pointer GetSite() const;
-
- /**
- * @see IWorkbenchPart#GetPartName()
- */
- std::string GetPartName() const;
-
- /**
- * @see IWorkbenchPart#GetContentDescription()
- */
- std::string GetContentDescription() const;
-
- /**
- * @see IWorkbenchPart#getTitleToolTip()
- */
- std::string GetTitleToolTip() const;
-
- CallHistory::Pointer GetCallHistory() const;
-
- ISelectionProvider::Pointer GetSelectionProvider();
-
- void SetInitializationData(IConfigurationElement::Pointer config,
- const std::string& /*propertyName*/, Object::Pointer data);
-
- // This isn't actually part of the part API, but we call this method from a dispose listener
- // in order to mark the point in time at which the widgets are disposed
- void ControlDestroyed(GuiTk::ControlEvent::Pointer e);
-
- /**
- * @see IWorkbenchPart#addPropertyListener(IPropertyListener)
- */
- void AddPropertyListener(IPropertyChangeListener::Pointer listener);
-
- /**
- * @see IWorkbenchPart#removePropertyListener(IPropertyListener)
- */
- void RemovePropertyListener(IPropertyChangeListener::Pointer listener);
-
- std::string GetPartProperty(const std::string& key) const;
-
- void SetPartProperty(const std::string& key, const std::string& value);
-
- const std::map& GetPartProperties() const;
-
- /**
- * @see IWorkbenchPart#createPartControl(Composite)
- */
- void CreatePartControl(void* parent);
-
- /**
- * @see IWorkbenchPart#dispose()
- */
- ~MockWorkbenchPart();
-
- /**
- * @see IWorkbenchPart#getTitleImage()
- */
- void* GetTitleImage() const;
-
- /**
- * @see IWorkbenchPart#setFocus()
- */
- void SetFocus();
-
- // /**
- // * @see IAdaptable#getAdapter(Class)
- // */
- // Object::Pointer GetAdapter(Class arg0) {
- // return null;
- // }
-
- /**
- * Fires a selection out.
- */
- void FireSelection();
-
- /**
- * Gets whether the site was properly initialized in the init method.
- */
- bool IsSiteInitialized();
-
-protected:
-
- CallHistory::Pointer callTrace;
-
- MockSelectionProvider::Pointer selectionProvider;
-
- // IActionBars GetActionBars() = 0;
-
- void SetSiteInitialized();
-
- IConfigurationElement::Pointer GetConfig();
-
- Object::Pointer GetData();
-
- /**
- * Fires a property change event.
- */
- void FirePropertyChange(int propertyId);
-
- /**
- * Sets whether the site was properly initialized in the init method.
- */
- void SetSiteInitialized(bool initialized);
-
-private:
-
- IConfigurationElement::Pointer config;
-
- Object::Pointer data;
-
- void* titleImage;
-
- void* parentWidget;
-
- IWorkbenchPartSite::Pointer site;
-
- std::string title;
-
- IPropertyChangeListener::Events propertyEvent;
-
- GuiTk::IControlListener::Pointer disposeListener;
-
- /**
- * boolean to declare whether the site was properly initialized in the init method.
- */
- bool siteState;
-
- // /**
- // * @param actionBars
- // * @return
- // */
- // bool TestActionBars(IActionBars bars) {
- // return bars != null && bars.getMenuManager() != null
- // && bars.getToolBarManager() != null
- // && bars.getStatusLineManager() != null;
- //
- // }
-
- std::map properties;
-
-};
-
-}
-
-#endif /* BERRYWORKBENCHMOCKPART_H_ */
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berrySaveableMockViewPart.cpp b/Plugins/Testing/org.blueberry.ui.tests/src/api/berrySaveableMockViewPart.cpp
deleted file mode 100644
index 585b0aa11f..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berrySaveableMockViewPart.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include "berrySaveableMockViewPart.h"
-
-namespace berry
-{
-
-const std::string SaveableMockViewPart::ID =
- "org.blueberry.ui.tests.api.SaveableMockViewPart";
-
-SaveableMockViewPart::SaveableMockViewPart() :
- isDirty(false), saveAsAllowed(false), saveNeeded(true)
-{
-
-}
-
-SaveableMockViewPart::SaveableMockViewPart(const SaveableMockViewPart& other)
-{
- Q_UNUSED(other)
- throw std::runtime_error("Copy constructor not implemented");
-}
-
-void SaveableMockViewPart::CreatePartControl(void* parent)
-{
- MockViewPart::CreatePartControl(parent);
-
- // final Button dirtyToggle = new Button(parent, SWT.CHECK);
- // dirtyToggle.setText("Dirty");
- // dirtyToggle.addSelectionListener(new SelectionAdapter() {
- // public void widgetSelected(SelectionEvent e) {
- // setDirty(dirtyToggle.getSelection());
- // }
- // });
- // dirtyToggle.setSelection(isDirty());
- //
- // final Button saveNeededToggle = new Button(parent, SWT.CHECK);
- // saveNeededToggle.setText("Save on close");
- // saveNeededToggle.addSelectionListener(new SelectionAdapter() {
- // public void widgetSelected(SelectionEvent e) {
- // setSaveNeeded(saveNeededToggle.getSelection());
- // }
- // });
- // saveNeededToggle.setSelection(saveNeeded);
- //
- // final Button saveAsToggle = new Button(parent, SWT.CHECK);
- // saveAsToggle.setText("Save as allowed");
- // saveAsToggle.addSelectionListener(new SelectionAdapter() {
- // public void widgetSelected(SelectionEvent e) {
- // setSaveAsAllowed(saveAsToggle.getSelection());
- // }
- // });
- // saveAsToggle.setSelection(saveAsAllowed);
-}
-
-void SaveableMockViewPart::DoSave(/*IProgressMonitor monitor*/)
-{
- callTrace->Add("DoSave");
-}
-
-void SaveableMockViewPart::DoSaveAs()
-{
- callTrace->Add("DoSaveAs");
-}
-
-bool SaveableMockViewPart::IsDirty() const
-{
- callTrace->Add("IsDirty");
- return isDirty;
-}
-
-bool SaveableMockViewPart::IsSaveAsAllowed() const
-{
- callTrace->Add("IsSaveAsAllowed");
- return saveAsAllowed;
-}
-
-bool SaveableMockViewPart::IsSaveOnCloseNeeded() const
-{
- callTrace->Add("IsSaveOnCloseNeeded");
- return saveNeeded;
-}
-
-void SaveableMockViewPart::SetDirty(bool isDirty)
-{
- this->isDirty = isDirty;
- FirePropertyChange(ISaveablePart::PROP_DIRTY);
-}
-
-void SaveableMockViewPart::SetSaveAsAllowed(bool isSaveAsAllowed)
-{
- this->saveAsAllowed = isSaveAsAllowed;
-}
-
-void SaveableMockViewPart::SetSaveNeeded(bool isSaveOnCloseNeeded)
-{
- this->saveNeeded = isSaveOnCloseNeeded;
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berrySaveableMockViewPart.h b/Plugins/Testing/org.blueberry.ui.tests/src/api/berrySaveableMockViewPart.h
deleted file mode 100644
index 8c03683e5d..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berrySaveableMockViewPart.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#ifndef BERRYSAVEABLEMOCKVIEWPART_H_
-#define BERRYSAVEABLEMOCKVIEWPART_H_
-
-#include "berryMockViewPart.h"
-
-#include
-
-namespace berry
-{
-
-/**
- * Mock view part that implements ISaveablePart.
- * Used for testing hideView and other view lifecycle on saveable views.
- *
- * @since 3.0.1
- */
-class SaveableMockViewPart: public MockViewPart, public ISaveablePart
-{
- Q_OBJECT
- Q_INTERFACES(berry::ISaveablePart)
-
-public:
-
- berryObjectMacro(SaveableMockViewPart);
-
- static const std::string ID; // = "org.blueberry.ui.tests.api.SaveableMockViewPart";
-
- SaveableMockViewPart();
- SaveableMockViewPart(const SaveableMockViewPart& other);
-
- void CreatePartControl(void* parent);
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
- void DoSave(/*IProgressMonitor monitor*/);
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#doSaveAs()
- */
- void DoSaveAs();
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isDirty()
- */
- bool IsDirty() const;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isSaveAsAllowed()
- */
- bool IsSaveAsAllowed() const;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isSaveOnCloseNeeded()
- */
- bool IsSaveOnCloseNeeded() const;
-
- void SetDirty(bool isDirty);
-
- void SetSaveAsAllowed(bool isSaveAsAllowed);
-
- void SetSaveNeeded(bool isSaveOnCloseNeeded);
-
-private:
-
- bool isDirty;
-
- bool saveAsAllowed;
-
- bool saveNeeded;
-
-};
-
-}
-
-#endif /* BERRYSAVEABLEMOCKVIEWPART_H_ */
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryUiApiTestSuite.cpp b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryUiApiTestSuite.cpp
deleted file mode 100644
index 2d8a93e9d4..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryUiApiTestSuite.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#include "berryUiApiTestSuite.h"
-
-#include "berryXMLMementoTest.h"
-#include "berryIPageLayoutTest.h"
-#include "berryIViewPartTest.h"
-
-namespace berry {
-
-UiApiTestSuite::UiApiTestSuite()
-: CppUnit::TestSuite("UiApiTestSuite")
-{
- addTest(IPageLayoutTest::Suite());
- addTest(IViewPartTest::Suite());
- addTest(XMLMementoTest::Suite());
-}
-
-}
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryUiApiTestSuite.h b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryUiApiTestSuite.h
deleted file mode 100644
index 7ac2f07abe..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryUiApiTestSuite.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-
-#ifndef BERRYUIAPITESTSUITE_H_
-#define BERRYUIAPITESTSUITE_H_
-
-#include
-
-namespace berry {
-
-class UiApiTestSuite : public CppUnit::TestSuite
-{
-
-public:
-
- UiApiTestSuite();
-};
-
-}
-
-#endif /* BERRYUIAPITESTSUITE_H_ */
diff --git a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryXMLMementoTest.cpp b/Plugins/Testing/org.blueberry.ui.tests/src/api/berryXMLMementoTest.cpp
deleted file mode 100644
index 593ee46fe8..0000000000
--- a/Plugins/Testing/org.blueberry.ui.tests/src/api/berryXMLMementoTest.cpp
+++ /dev/null
@@ -1,749 +0,0 @@
-/*============================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center (DKFZ)
-All rights reserved.
-
-Use of this source code is governed by a 3-clause BSD license that can be
-found in the LICENSE file.
-
-============================================================================*/
-
-#define NOMINMAX
-
-#include "berryXMLMementoTest.h"
-
-#include
-#include
-#include
-#include
-#include
-
-namespace berry
-{
-
-struct PutMementoChecker: public XMLMementoTest::MementoChecker
-{
-
- PutMementoChecker(XMLMementoTest* t) :
- mementoTest(t)
- {
- }
-
- void PrepareAndCheckBeforeSerialization(
- XMLMemento::Pointer mementoToSerialize)
- {
- mementoToSerialize->PutTextData("unchanged text data");
- mementoToSerialize->PutString("neverlost", "retained value");
-
- IMemento::Pointer aMemento = XMLMemento::CreateWriteRoot("foo");
- mementoTest->FillMemento(aMemento);
-
- // note that this does not copy the text data:
- mementoToSerialize->PutMemento(aMemento);
-
- // do not check for text data:
- mementoTest->CheckMemento(mementoToSerialize, false);
-
- assertEqual("unchanged text data", mementoToSerialize->GetTextData());
- std::string str;
- mementoToSerialize->GetString("neverlost", str);
- assertEqual("retained value", str);
- }
-
- void CheckAfterDeserialization(XMLMemento::Pointer deserializedMemento)
- {
- // do not check for text data:
- mementoTest->CheckMemento(deserializedMemento, false);
-
- assertEqual("unchanged text data", deserializedMemento
- ->GetTextData());
- std::string str;
- deserializedMemento->GetString("neverlost", str);
- assertEqual("retained value", str);
- }
-
-private:
-
- XMLMementoTest* mementoTest;
-};
-
-struct PutAndGetStringChecker: public XMLMementoTest::MementoChecker
-{
-
- PutAndGetStringChecker(const std::string& key, const std::string& value) :
- key(key), value(value)
- {
- }
-
- void PrepareAndCheckBeforeSerialization(
- XMLMemento::Pointer mementoToSerialize)
- {
- std::string helper;
- assertEqual(false, mementoToSerialize->GetString(key, helper));
- mementoToSerialize->PutString(key, value);
- mementoToSerialize->GetString(key, helper);
- assertEqual(value, helper);
- }
-
- void CheckAfterDeserialization(XMLMemento::Pointer deserializedMemento)
- {
- std::string helper;
- deserializedMemento->GetString(key, helper);
- assertEqual(value, helper);
- }
-
-private:
- const std::string& key;
- const std::string& value;
-};
-
-struct CopyChildChecker: public XMLMementoTest::MementoChecker
-{
-
- CopyChildChecker(XMLMementoTest* t) :
- mementoTest(t)
- {
- }
-
- void PrepareAndCheckBeforeSerialization(
- XMLMemento::Pointer mementoToSerialize)
- {
- IMemento::Pointer child = mementoToSerialize->CreateChild("c", "i");
- mementoTest->FillMemento(child);
- IMemento::Pointer copiedChild = mementoToSerialize->CopyChild(child);
- assertEqual("i", copiedChild->GetID());
- mementoTest->CheckMemento(copiedChild, true);
- }
-
- void CheckAfterDeserialization(XMLMemento::Pointer deserializedMemento)
- {
- IMemento::Pointer child = deserializedMemento->GetChild("c");
- mementoTest->CheckMemento(child, true);
- std::vector children(deserializedMemento->GetChildren(
- "c"));
- assertEqual(2, (long)children.size());
- assertEqual("i", children[0]->GetID());
- mementoTest->CheckMemento(children[0], true);
- assertEqual("i", children[1]->GetID());
- mementoTest->CheckMemento(children[1], true);
- }
-
-private:
-
- XMLMementoTest* mementoTest;
-};
-
-struct CreateAndGetChildChecker: public XMLMementoTest::MementoChecker
-{
-
- CreateAndGetChildChecker() :
- type1("type1"), type2("type2"), id("id")
- {
- }
-
- void PrepareAndCheckBeforeSerialization(
- XMLMemento::Pointer mementoToSerialize)
- {
- // check that nothing is there yet
- assertNullPtr(mementoToSerialize->GetChild(type1).GetPointer());
- assertNullPtr(mementoToSerialize->GetChild(type2).GetPointer());
-
- // creation without ID
- IMemento::Pointer child1 = mementoToSerialize->CreateChild(type1);
- assertNotNullPtr(child1.GetPointer());
- assertNotNullPtr(mementoToSerialize->GetChild(type1).GetPointer());
-
- // creation with ID
- IMemento::Pointer child2 = mementoToSerialize->CreateChild(type2, id);
- assertNotNullPtr(child2.GetPointer());
- assertNotNullPtr(mementoToSerialize->GetChild(type2).GetPointer());
- assertEqual(id, child2->GetID());
- }
-
- void CheckAfterDeserialization(XMLMemento::Pointer deserializedMemento)
- {
- IMemento::Pointer child1 = deserializedMemento->GetChild(type1);
- assertNotNullPtr(child1.GetPointer());
- IMemento::Pointer child2 = deserializedMemento->GetChild(type2);
- assertNotNullPtr(child2.GetPointer());
- assertEqual(id, child2->GetID());
- }
-
-private:
-
- const std::string type1;
- const std::string type2;
- const std::string id;
-};
-
-struct GetChildrenChecker: public XMLMementoTest::MementoChecker
-{
-
- GetChildrenChecker() :
- type("type"), id1("id"), id2("id2")
- {
- }
-
- void PrepareAndCheckBeforeSerialization(
- XMLMemento::Pointer mementoToSerialize)
- {
- // check that nothing is there yet
- assertNullPtr(mementoToSerialize->GetChild(type).GetPointer());
-
- IMemento::Pointer child1 = mementoToSerialize->CreateChild(type, id1);
- assertNotNullPtr(child1.GetPointer());
- assertNotNullPtr(mementoToSerialize->GetChild(type).GetPointer());
- assertEqual(id1, child1->GetID());
-
- // second child with the same type
- IMemento::Pointer child2 = mementoToSerialize->CreateChild(type, id2);
- assertNotNullPtr(child2.GetPointer());
- assertEqual(2, (long)mementoToSerialize->GetChildren(type).size());
- assertEqual(id2, child2->GetID());
- }
-
- void CheckAfterDeserialization(XMLMemento::Pointer deserializedMemento)
- {
- std::vector children(deserializedMemento->GetChildren(
- type));
- assertEqual(2, (long)children.size());
-
- // this checks that the order is maintained.
- // the spec does not promise this, but clients
- // may rely on the current implementation behaviour.
- assertEqual(id1, children[0]->GetID());
- assertEqual(id2, children[1]->GetID());
- }
-
-private:
- const std::string type;
- const std::string id1;
- const std::string id2;
-};
-
-struct GetIDChecker: public XMLMementoTest::MementoChecker
-{
-
- GetIDChecker(const std::string& type, const std::string& id) :
- type(type), id(id)
- {
- }
-
- void PrepareAndCheckBeforeSerialization(
- XMLMemento::Pointer mementoToSerialize)
- {
- assertNullPtr(mementoToSerialize->GetChild(type).GetPointer());
- IMemento::Pointer child = mementoToSerialize->CreateChild(type, id);
- assertEqual(id, child->GetID());
- }
-
- void CheckAfterDeserialization(XMLMemento::Pointer deserializedMemento)
- {
- IMemento::Pointer child = deserializedMemento->GetChild(type);
- assertNotNullPtr(child.GetPointer());
- assertEqual(id, child->GetID());
- }
-
-private:
-
- const std::string type;
- const std::string id;
-};
-
-struct PutAndGetFloatChecker: public XMLMementoTest::MementoChecker
-{
-
- PutAndGetFloatChecker(const std::string& key, double value) :
- key(key), value(value)
- {
- }
-
- void PrepareAndCheckBeforeSerialization(
- XMLMemento::Pointer mementoToSerialize)
- {
- double v;
- assertEqual(false, mementoToSerialize->GetFloat(key, v));
- mementoToSerialize->PutFloat(key, value);
- mementoToSerialize->GetFloat(key, v);
- assertEqual(value, v);
- }
-
- void CheckAfterDeserialization(XMLMemento::Pointer deserializedMemento)
- {
- double v;
- deserializedMemento->GetFloat(key, v);
- assertEqual(value, v);
- }
-
-private:
- const std::string key;
- const double value;
-};
-
-struct PutAndGetIntChecker: public XMLMementoTest::MementoChecker
-{
-
- PutAndGetIntChecker(const std::string& key, const int value) :
- key(key), value(value)
- {
- }
-
- void PrepareAndCheckBeforeSerialization(
- XMLMemento::Pointer mementoToSerialize)
- {
- int v;
- assertEqual(false, mementoToSerialize->GetInteger(key, v));
- mementoToSerialize->PutInteger(key, value);
- mementoToSerialize->GetInteger(key, v);
- assertEqual(value, v);
- }
-
- void CheckAfterDeserialization(XMLMemento::Pointer deserializedMemento)
- {
- int v;
- deserializedMemento->GetInteger(key, v);
- assertEqual(value, v);
- }
-
-private:
- const std::string key;
- const int value;
-};
-
-struct PutAndGetTextDataChecker: public XMLMementoTest::MementoChecker
-{
-
- PutAndGetTextDataChecker(const std::string& data) :
- data(data)
- {
- }
-
- void PrepareAndCheckBeforeSerialization(
- XMLMemento::Pointer mementoToSerialize)
- {
- assertEqual("", mementoToSerialize->GetTextData());
- mementoToSerialize->PutTextData(data);
- assertEqual(data, mementoToSerialize->GetTextData());
- }
-
- void CheckAfterDeserialization(XMLMemento::Pointer deserializedMemento)
- {
- assertEqual(data, deserializedMemento->GetTextData());
- }
-
-private:
- const std::string data;
-};
-
-struct LegalKeysChecker: public XMLMementoTest::MementoChecker
-{
-
- LegalKeysChecker(const std::string& key) :
- key(key)
- {
- }
-
- void PrepareAndCheckBeforeSerialization(
- XMLMemento::Pointer mementoToSerialize)
- {
- std::string v;
- assertEqual(false, mementoToSerialize->GetString(key, v));
- try
- {
- mementoToSerialize->PutString(key, "some string");
- } catch (Poco::RuntimeException& ex)
- {
- std::cout << "offending key: '" + key + "'" << std::endl;
- ex.rethrow();
- }
- mementoToSerialize->GetString(key, v);
- assertEqual("some string", v);
- }
-
- void CheckAfterDeserialization(XMLMemento::Pointer deserializedMemento)
- {
- std::string v;
- deserializedMemento->GetString(key, v);
- assertEqual("some string", v);
- }
-
-private:
- const std::string key;
-};
-
-struct PutTextDataWithChildrenChecker: public XMLMementoTest::MementoChecker
-{
-
- PutTextDataWithChildrenChecker(const std::string& textData) :
- textData(textData)
- {
- }
-
- void PrepareAndCheckBeforeSerialization(
- XMLMemento::Pointer mementoToSerialize)
- {
- mementoToSerialize->CreateChild("type", "id");
- mementoToSerialize->PutTextData(textData);
- mementoToSerialize->CreateChild("type", "id");
- mementoToSerialize->CreateChild("type", "id");
- assertEqual(textData, mementoToSerialize->GetTextData());
- }
-
- void CheckAfterDeserialization(XMLMemento::Pointer deserializedMemento)
- {
- assertEqual(textData, deserializedMemento->GetTextData());
- }
-
-private:
- const std::string textData;
-};
-
-const std::string XMLMementoTest::TEST_STRINGS[10] =
-{ "value", " value with spaces ", "value.with.many.dots",
- "value_with_underscores", "valuewith>greaterthan",
- "value&with&ersand", "value\"with\"quote", "value#with#hash", "", };
-
-const unsigned int XMLMementoTest::TEST_STRINGS_LENGTH = 10;
-/*
- * the following cases are for bug 93720
- */
-// "\nvalue\nwith\nnewlines\n", "\tvalue\twith\ttab\t",
-// "\rvalue\rwith\rreturn\r", };
-
-CppUnit::Test* XMLMementoTest::Suite()
-{
- CppUnit::TestSuite* suite = new CppUnit::TestSuite("XMLMementoTest");
-
- CppUnit_addTest(suite, XMLMementoTest, TestPutMemento);
- CppUnit_addTest(suite, XMLMementoTest, TestPutAndGetString);
- CppUnit_addTest(suite, XMLMementoTest, TestCreateReadRootReaderExceptionCases);
- CppUnit_addTest(suite, XMLMementoTest, TestCreateReadRootReader);
- CppUnit_addTest(suite, XMLMementoTest, TestCreateWriteRoot);
- CppUnit_addTest(suite, XMLMementoTest, TestSpacesInRootAreIllegal);
- CppUnit_addTest(suite, XMLMementoTest, TestSpacesInKeysAreIllegal);
- CppUnit_addTest(suite, XMLMementoTest, TestCopyChild);
- CppUnit_addTest(suite, XMLMementoTest, TestCreateAndGetChild);
- CppUnit_addTest(suite, XMLMementoTest, TestGetChildren);
- CppUnit_addTest(suite, XMLMementoTest, TestGetID);
- CppUnit_addTest(suite, XMLMementoTest, TestPutAndGetFloat);
- CppUnit_addTest(suite, XMLMementoTest, TestPutAndGetInteger);
- CppUnit_addTest(suite, XMLMementoTest, TestPutAndGetTextData);
- CppUnit_addTest(suite, XMLMementoTest, TestLegalKeys);
- CppUnit_addTest(suite, XMLMementoTest, TestIllegalKeys);
- CppUnit_addTest(suite, XMLMementoTest, TestPutTextDataWithChildren);
- CppUnit_addTest(suite, XMLMementoTest, TestMementoWithTextContent);
-
- return suite;
-}
-
-XMLMementoTest::XMLMementoTest(const std::string& testName) :
- TestCase(testName)
-{
-
-}
-
-void XMLMementoTest::FillMemento(IMemento::Pointer memento)
-{
- memento->PutFloat("floatKey", 0.4f);
- memento->PutInteger("integerKey", 324765);
- memento->PutString("stringKey", "a string");
- memento->PutTextData("some text data");
- memento->CreateChild("child1");
- memento->CreateChild("child2", "child2id1");
- memento->CreateChild("child2", "child2id2");
-}
-
-void XMLMementoTest::TestPutAndGet(MementoChecker& mementoChecker)
- throw (Poco::IOException, WorkbenchException)
-{
- XMLMemento::Pointer mementoToSerialize = XMLMemento::CreateWriteRoot(
- "XMLMementoTest");
-
- mementoChecker.PrepareAndCheckBeforeSerialization(mementoToSerialize);
-
- std::stringstream writer;
- mementoToSerialize->Save(writer);
- writer.flush();
-
- XMLMemento::Pointer deserializedMemento = XMLMemento::CreateReadRoot(writer);
-
- mementoChecker.CheckAfterDeserialization(deserializedMemento);
-}
-
-void XMLMementoTest::CheckMemento(IMemento::Pointer memento,
- bool checkForTextData)
-{
- double floatVal;
- memento->GetFloat("floatKey", floatVal);
- assertEqualDelta(0.4, floatVal, 0.0001);
-
- int intVal;
- memento->GetInteger("integerKey", intVal);
- assertEqual(324765, intVal);
-
- std::string strVal;
- memento->GetString("stringKey", strVal);
- assertEqual("a string", strVal);
-
- if (checkForTextData)
- {
- assertEqual("some text data", memento->GetTextData());
- }
-
- IMemento::Pointer child1 = memento->GetChild("child1");
- assertNotNullPtr(child1.GetPointer());
- IMemento::Pointer child2 = memento->GetChild("child2");
- assertNotNullPtr(child2.GetPointer());
- assertEqual("child2id1", child2->GetID());
- std::vector