-
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Created LoggerConfigurationDataSelector class, and added actual…
… CMDT records to the extra-tests folder to use for integration tests in the pipeline
- Loading branch information
Showing
12 changed files
with
482 additions
and
0 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
nebula-logger/core/main/configuration/classes/LoggerConfigurationDataSelector.cls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
//------------------------------------------------------------------------------------------------// | ||
// This file is part of the Nebula Logger project, released under the MIT License. // | ||
// See LICENSE file or go to https://github.com/jongpie/NebulaLogger for full license details. // | ||
//------------------------------------------------------------------------------------------------// | ||
|
||
/** | ||
* @group Configuration | ||
* @description Selector class used for all queries that are specific to the configuration layer | ||
*/ | ||
public without sharing virtual class LoggerConfigurationDataSelector { | ||
private static LoggerConfigurationDataSelector instance = new LoggerConfigurationDataSelector(); | ||
|
||
@SuppressWarnings('PMD.EmptyStatementBlock') | ||
@TestVisible | ||
private LoggerConfigurationDataSelector() { | ||
} | ||
|
||
/** | ||
* @description The instance `LoggerConfigurationDataSelector` used for any querying specific to the configuration layer | ||
* @return The singleton instance of `LoggerConfigurationDataSelector` | ||
*/ | ||
public static LoggerConfigurationDataSelector getInstance() { | ||
return instance; | ||
} | ||
|
||
// TODO decide if LoggerSettings__c should be here (I don't think so) | ||
public virtual List<LogEntryDataMaskRule__mdt> getLogEntryDataMaskRules() { | ||
return LogEntryDataMaskRule__mdt.getAll().values(); | ||
} | ||
|
||
public virtual List<LogEntryTagRule__mdt> getLogEntryTagRules() { | ||
return LogEntryTagRule__mdt.getAll().values(); | ||
} | ||
|
||
// public virtual List<LoggerFieldMapping__mdt> getLoggerFieldMappings() { | ||
// return [ | ||
// SELECT | ||
// DeveloperName, | ||
// IsEnabled__c, | ||
// SourceSObjectType__r.QualifiedApiName, | ||
// SourceField__r.QualifiedApiName, | ||
// TargetSObjectType__r.QualifiedApiName, | ||
// TargetField__r.QualifiedApiName | ||
// FROM LoggerFieldMapping__mdt | ||
// WHERE IsEnabled__c = TRUE | ||
// ]; | ||
// } | ||
|
||
public virtual List<LoggerParameter__mdt> getLoggerParameters() { | ||
return LoggerParameter__mdt.getAll().values(); | ||
} | ||
|
||
public virtual List<LoggerPlugin__mdt> getLoggerPlugins() { | ||
return LoggerPlugin__mdt.getAll().values(); | ||
} | ||
|
||
public virtual List<LoggerScenarioRule__mdt> getLoggerScenarioRules() { | ||
return LoggerScenarioRule__mdt.getAll().values(); | ||
} | ||
|
||
public virtual List<LoggerSObjectHandler__mdt> getLoggerSObjectHandlers() { | ||
return LoggerSObjectHandler__mdt.getAll().values(); | ||
} | ||
|
||
public virtual List<LogStatus__mdt> getLogStatuses() { | ||
return LogStatus__mdt.getAll().values(); | ||
} | ||
|
||
@TestVisible | ||
private static void setMock(LoggerConfigurationDataSelector mockSelectorInstance) { | ||
instance = mockSelectorInstance; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
nebula-logger/core/main/configuration/classes/LoggerConfigurationDataSelector.cls-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>61.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
29 changes: 29 additions & 0 deletions
29
nebula-logger/extra-tests/customMetadata/LogEntryDataMaskRule.SomeExample.md-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<CustomMetadata | ||
xmlns="http://soap.sforce.com/2006/04/metadata" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
> | ||
<label>Mastercard Credit Card Number</label> | ||
<protected>false</protected> | ||
<values> | ||
<field>ApplyToMessage__c</field> | ||
<value xsi:type="xsd:boolean">true</value> | ||
</values> | ||
<values> | ||
<field>ApplyToRecordJson__c</field> | ||
<value xsi:type="xsd:boolean">true</value> | ||
</values> | ||
<values> | ||
<field>IsEnabled__c</field> | ||
<value xsi:type="xsd:boolean">true</value> | ||
</values> | ||
<values> | ||
<field>ReplacementRegEx__c</field> | ||
<value xsi:type="xsd:string">$1****-****-****-$5</value> | ||
</values> | ||
<values> | ||
<field>SensitiveDataRegEx__c</field> | ||
<value xsi:type="xsd:string">(^|[ ])(5\d{3})[- ]*(\d{4})[- ]*(\d{4})[- ]*(\d{4})</value> | ||
</values> | ||
</CustomMetadata> |
31 changes: 31 additions & 0 deletions
31
nebula-logger/extra-tests/customMetadata/LogEntryTagRule.SomeExample.md-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<label>Some Example</label> | ||
<protected>false</protected> | ||
<values> | ||
<field>ComparisonType__c</field> | ||
<value xsi:type="xsd:string">CONTAINS</value> | ||
</values> | ||
<values> | ||
<field>ComparisonValue__c</field> | ||
<value xsi:type="xsd:string">some value</value> | ||
</values> | ||
<values> | ||
<field>IsEnabled__c</field> | ||
<value xsi:type="xsd:boolean">true</value> | ||
</values> | ||
<values> | ||
<field>SObjectField__c</field> | ||
<value xsi:type="xsd:string">Message__c</value> | ||
</values> | ||
<values> | ||
<field>SObjectType__c</field> | ||
<value xsi:type="xsd:string">LogEntry__c</value> | ||
</values> | ||
<values> | ||
<field>Tags__c</field> | ||
<value xsi:type="xsd:string">Special tag | ||
Another tag | ||
And yet again, one more tag</value> | ||
</values> | ||
</CustomMetadata> |
21 changes: 21 additions & 0 deletions
21
nebula-logger/extra-tests/customMetadata/LogStatus.SomeExample.md-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<CustomMetadata | ||
xmlns="http://soap.sforce.com/2006/04/metadata" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
> | ||
<label>Some Example</label> | ||
<protected>false</protected> | ||
<values> | ||
<field>IsActive__c</field> | ||
<value xsi:type="xsd:boolean">true</value> | ||
</values> | ||
<values> | ||
<field>IsClosed__c</field> | ||
<value xsi:type="xsd:boolean">true</value> | ||
</values> | ||
<values> | ||
<field>IsResolved__c</field> | ||
<value xsi:type="xsd:boolean">true</value> | ||
</values> | ||
</CustomMetadata> |
25 changes: 25 additions & 0 deletions
25
nebula-logger/extra-tests/customMetadata/LoggerFieldMapping.SomeExample.md-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<label>Some Example</label> | ||
<protected>false</protected> | ||
<values> | ||
<field>IsEnabled__c</field> | ||
<value xsi:type="xsd:boolean">true</value> | ||
</values> | ||
<values> | ||
<field>SourceField__c</field> | ||
<value xsi:type="xsd:string">Message__c</value> | ||
</values> | ||
<values> | ||
<field>SourceSObjectType__c</field> | ||
<value xsi:type="xsd:string">LogEntryEvent__e</value> | ||
</values> | ||
<values> | ||
<field>TargetField__c</field> | ||
<value xsi:type="xsd:string">Message__c</value> | ||
</values> | ||
<values> | ||
<field>TargetSObjectType__c</field> | ||
<value xsi:type="xsd:string">LogEntry__c</value> | ||
</values> | ||
</CustomMetadata> |
21 changes: 21 additions & 0 deletions
21
nebula-logger/extra-tests/customMetadata/LoggerParameter.SomeExample.md-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<CustomMetadata | ||
xmlns="http://soap.sforce.com/2006/04/metadata" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
> | ||
<label>Some Example</label> | ||
<protected>false</protected> | ||
<values> | ||
<field>Comments__c</field> | ||
<value xsi:nil="true" /> | ||
</values> | ||
<values> | ||
<field>Description__c</field> | ||
<value xsi:nil="true" /> | ||
</values> | ||
<values> | ||
<field>Value__c</field> | ||
<value xsi:type="xsd:string">Some example value</value> | ||
</values> | ||
</CustomMetadata> |
61 changes: 61 additions & 0 deletions
61
nebula-logger/extra-tests/customMetadata/LoggerPlugin.SomeExample.md-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<label>Some Example</label> | ||
<protected>true</protected> | ||
<values> | ||
<field>BatchPurgerApexClass__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>BatchPurgerExecutionOrder__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>BatchPurgerFlowName__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>Description__c</field> | ||
<value xsi:type="xsd:string">Some example plugin configuration</value> | ||
</values> | ||
<values> | ||
<field>ExecutionOrder__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>IsEnabled__c</field> | ||
<value xsi:type="xsd:boolean">true</value> | ||
</values> | ||
<values> | ||
<field>Link__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>PluginApiName__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>PluginType__c</field> | ||
<value xsi:type="xsd:string">Apex</value> | ||
</values> | ||
<values> | ||
<field>SObjectHandlerApexClass__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>SObjectHandlerExecutionOrder__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>SObjectHandlerFlowName__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>SObjectType__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>VersionNumber__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
</CustomMetadata> |
25 changes: 25 additions & 0 deletions
25
nebula-logger/extra-tests/customMetadata/LoggerSObjectHandler.SomeExample.md-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<CustomMetadata | ||
xmlns="http://soap.sforce.com/2006/04/metadata" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
> | ||
<label>Some Example config</label> | ||
<protected>false</protected> | ||
<values> | ||
<field>IsEnabled__c</field> | ||
<value xsi:type="xsd:boolean">true</value> | ||
</values> | ||
<values> | ||
<field>SObjectHandlerApexClass__c</field> | ||
<value xsi:type="xsd:string">SomeOtherHandler</value> | ||
</values> | ||
<values> | ||
<field>SObjectTypeOverride__c</field> | ||
<value xsi:type="xsd:string">Account</value> | ||
</values> | ||
<values> | ||
<field>SObjectType__c</field> | ||
<value xsi:nil="true" /> | ||
</values> | ||
</CustomMetadata> |
77 changes: 77 additions & 0 deletions
77
nebula-logger/extra-tests/customMetadata/LoggerScenarioRule.SomeExample.md-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<label>Some Example</label> | ||
<protected>false</protected> | ||
<values> | ||
<field>EndTime__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>IsAnonymousModeEnabled__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>IsApexSystemDebugLoggingEnabled__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>IsDataMaskingEnabled__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>IsEnabled__c</field> | ||
<value xsi:type="xsd:boolean">true</value> | ||
</values> | ||
<values> | ||
<field>IsJavaScriptConsoleLoggingEnabled__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>IsLogAssignmentEnabled__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>IsLogRetentionOverrideEnabled__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>IsLoggerEnabled__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>IsPlatformEventStorageLocationEnabled__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>IsRecordFieldStrippingEnabled__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>IsSavingEnabled__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>NumberOfDaysToRetainLogs__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>PlatformEventStorageLocation__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>SaveMethod__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>Scenario__c</field> | ||
<value xsi:type="xsd:string">Some example scenario</value> | ||
</values> | ||
<values> | ||
<field>StartTime__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>UserLoggingLevel__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
</CustomMetadata> |
Oops, something went wrong.