You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

235 lines
7.9 KiB

// Copyright 2020 Siemens Digital Industries Software
// ==================================================
// Copyright 2020.
// Siemens Product Lifecycle Management Software Inc.
// All Rights Reserved.
// ==================================================
// Copyright 2020 Siemens Digital Industries Software
/**
@file
Manufacturing Validation Test Suite for ME
*/
#ifndef TEAMCENTER_ME_MfgValidationTestSuite_HXX
#define TEAMCENTER_ME_MfgValidationTestSuite_HXX
#include <me/MfgValidationTestInterface.hxx>
#include <me/libme_exports.h>
/**
@defgroup ME Manufacturing Process Planner (ME)
@{
*/
namespace Teamcenter
{
class MfgValidationTestSuite;
}
/**
* Multi map holds validation test type to validation tests info.
*/
typedef std::multimap<std::string,std::string> ValidationTestTypeToValidationTestMMapType;
/**
@name Manufacturing Validation Test Suite
@{
*/
/**
MfgValidationTestSuite
Helper class for developer that needs to create validation tests for a validation test suite.
Note: This approach will only work if you can decide on a single or possibly just a few Validation Tests APIs
The registered Validation Suite implementation will use this class to assist in managing and executing a set of Validation Tests.
It is not required to use this approach to build validation test suites and associated validation test suites.
This is just one of many possible validation test suite designs.
The class MfgValidationTestSuiteA_Tests is a derived class example of this base class.
The MfgValidationTestSuiteA_Tests (derived class) has a set of member functions that represent the set of individual Validation Tests for the associated Validation Test Suite.
The derived class registers those validation test member functions with its base class (this class).
The registered Validation Suite function instantiates a MfgValidationTestSuite derived class instance. Referred to as Instance.
The Validation Suite function uses the Instance to get the names of the associated Validation Test names.
The Validation Suite function uses the Instance to execute Validation Test suite validation tests and get the Validation Test results.
// example Validation Test Suite function that would be registered with Teamcenter
@code
extern int MfgValidationTestSuiteA(
const InputObjectToFoundObjectsMap & inputObjectToFoundObjectsMap ,
const std::vector<std::string> & validationTestNames,
std::vector<std::string> & additionalInfo,
TestedObjectToValidationResultsMap & validationTestResultsMap)
{
Journal journal(Journal_MFG, "MfgValidationTestSuite::Mfg Validation Test SuiteA");
journal.call();
MfgValidationTestSuiteA_Tests myValidationSuiteTestManager(inputObjectToFoundObjectsMap, validationTestNames, additionalInfo );
myValidationSuiteTestManager.runValidationTests();
validationTestResultsMap = myValidationSuiteTestManager.getValidationTestResults();
return ITK_ok;
}
@endcode
*/
class ME_API Teamcenter::MfgValidationTestSuite
{
public:
/**
constructor caches derived class information
*/
MfgValidationTestSuite(
const InputObjectToFoundObjectsMap & inputObjectToFoundObjectsMap, /**< (I) caches derived class input objects. */
const std::vector<std::string> & validationTestNames, /**< (I) caches derived class validation test names. */
std::vector<std::string> & additionalInfo /**< (I) caches derived class additional info. */
);
/**
destructor
*/
virtual ~MfgValidationTestSuite();
/**
The OOTB Validation Test API
*/
typedef void(Teamcenter::MfgValidationTestSuite::*validation_test_callback_fn_type) (tag_t);
/**
The generic OOTB Validation Test API
*/
typedef void(Teamcenter::MfgValidationTestSuite::*generic_validation_test_callback_fn_type) (void);
/**
Defines the map of validation test name to validation test callback function.
*/
typedef std::map<std::string, generic_validation_test_callback_fn_type> ValidationTestToTestCallbackFnMapType;
/**
@note Required
Derived classes must provide implementation
Return the names of the validation tests contained by this validation test suite.
This validation test list will be communicated back to the validation test client
@returns Vector of validation test names.
*/
virtual const std::vector<std::string> & getValidationSuiteTestNames();
/**
* Registers test name and test callback function with framework.
*/
void registerValidationTest(const std::string & testName, /**< (I) The validation test name to register. */
generic_validation_test_callback_fn_type /**< (I) The validation test callback function to register. */
);
/**
Executes all the validation tests registered with the framework for each object in targetObjectToFoundObjectsMap.
*/
virtual void runValidationTests();
/**
Executes only the specified test for all targetObjectToFoundObjectsMap objects.
*/
virtual void runValidationTest(const std::string & testName /**< (I) The validation test to run. */
);
/**
Executes a single test with input target object.
Retrieves the registered validation test member function and executes it.
The registered validation test function should call 'populateValidationResults' to save the validation test results
The OOTB implementation uses typedef void(*MfgValidationTestSuite::validation_test_callback_fn_type) (tag_t );
*/
virtual void runValidationTest(const std::string & testName, /**< (I) The validation test to run. */
tag_t targetObject /**< (I) The input object to use on the validation test. */
);
/**
Returns the validation test results.
@returns Map of validation test results.
*/
const TestedObjectToValidationResultsMap & getValidationTestResults();
/**
@note Required
Each validation test must populate the validation results via this method.
*/
void populateValidationResults(tag_t object, /**< (I) The object being tested. */
const std::string & testName, /**< (I) The validation test. */
int validationTestResult, /**< (I) The Pass=0/Fail=1/NA=2 result of the validation test. */
int messageType, /**< (I) The message type: Info/Error/Warning. */
const std::string & message /**< (I) The message content. */
);
protected:
/**
Cache the suiteName
*/
std::string suiteName;
/**
Variable can be used by derived classes
*/
std::string statusMessage;
/**
Keep track of registered validation test functions by testname
*/
ValidationTestToTestCallbackFnMapType testNameToTestCallbackFnMap;
/**
Validation test suite names
*/
std::vector<std::string> validationSuiteTestNames;
/**
Cache input arguments from Validation Test Suite function
*/
InputObjectToFoundObjectsMap inputObjectToFoundObjectsMap;
/**
Cache validation test names
*/
std::vector<std::string> validationTestNames;
/**
Cache additionaInfo
*/
std::vector<std::string> additionalInfo;
/**
Map of validation test results per tested object
*/
TestedObjectToValidationResultsMap validationTestResultsMap;
private:
/**
constructor
*/
MfgValidationTestSuite();
/**
* copy constructor
*/
MfgValidationTestSuite(const MfgValidationTestSuite& );
/**
* assignment operator
*/
MfgValidationTestSuite & operator=( const MfgValidationTestSuite & );
};
/** @} */
#include <me/libme_undef.h>
/** @} */
#endif