aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Rocard <kevinx.rocard@intel.com>2013-07-22 14:39:26 +0200
committerDavid Wagner <david.wagner@intel.com>2014-02-12 17:04:08 +0100
commit4b1fbfa165b1a1bd52a2792011c5e2e2cc053a45 (patch)
tree3649580115943be0834529e6579df892cd5bc2bf
parentd6909ebe19bf6e2817dadea32e06dda9d22bf073 (diff)
downloadexternal_parameter-framework-4b1fbfa165b1a1bd52a2792011c5e2e2cc053a45.zip
external_parameter-framework-4b1fbfa165b1a1bd52a2792011c5e2e2cc053a45.tar.gz
external_parameter-framework-4b1fbfa165b1a1bd52a2792011c5e2e2cc053a45.tar.bz2
Add the setFailureOnFailedSettingsLoad command
BZ: 122982 The failure on failed settings load option was added by the previous patch (Ifd3cd859ad0eaef266be4c9245ebd28c9e9c0a74) but not expose in test-platform. Create command to expose the boolean getters and setters of the ParameterMgrConector in a generic way. Change-Id: I438ab36c2d1141dc139d528f83b570f4d5078d19 Signed-off-by: Kevin Rocard <kevinx.rocard@intel.com> Reviewed-on: http://android.intel.com:8080/119925 Reviewed-by: Centelles, Sylvain <sylvain.centelles@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: cactus <cactus@intel.com> Tested-by: cactus <cactus@intel.com>
-rw-r--r--test/test-platform/TestPlatform.cpp40
-rw-r--r--test/test-platform/TestPlatform.h26
2 files changed, 47 insertions, 19 deletions
diff --git a/test/test-platform/TestPlatform.cpp b/test/test-platform/TestPlatform.cpp
index 1825b88..2ff704b 100644
--- a/test/test-platform/TestPlatform.cpp
+++ b/test/test-platform/TestPlatform.cpp
@@ -88,14 +88,27 @@ CTestPlatform::CTestPlatform(const string& strClass, int iPortNumber) :
&CTestPlatform::applyConfigurations,
0, "", "Apply configurations selected by current selection criteria states");
- _pCommandHandler->addCommandParser("setFailureOnMissingSubsystem",
- &CTestPlatform::setFailureOnMissingSubsystem,
- 1, "true|false", "Set policy for missing subsystems, "
- "either abort start or fallback on virtual subsystem");
- _pCommandHandler->addCommandParser("getMissingSubsystemPolicy",
- &CTestPlatform::getFailureOnMissingSubsystem,
- 0, "", "Get policy for missing subsystems, "
- "either abort start or fallback on virtual subsystem");
+ _pCommandHandler->addCommandParser(
+ "setFailureOnMissingSubsystem",
+ &CTestPlatform::setter<&CParameterMgrPlatformConnector::setFailureOnMissingSubsystem>,
+ 1, "true|false", "Set policy for missing subsystems, "
+ "either abort start or fallback on virtual subsystem.");
+ _pCommandHandler->addCommandParser(
+ "getMissingSubsystemPolicy",
+ &CTestPlatform::getter<&CParameterMgrPlatformConnector::getFailureOnMissingSubsystem>,
+ 0, "", "Get policy for missing subsystems, "
+ "either abort start or fallback on virtual subsystem.");
+
+ _pCommandHandler->addCommandParser(
+ "setFailureOnFailedSettingsLoad",
+ &CTestPlatform::setter<&CParameterMgrPlatformConnector::setFailureOnFailedSettingsLoad>,
+ 1, "true|false",
+ "Set policy for failed settings load, either abort start or continue without domains.");
+ _pCommandHandler->addCommandParser(
+ "getFailedSettingsLoadPolicy",
+ &CTestPlatform::getter<&CParameterMgrPlatformConnector::getFailureOnFailedSettingsLoad>,
+ 0, "",
+ "Get policy for failed settings load, either abort start or continue without domains.");
// Create server
_pRemoteProcessorServer = new CRemoteProcessorServer(iPortNumber, _pCommandHandler);
@@ -171,7 +184,8 @@ CTestPlatform::CommandReturn CTestPlatform::startParameterMgr(
CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed;
}
-CTestPlatform::CommandReturn CTestPlatform::setFailureOnMissingSubsystem(
+template<CTestPlatform::setter_t setFunction>
+CTestPlatform::CommandReturn CTestPlatform::setter(
const IRemoteCommand& remoteCommand, string& strResult)
{
const string& strAbort = remoteCommand.getArgument(0);
@@ -182,18 +196,18 @@ CTestPlatform::CommandReturn CTestPlatform::setFailureOnMissingSubsystem(
return CTestPlatform::CCommandHandler::EShowUsage;
}
- return _pParameterMgrPlatformConnector->setFailureOnMissingSubsystem(bFail, strResult) ?
+ return (_pParameterMgrPlatformConnector->*setFunction)(bFail, strResult) ?
CTestPlatform::CCommandHandler::EDone : CTestPlatform::CCommandHandler::EFailed;
}
-CTestPlatform::CommandReturn CTestPlatform::getFailureOnMissingSubsystem(
+template<CTestPlatform::getter_t getFunction>
+CTestPlatform::CommandReturn CTestPlatform::getter(
const IRemoteCommand& remoteCommand, string& strResult)
{
(void)remoteCommand;
(void)strResult;
- strResult = _pParameterMgrPlatformConnector->getFailureOnMissingSubsystem() ?
- "true":"false";
+ strResult = (_pParameterMgrPlatformConnector->*getFunction)() ? "true" : "false";
return CTestPlatform::CCommandHandler::EDone;
}
diff --git a/test/test-platform/TestPlatform.h b/test/test-platform/TestPlatform.h
index a415a85..58f8dc5 100644
--- a/test/test-platform/TestPlatform.h
+++ b/test/test-platform/TestPlatform.h
@@ -24,13 +24,13 @@
*/
#pragma once
+#include "ParameterMgrPlatformConnector.h"
#include "RemoteCommandHandlerTemplate.h"
#include <string>
#include <list>
using namespace std;
-class CParameterMgrPlatformConnector;
class CParameterMgrPlatformConnectorLogger;
class CRemoteProcessorServer;
class ISelectionCriterionInterface;
@@ -89,22 +89,36 @@ private:
CommandReturn applyConfigurations(
const IRemoteCommand& remoteCommand, string& strResult);
- /** Callback to set if the PFW start should fail in case of missing subsystems.
+ /** The type of a CParameterMgrPlatformConnector boolean setter. */
+ typedef bool (CParameterMgrPlatformConnector::*setter_t)(bool, string&);
+ /** Template callback to create a _pParameterMgrPlatformConnector boolean setter callback.
* @see CCommandHandler::RemoteCommandParser for detail on each arguments and return
*
+ * Convert the remoteCommand first argument to a boolean and call the
+ * template parameter function with this value.
+ *
+ * @tparam the boolean setter method.
* @param[in] remoteCommand the first argument should be ether "on" or "off".
*/
- CommandReturn setFailureOnMissingSubsystem(
+ template<setter_t setFunction>
+ CommandReturn setter(
const IRemoteCommand& remoteCommand, string& strResult);
- /** Callback to get if the PFW start should fail in case of missing subsystems.
+
+ /** The type of a CParameterMgrPlatformConnector boolean getter. */
+ typedef bool (CParameterMgrPlatformConnector::*getter_t)();
+ /** Template callback to create a ParameterMgrPlatformConnector boolean getter callback.
* @see CCommandHandler::RemoteCommandParser for detail on each arguments and return
*
+ * Convert to boolean returned by the template parameter function converted to a
+ * string ("True", "False") and return it.
+ *
+ * @tparam the boolean getter method.
* @param[in] remoteCommand is ignored
*
* @return EDone (never fails)
*/
- CommandReturn getFailureOnMissingSubsystem(
- const IRemoteCommand& remoteCommand, string& strResult);
+ template<getter_t getFunction>
+ CommandReturn getter(const IRemoteCommand& remoteCommand, string& strResult);
// Commands
bool createExclusiveSelectionCriterionFromStateList(const string& strName, const IRemoteCommand& remoteCommand, string& strResult);