FOSSology  4.7.1
Open Source License Compliance by Open Source Software
ReuserHelpersAccessor Class Reference

Thin subclass that exposes private helper methods for testing. More...

Inheritance diagram for ReuserHelpersAccessor:
Inheritance graph
Collaboration diagram for ReuserHelpersAccessor:
Collaboration graph

Public Member Functions

bool callIsValidIdentifier (const std::string &s)
 
std::string callReplaceUnicodeControlChars (const std::string &s)
 
int callGetDecisionTypePriority (int decisionType)
 
 MockReuserDatabaseHandler ()
 
- Public Member Functions inherited from MockReuserDatabaseHandler
 MockReuserDatabaseHandler ()
 
bool getParentItemBounds (int uploadId, ItemTreeBounds &out) override
 Fetch the parent item bounds for a given upload. More...
 
std::vector< ReuseTriplegetReusedUploads (int uploadId, int groupId) override
 Return the list of uploads that should be reused for uploadId.
 
std::map< int, int > getClearingDecisionMapByPfile (int uploadId, int groupId) override
 Build a pfile_fk to clearing_decision_pk map for uploadId. More...
 
std::map< int, std::vector< int > > getUploadTreePksForPfiles (int uploadId, const std::vector< int > &pfileIds) override
 For a set of pfile ids, return a map pfile_fk to [uploadtree_pk].
 
bool processUploadReuse (int uploadId, int reusedUploadId, int groupId, int reusedGroupId, int userId) override
 
bool processEnhancedUploadReuse (int uploadId, int reusedUploadId, int groupId, int reusedGroupId, int userId) override
 
bool reuseMainLicense (int uploadId, int groupId, int reusedUploadId, int reusedGroupId) override
 
bool reuseConfSettings (int uploadId, int reusedUploadId) override
 
bool reuseCopyrights (int uploadId, int reusedUploadId, int userId) override
 
- Public Member Functions inherited from ReuserDatabaseHandler
 ReuserDatabaseHandler (fo::DbManager dbManager)
 
 ReuserDatabaseHandler (ReuserDatabaseHandler &&other)=default
 
virtual ReuserDatabaseHandler spawn () const
 
virtual int insertClearingEvent (int uploadId, int uploadTreeId, int userId, int groupId, int licenseId, bool removed, int type, const std::string &reportInfo, const std::string &comment, const std::string &ack, int jobId)
 Insert a new clearing event and return its primary key (0 on error). More...
 
virtual int createDecisionFromEvents (int uploadId, int uploadTreeId, int userId, int groupId, int decType, int scope, const std::vector< int > &eventIds)
 Create a clearing_decision linked to eventIds. More...
 
virtual int createCopyOfClearingDecision (int uploadId, int newItemUploadTreePk, int userId, int groupId, int originalDecisionPk)
 Copy an existing clearing decision to a new uploadtree item. More...
 
virtual int writeArsRecord (int agentId, int uploadId, int arsId=0, bool success=false)
 Write (insert or update) an ARS record. More...
 
- Public Member Functions inherited from fo::AgentDatabaseHandler
 AgentDatabaseHandler (DbManager dbManager)
 
 AgentDatabaseHandler (AgentDatabaseHandler &&other)
 
 AgentDatabaseHandler (const AgentDatabaseHandler &)=delete
 
virtual ~AgentDatabaseHandler ()
 
AgentDatabaseHandler operator= (const AgentDatabaseHandler &)=delete
 
bool begin () const
 BEGIN a transaction block in DB. More...
 
bool commit () const
 COMMIT a transaction block in DB. More...
 
bool rollback () const
 ROLLBACK a transaction block in DB. More...
 
char * getPFileNameForFileId (unsigned long pfileId) const
 Get the file name of a give pfile id. More...
 
std::string queryUploadTreeTableName (int uploadId)
 Get the upload tree table name for a given upload id. More...
 
std::vector< unsigned long > queryFileIdsVectorForUpload (int uploadId, bool ignoreFilesWithMimeType) const
 Get pfile ids for a given upload id. More...
 
std::vector< unsigned long > queryFileIdsVectorForUpload (int uploadId, int agentId, bool ignoreFilesWithMimeType) const
 Get pfile ids for a given upload id which agent has not scanned. More...
 

Additional Inherited Members

- Public Attributes inherited from MockReuserDatabaseHandler
std::function< bool(int, ItemTreeBounds &)> onGetParentItemBounds
 
std::function< std::vector< ReuseTriple >int, int)> onGetReusedUploads
 
std::function< std::map< int, int >int, int)> onGetClearingDecisionMapByPfile
 
std::function< std::map< int, std::vector< int > >int, const std::vector< int > &)> onGetUploadTreePksForPfiles
 
std::function< bool(int, int, int, int, int)> onProcessUploadReuse
 
std::function< bool(int, int, int, int, int)> onProcessEnhancedUploadReuse
 
std::function< bool(int, int, int, int)> onReuseMainLicense
 
std::function< bool(int, int)> onReuseConfSettings
 
std::function< bool(int, int, int)> onReuseCopyrights
 
- Static Protected Member Functions inherited from ReuserDatabaseHandler
static bool isValidIdentifier (const std::string &s)
 Validate that s contains only characters safe for SQL identifiers.
 
static std::string replaceUnicodeControlChars (const std::string &input)
 Strip Unicode control characters (C0, C1, DEL) from input.
 
static int getDecisionTypePriority (int decisionType)
 Priority for decision types during reuse conflict resolution. More...
 
- Protected Attributes inherited from fo::AgentDatabaseHandler
DbManager dbManager
 DbManager to use.
 

Detailed Description

Thin subclass that exposes private helper methods for testing.

Definition at line 25 of file test_helpers.cc.

Member Function Documentation

◆ MockReuserDatabaseHandler()

MockReuserDatabaseHandler::MockReuserDatabaseHandler
explicit

Construct without a real DB connection.

fo::DbManager has no default constructor, so we use a delegating path: pass a null fo_dbManager* wrapped as a DbManager.

Definition at line 40 of file MockReuserDatabaseHandler.cc.


The documentation for this class was generated from the following file: