![]() |
FOSSology
4.7.1
Open Source License Compliance by Open Source Software
|
Test double for ReuserDatabaseHandler. More...
#include <MockReuserDatabaseHandler.hpp>


Public Member Functions | |
| MockReuserDatabaseHandler () | |
| bool | getParentItemBounds (int uploadId, ItemTreeBounds &out) override |
| Fetch the parent item bounds for a given upload. More... | |
| std::vector< ReuseTriple > | getReusedUploads (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... | |
Public Attributes | |
| 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 |
Additional Inherited Members | |
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. | |
Test double for ReuserDatabaseHandler.
Provides injectable lambdas for every public method. Tests set up only the callbacks they care about; unset callbacks return safe defaults (empty containers / true).
Definition at line 31 of file MockReuserDatabaseHandler.hpp.
|
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 12 of file MockReuserDatabaseHandler.cc.
|
inlineoverridevirtual |
Build a pfile_fk to clearing_decision_pk map for uploadId.
Considers both ITEM-scope and (when enabled) REPO-scope decisions.
Reimplemented from ReuserDatabaseHandler.
Definition at line 85 of file MockReuserDatabaseHandler.hpp.
|
inlineoverridevirtual |
Fetch the parent item bounds for a given upload.
Reimplemented from ReuserDatabaseHandler.
Definition at line 73 of file MockReuserDatabaseHandler.hpp.
|
inlineoverridevirtual |
Enhanced reuse: match by filename + diff threshold.
Reimplemented from ReuserDatabaseHandler.
Definition at line 110 of file MockReuserDatabaseHandler.hpp.
|
inlineoverridevirtual |
Standard reuse: copy clearing decisions matched by pfile id.
Reimplemented from ReuserDatabaseHandler.
Definition at line 101 of file MockReuserDatabaseHandler.hpp.
|
inlineoverridevirtual |
Copy report_info configuration from reused upload.
Reimplemented from ReuserDatabaseHandler.
Definition at line 128 of file MockReuserDatabaseHandler.hpp.
|
inlineoverridevirtual |
Copy copyright events from reused upload.
Reimplemented from ReuserDatabaseHandler.
Definition at line 134 of file MockReuserDatabaseHandler.hpp.
|
inlineoverridevirtual |
Copy main-license entries from reused upload.
Reimplemented from ReuserDatabaseHandler.
Definition at line 119 of file MockReuserDatabaseHandler.hpp.