diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..a9b2e5058 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @jongpie \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0e8d514f..8ed152ae6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -235,8 +235,8 @@ jobs: run: npm run org:delete:noprompt if: ${{ always() }} - create-unlocked-package-release-candidate: - name: 'Create Core Package Release Candidate' + create-managed-package-beta: + name: 'Create Managed Package Beta' needs: [lwc-tests, base-scratch-org-tests, experience-cloud-scratch-org-tests] if: ${{ github.ref != 'refs/heads/main' }} runs-on: ubuntu-latest @@ -272,31 +272,12 @@ jobs: DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }} DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }} - - name: 'Authorize Demo Org' - shell: bash - run: | - echo ${{ env.PKG_DEMO_ORG_SFDX_URL }} > ./PKG_DEMO_ORG_SFDX_URL.txt - npx sfdx auth:sfdxurl:store --sfdxurlfile ./PKG_DEMO_ORG_SFDX_URL.txt --setalias nebula-logger-package-demo - env: - PKG_DEMO_ORG_SFDX_URL: ${{ secrets.NEBULA_PKG_DEMO_SANDBOX_SFDX_URL }} - - - name: 'Create & Install Package Version' - run: npx pwsh ./scripts/build/create-and-install-package-version.ps1 -targetpackagealias '"Nebula Logger - Core"' -targetreadme ./README.md -targetusername nebula-logger-package-demo - - - name: 'Commit New Package Version' - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action Bot" - npm run sfdx:plugins:link:bummer - npx sfdx bummer:package:aliases:sort - npx prettier --write ./sfdx-project.json - git add ./sfdx-project.json - git commit -m "Created new package version" - git push + - name: 'Create Beta Managed Package Version' + run: npm run package:version:create:managed - create-managed-package-beta: - name: 'Create Managed Package Beta' - needs: [lwc-tests, base-scratch-org-tests, experience-cloud-scratch-org-tests] + create-unlocked-package-release-candidate: + name: 'Create Core Package Release Candidate' + needs: [create-managed-package-beta] if: ${{ github.ref != 'refs/heads/main' }} runs-on: ubuntu-latest environment: 'Demo Org' @@ -331,8 +312,27 @@ jobs: DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }} DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }} - - name: 'Create Beta Managed Package Version' - run: npm run package:version:create:managed + - name: 'Authorize Demo Org' + shell: bash + run: | + echo ${{ env.PKG_DEMO_ORG_SFDX_URL }} > ./PKG_DEMO_ORG_SFDX_URL.txt + npx sfdx auth:sfdxurl:store --sfdxurlfile ./PKG_DEMO_ORG_SFDX_URL.txt --setalias nebula-logger-package-demo + env: + PKG_DEMO_ORG_SFDX_URL: ${{ secrets.NEBULA_PKG_DEMO_SANDBOX_SFDX_URL }} + + - name: 'Create & Install Package Version' + run: npx pwsh ./scripts/build/create-and-install-package-version.ps1 -targetpackagealias '"Nebula Logger - Core"' -targetreadme ./README.md -targetusername nebula-logger-package-demo + + - name: 'Commit New Package Version' + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action Bot" + npm run sfdx:plugins:link:bummer + npx sfdx bummer:package:aliases:sort + npx prettier --write ./sfdx-project.json + git add ./sfdx-project.json + git commit -m "Created new package version" + git push promote-package-versions: name: 'Promote Package Versions' diff --git a/README.md b/README.md index 8fa307f18..d5d37e128 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ Designed for Salesforce admins, developers & architects. A robust logger for Apex, Lightning Components, Flow, Process Builder & Integrations. -## Unlocked Package - v4.7.1 +## Unlocked Package - v4.7.2 -[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lgBQAQ) -[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lgBQAQ) +[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lhdQAA) +[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lhdQAA) [![View Documentation](./images/btn-view-documentation.png)](https://jongpie.github.io/NebulaLogger/) ## Managed Package - v4.7.0 diff --git a/config/linters/lint-staged.config.js b/config/linters/lint-staged.config.js index 6951981ea..c3f818655 100644 --- a/config/linters/lint-staged.config.js +++ b/config/linters/lint-staged.config.js @@ -7,6 +7,7 @@ module.exports = { return [`eslint --config ./config/linters/.eslintrc.json ${filenames.join(' ')} --fix`, `npm run test:lwc`]; }, '*.{cls,trigger}': () => { - return [`npm run lint:verify:apex`, `npm run docs:fix && git add ./docs/ && git commit --amend --no-edit`]; + return [`npm run lint:verify:apex`]; + // return [`npm run lint:verify:apex`, `npm run docs:fix && git add ./docs/ && git commit --amend --no-edit`]; } }; diff --git a/docs/apex/Test-Utilities/LoggerMockDataCreator.md b/docs/apex/Test-Utilities/LoggerMockDataCreator.md index 3c1ede437..292d962a2 100644 --- a/docs/apex/Test-Utilities/LoggerMockDataCreator.md +++ b/docs/apex/Test-Utilities/LoggerMockDataCreator.md @@ -18,27 +18,7 @@ Utility class used to help with generating mock data when writing Apex tests for #### `createAggregateResult()` → `AggregateResult` -Instances of `AggregateResult` can not be created directly in Apex. This method uses a workaround to generate a mock. - -##### Return - -**Type** - -AggregateResult - -**Description** - -The mock instance of `AggregateResult` - -#### `createAggregateResult(Map mockAggregateKeyValues)` → `AggregateResult` - -Instances of `AggregateResult` can not be created directly in Apex. This method uses a workaround to generate a mock, using the provided map of aliases & aggregate values - -##### Parameters - -| Param | Description | -| ------------------------ | --------------------------------------------------------------------------------------- | -| `mockAggregateKeyValues` | A map of aliases & aggregate values to use when creating the mock `AggregateResult` | +Instances of `AggregateResult` can not be created directly in Apex. This method uses a workaround to generate a mock, although it will not have any fields or aggregate values populated on the object. ##### Return @@ -611,7 +591,7 @@ A new copy of the original `SObject` record that has the specified read-only fie #### LoggerMockDataCreator.SObjectTestDataBuilder class -Class used to create or update an `SObject` record with static fake data. This is useful in situations where you need to have fields populated, but the specific values used are not relevant to a particular test. This class can be used when Apex writing tests for plugins. +Class used to create or update an `SObject` record with static fake data. This is useful in situations where you need to have fields populated, but the specific values used are not relevant to a particular test method. This class can be used when Apex writing tests for plugins. --- diff --git a/nebula-logger/core/main/configuration/layouts/LoggerSObjectHandler__mdt-Logger SObject Handler Layout.layout-meta.xml b/nebula-logger/core/main/configuration/layouts/LoggerSObjectHandler__mdt-Logger SObject Handler Layout.layout-meta.xml index 055e5a5c6..d274e2a70 100644 --- a/nebula-logger/core/main/configuration/layouts/LoggerSObjectHandler__mdt-Logger SObject Handler Layout.layout-meta.xml +++ b/nebula-logger/core/main/configuration/layouts/LoggerSObjectHandler__mdt-Logger SObject Handler Layout.layout-meta.xml @@ -18,6 +18,10 @@ Required SObjectHandlerApexClass__c + + Edit + SObjectTypeOverride__c + diff --git a/nebula-logger/core/main/configuration/objects/LoggerSObjectHandler__mdt/fields/SObjectTypeOverride__c.field-meta.xml b/nebula-logger/core/main/configuration/objects/LoggerSObjectHandler__mdt/fields/SObjectTypeOverride__c.field-meta.xml new file mode 100644 index 000000000..fc048f435 --- /dev/null +++ b/nebula-logger/core/main/configuration/objects/LoggerSObjectHandler__mdt/fields/SObjectTypeOverride__c.field-meta.xml @@ -0,0 +1,15 @@ + + + SObjectTypeOverride__c + Not all base platform types can be selected using the SObjectType picklist. If your object is not supported, supply the API name for the object here instead. + false + SubscriberControlled + Not all base platform types can be selected using the SObjectType picklist. If your object is not supported, supply the API name for the object here instead. + + 255 + false + Text + false + diff --git a/nebula-logger/core/main/configuration/objects/LoggerSObjectHandler__mdt/fields/SObjectType__c.field-meta.xml b/nebula-logger/core/main/configuration/objects/LoggerSObjectHandler__mdt/fields/SObjectType__c.field-meta.xml index 2bcd98bfb..80c5bd339 100644 --- a/nebula-logger/core/main/configuration/objects/LoggerSObjectHandler__mdt/fields/SObjectType__c.field-meta.xml +++ b/nebula-logger/core/main/configuration/objects/LoggerSObjectHandler__mdt/fields/SObjectType__c.field-meta.xml @@ -7,7 +7,7 @@ EntityDefinition Logger SObject Handler Configurations LoggerSObjectHandlerConfigurations - true + false MetadataRelationship true diff --git a/nebula-logger/core/main/log-management/classes/LogBatchPurger.cls b/nebula-logger/core/main/log-management/classes/LogBatchPurger.cls index 747f39549..f843b8e8d 100644 --- a/nebula-logger/core/main/log-management/classes/LogBatchPurger.cls +++ b/nebula-logger/core/main/log-management/classes/LogBatchPurger.cls @@ -25,7 +25,7 @@ global with sharing class LogBatchPurger implements Database.Batchable, @TestVisible private Integer chainedBatchSize = 200; @TestVisible - private SObjectType currentSObjectType; + private Schema.SObjectType currentSObjectType; private List pluginConfigurations; private Map> methodToExecutedApexPlugins = new Map>(); private Map> methodToExecutedFlowPlugins = new Map>(); @@ -244,7 +244,6 @@ global with sharing class LogBatchPurger implements Database.Batchable, } } - @SuppressWarnings('PMD.AvoidDebugStatements') private void executeApexPlugin(BatchableMethod method, LoggerPlugin__mdt pluginConfiguration, LoggerBatchableContext input, List scopeRecords) { if (String.isBlank(pluginConfiguration.BatchPurgerApexClass__c) == true) { return; @@ -274,7 +273,6 @@ global with sharing class LogBatchPurger implements Database.Batchable, } } - @SuppressWarnings('PMD.AvoidDebugStatements') private void executeFlowPlugin(BatchableMethod method, LoggerPlugin__mdt pluginConfiguration, LoggerBatchableContext input, List scopeRecords) { if (String.isBlank(pluginConfiguration.BatchPurgerFlowName__c) == true) { return; diff --git a/nebula-logger/core/main/log-management/classes/LogEntryEventHandler.cls b/nebula-logger/core/main/log-management/classes/LogEntryEventHandler.cls index b4054d678..bc8e2bb46 100644 --- a/nebula-logger/core/main/log-management/classes/LogEntryEventHandler.cls +++ b/nebula-logger/core/main/log-management/classes/LogEntryEventHandler.cls @@ -7,18 +7,29 @@ * @group Log Management * @description Processes `LogEntryEvent__e` platform events and normalizes the data into `Log__c` and `LogEntry__c` records */ -@SuppressWarnings('PMD.ApexCrudViolation, PMD.AvoidDebugStatements, PMD.CognitiveComplexity, PMD.CyclomaticComplexity') +@SuppressWarnings( + 'PMD.ApexCrudViolation, PMD.CognitiveComplexity, PMD.CyclomaticComplexity, PMD.FieldDeclarationsShouldBeAtStart, PMD.PropertyNamingConventions' +) public without sharing class LogEntryEventHandler extends LoggerSObjectHandler { @TestVisible private static final String DEFAULT_STORAGE_LOCATION_NAME = 'CUSTOM_OBJECTS'; private static final Database.DmlOptions DML_OPTIONS = createDmlOptions(); + private static final String GUEST_USER_LICENSE_NAME = 'Guest User License'; private static final Map TRANSACTION_ID_TO_LOG = new Map(); + @TestVisible - private static final List TAG_ASSIGNMENT_RULES = getTagAssignmentRules(); + private static List TAG_ASSIGNMENT_RULES { + get { + if (TAG_ASSIGNMENT_RULES == null) { + TAG_ASSIGNMENT_RULES = getTagAssignmentRules(); + } + return TAG_ASSIGNMENT_RULES; + } + set; + } @TestVisible private List logEntryEvents; - private List logEntries = new List(); private Map> logEntryEventUuidToTagNames = new Map>(); private Set tagNames = new Set(); @@ -34,7 +45,7 @@ public without sharing class LogEntryEventHandler extends LoggerSObjectHandler { * @description Returns SObject Type that the handler is responsible for processing * @return The instance of `SObjectType` */ - public override SObjectType getSObjectType() { + public override Schema.SObjectType getSObjectType() { return Schema.LogEntryEvent__e.SObjectType; } @@ -73,70 +84,63 @@ public without sharing class LogEntryEventHandler extends LoggerSObjectHandler { continue; } - Log__c parentLog = new Log__c(TransactionId__c = logEntryEvent.ParentLogTransactionId__c); - Log__c log = new Log__c(); - - // Guest users cannot own records, so keep the log owner as the current user (Automated Process) - String guestUserLicenseName = 'Guest User License'; - Id logOwnerId; - if (logEntryEvent.UserLicenseName__c == guestUserLicenseName || String.isBlank(logEntryEvent.CreatedById)) { + Id logOwnerId = logEntryEvent.CreatedById; + if (logEntryEvent.UserLicenseName__c == GUEST_USER_LICENSE_NAME || String.isBlank(logEntryEvent.CreatedById)) { + // Guest users cannot own records, so keep the log owner as the current user (Automated Process) logOwnerId = UserInfo.getUserId(); - } else { - logOwnerId = logEntryEvent.CreatedById; } - if (recentLogWithApiReleaseDetails != null) { - log.ApiReleaseNumber__c = recentLogWithApiReleaseDetails.ApiReleaseNumber__c; - log.ApiReleaseVersion__c = recentLogWithApiReleaseDetails.ApiReleaseVersion__c; - } - - log.ApiVersion__c = logEntryEvent.ApiVersion__c; - log.Locale__c = logEntryEvent.Locale__c; - log.LoggedBy__c = logEntryEvent.LoggedById__c; - log.LoggedByUsername__c = logEntryEvent.LoggedByUsername__c; - log.LoggerVersionNumber__c = logEntryEvent.LoggerVersionNumber__c; - log.LoginApplication__c = logEntryEvent.LoginApplication__c; - log.LoginBrowser__c = logEntryEvent.LoginBrowser__c; - log.LoginDomain__c = logEntryEvent.LoginDomain__c; - log.LoginHistoryId__c = logEntryEvent.LoginHistoryId__c; - log.LoginPlatform__c = logEntryEvent.LoginPlatform__c; - log.LoginType__c = logEntryEvent.LoginType__c; - log.LogoutUrl__c = logEntryEvent.LogoutUrl__c; - log.NetworkId__c = logEntryEvent.NetworkId__c; - log.NetworkLoginUrl__c = logEntryEvent.NetworkLoginUrl__c; - log.NetworkLogoutUrl__c = logEntryEvent.NetworkLogoutUrl__c; - log.NetworkName__c = logEntryEvent.NetworkName__c; - log.NetworkSelfRegistrationUrl__c = logEntryEvent.NetworkSelfRegistrationUrl__c; - log.NetworkUrlPathPrefix__c = logEntryEvent.NetworkUrlPathPrefix__c; - log.OrganizationDomainUrl__c = logEntryEvent.OrganizationDomainUrl__c; - log.OrganizationEnvironmentType__c = logEntryEvent.OrganizationEnvironmentType__c; - log.OrganizationId__c = logEntryEvent.OrganizationId__c; - log.OrganizationInstanceName__c = logEntryEvent.OrganizationInstanceName__c; - log.OrganizationName__c = logEntryEvent.OrganizationName__c; - log.OrganizationNamespacePrefix__c = logEntryEvent.OrganizationNamespacePrefix__c; - log.OrganizationType__c = logEntryEvent.OrganizationType__c; - log.OwnerId = logOwnerId; - log.ParentLog__r = logEntryEvent.ParentLogTransactionId__c == null ? null : parentLog; - log.ProfileId__c = logEntryEvent.ProfileId__c; - log.ProfileName__c = logEntryEvent.ProfileName__c; - log.Scenario__c = logEntryEvent.Scenario__c; - log.SessionId__c = logEntryEvent.SessionId__c; - log.SessionSecurityLevel__c = logEntryEvent.SessionSecurityLevel__c; - log.SessionType__c = logEntryEvent.SessionType__c; - log.SourceIp__c = logEntryEvent.SourceIp__c; - log.SystemMode__c = logEntryEvent.SystemMode__c; - log.ThemeDisplayed__c = logEntryEvent.ThemeDisplayed__c; - log.TimeZoneId__c = logEntryEvent.TimeZoneId__c; - log.TimeZoneName__c = logEntryEvent.TimeZoneName__c; - log.TransactionId__c = logEntryEvent.TransactionId__c; - log.UserLicenseDefinitionKey__c = logEntryEvent.UserLicenseDefinitionKey__c; - log.UserLicenseId__c = logEntryEvent.UserLicenseId__c; - log.UserLicenseName__c = logEntryEvent.UserLicenseName__c; - log.UserLoggingLevel__c = logEntryEvent.UserLoggingLevel__c; - log.UserLoggingLevelOrdinal__c = logEntryEvent.UserLoggingLevelOrdinal__c; - log.UserRoleId__c = logEntryEvent.UserRoleId__c; - log.UserRoleName__c = logEntryEvent.UserRoleName__c; - log.UserType__c = logEntryEvent.UserType__c; + Log__c log = new Log__c( + ApiReleaseNumber__c = recentLogWithApiReleaseDetails?.ApiReleaseNumber__c, + ApiReleaseVersion__c = recentLogWithApiReleaseDetails?.ApiReleaseVersion__c, + ApiVersion__c = logEntryEvent.ApiVersion__c, + Locale__c = logEntryEvent.Locale__c, + LoggedBy__c = logEntryEvent.LoggedById__c, + LoggedByUsername__c = logEntryEvent.LoggedByUsername__c, + LoggerVersionNumber__c = logEntryEvent.LoggerVersionNumber__c, + LoginApplication__c = logEntryEvent.LoginApplication__c, + LoginBrowser__c = logEntryEvent.LoginBrowser__c, + LoginDomain__c = logEntryEvent.LoginDomain__c, + LoginHistoryId__c = logEntryEvent.LoginHistoryId__c, + LoginPlatform__c = logEntryEvent.LoginPlatform__c, + LoginType__c = logEntryEvent.LoginType__c, + LogoutUrl__c = logEntryEvent.LogoutUrl__c, + NetworkId__c = logEntryEvent.NetworkId__c, + NetworkLoginUrl__c = logEntryEvent.NetworkLoginUrl__c, + NetworkLogoutUrl__c = logEntryEvent.NetworkLogoutUrl__c, + NetworkName__c = logEntryEvent.NetworkName__c, + NetworkSelfRegistrationUrl__c = logEntryEvent.NetworkSelfRegistrationUrl__c, + NetworkUrlPathPrefix__c = logEntryEvent.NetworkUrlPathPrefix__c, + OrganizationDomainUrl__c = logEntryEvent.OrganizationDomainUrl__c, + OrganizationEnvironmentType__c = logEntryEvent.OrganizationEnvironmentType__c, + OrganizationId__c = logEntryEvent.OrganizationId__c, + OrganizationInstanceName__c = logEntryEvent.OrganizationInstanceName__c, + OrganizationName__c = logEntryEvent.OrganizationName__c, + OrganizationNamespacePrefix__c = logEntryEvent.OrganizationNamespacePrefix__c, + OrganizationType__c = logEntryEvent.OrganizationType__c, + OwnerId = logOwnerId, + ParentLogTransactionId__c = logEntryEvent.ParentLogTransactionId__c, + ProfileId__c = logEntryEvent.ProfileId__c, + ProfileName__c = logEntryEvent.ProfileName__c, + Scenario__c = logEntryEvent.Scenario__c, + SessionId__c = logEntryEvent.SessionId__c, + SessionSecurityLevel__c = logEntryEvent.SessionSecurityLevel__c, + SessionType__c = logEntryEvent.SessionType__c, + SourceIp__c = logEntryEvent.SourceIp__c, + SystemMode__c = logEntryEvent.SystemMode__c, + ThemeDisplayed__c = logEntryEvent.ThemeDisplayed__c, + TimeZoneId__c = logEntryEvent.TimeZoneId__c, + TimeZoneName__c = logEntryEvent.TimeZoneName__c, + TransactionId__c = logEntryEvent.TransactionId__c, + UserLicenseDefinitionKey__c = logEntryEvent.UserLicenseDefinitionKey__c, + UserLicenseId__c = logEntryEvent.UserLicenseId__c, + UserLicenseName__c = logEntryEvent.UserLicenseName__c, + UserLoggingLevel__c = logEntryEvent.UserLoggingLevel__c, + UserLoggingLevelOrdinal__c = logEntryEvent.UserLoggingLevelOrdinal__c, + UserRoleId__c = logEntryEvent.UserRoleId__c, + UserRoleName__c = logEntryEvent.UserRoleName__c, + UserType__c = logEntryEvent.UserType__c + ); TRANSACTION_ID_TO_LOG.put(log.TransactionId__c, log); } @@ -368,6 +372,10 @@ public without sharing class LogEntryEventHandler extends LoggerSObjectHandler { } private static List getTagAssignmentRules() { + if (LogEntryTagRule__mdt.getAll().isEmpty() == true) { + return new List(); + } + List tagAssignmentRules = [ SELECT Id, SObjectField__r.QualifiedApiName, ComparisonType__c, ComparisonValue__c, Tags__c FROM LogEntryTagRule__mdt @@ -420,11 +428,7 @@ public without sharing class LogEntryEventHandler extends LoggerSObjectHandler { LIMIT 1 ]; - if (logs.isEmpty()) { - return null; - } else { - return logs.get(0); - } + return logs.isEmpty() == true ? null : logs.get(0); } private static Integer getCountOfOpenJobs() { diff --git a/nebula-logger/core/main/log-management/classes/LogEntryFieldSetPicklist.cls b/nebula-logger/core/main/log-management/classes/LogEntryFieldSetPicklist.cls index d470d2f10..96dc9ecc1 100644 --- a/nebula-logger/core/main/log-management/classes/LogEntryFieldSetPicklist.cls +++ b/nebula-logger/core/main/log-management/classes/LogEntryFieldSetPicklist.cls @@ -24,8 +24,8 @@ public without sharing class LogEntryFieldSetPicklist extends VisualEditor.Dynam public override VisualEditor.DynamicPickListRows getValues() { VisualEditor.DynamicPickListRows picklistRows = new VisualEditor.DynamicPickListRows(); - List
fieldSets = Schema.SObjectType.LogEntry__c.fieldSets.getMap().values(); - for (FieldSet fieldSet : fieldSets) { + List fieldSets = Schema.SObjectType.LogEntry__c.fieldSets.getMap().values(); + for (Schema.FieldSet fieldSet : fieldSets) { String namespacePrefix = String.isBlank(fieldSet.getNameSpace()) ? '' : fieldSet.getNameSpace() + '__'; VisualEditor.DataRow picklistRow = new VisualEditor.DataRow(fieldSet.getLabel(), namespacePrefix + fieldSet.getName()); diff --git a/nebula-logger/core/main/log-management/classes/LogEntryHandler.cls b/nebula-logger/core/main/log-management/classes/LogEntryHandler.cls index d31a8897b..f9a4ed0dc 100644 --- a/nebula-logger/core/main/log-management/classes/LogEntryHandler.cls +++ b/nebula-logger/core/main/log-management/classes/LogEntryHandler.cls @@ -18,7 +18,7 @@ public without sharing class LogEntryHandler extends LoggerSObjectHandler { * @description Returns SObject Type that the handler is responsible for processing * @return The instance of `SObjectType` */ - public override SObjectType getSObjectType() { + public override Schema.SObjectType getSObjectType() { return Schema.LogEntry__c.SObjectType; } diff --git a/nebula-logger/core/main/log-management/classes/LogEntryTagHandler.cls b/nebula-logger/core/main/log-management/classes/LogEntryTagHandler.cls index 014b67f9c..40ee83902 100644 --- a/nebula-logger/core/main/log-management/classes/LogEntryTagHandler.cls +++ b/nebula-logger/core/main/log-management/classes/LogEntryTagHandler.cls @@ -17,7 +17,7 @@ public without sharing class LogEntryTagHandler extends LoggerSObjectHandler { * @description Returns SObject Type that the handler is responsible for processing * @return The instance of `SObjectType` */ - public override SObjectType getSObjectType() { + public override Schema.SObjectType getSObjectType() { return Schema.LogEntryTag__c.SObjectType; } diff --git a/nebula-logger/core/main/log-management/classes/LogHandler.cls b/nebula-logger/core/main/log-management/classes/LogHandler.cls index bd7b7ab2e..d7df35ac0 100644 --- a/nebula-logger/core/main/log-management/classes/LogHandler.cls +++ b/nebula-logger/core/main/log-management/classes/LogHandler.cls @@ -21,7 +21,7 @@ public without sharing class LogHandler extends LoggerSObjectHandler { * @description Returns SObject Type that the handler is responsible for processing * @return The instance of `SObjectType` */ - public override SObjectType getSObjectType() { + public override Schema.SObjectType getSObjectType() { return Schema.Log__c.SObjectType; } @@ -31,6 +31,7 @@ public without sharing class LogHandler extends LoggerSObjectHandler { this.setClosedStatusFields(); // The log OwnerId field should support being manually changed, so only auto-set it on insert this.setOwnerId(); + this.setParentLog(); // The log retention date field should support being manually changed, so only auto-set it on insert this.setLogRetentionDetails(); } @@ -105,6 +106,30 @@ public without sharing class LogHandler extends LoggerSObjectHandler { } } + private void setParentLog() { + Set parentLogTransactionIds = new Set(); + for (Log__c log : this.logs) { + if (String.isNotBlank(log.ParentLogTransactionId__c) == true) { + parentLogTransactionIds.add(log.ParentLogTransactionId__c); + } + } + + if (parentLogTransactionIds.isEmpty() == true) { + return; + } + + Map parentLogTransactionIdToRecordId = new Map(); + for (Log__c parentLog : [SELECT Id, TransactionId__c FROM Log__c WHERE TransactionId__c IN :parentLogTransactionIds]) { + parentLogTransactionIdToRecordId.put(parentLog.TransactionId__c, parentLog.Id); + } + + for (Log__c log : this.logs) { + if (String.isNotBlank(log.ParentLogTransactionId__c) == true) { + log.ParentLog__c = parentLogTransactionIdToRecordId.get(log.ParentLogTransactionId__c); + } + } + } + private void setLogRetentionDetails() { Map scenarioToScenarioRule = queryScenarioRules(this.logs); for (Log__c log : this.logs) { diff --git a/nebula-logger/core/main/log-management/classes/LoggerEmailSender.cls b/nebula-logger/core/main/log-management/classes/LoggerEmailSender.cls index 916e11692..cde783a2e 100644 --- a/nebula-logger/core/main/log-management/classes/LoggerEmailSender.cls +++ b/nebula-logger/core/main/log-management/classes/LoggerEmailSender.cls @@ -74,7 +74,6 @@ public without sharing class LoggerEmailSender { sendErrorEmail(sobjectType, errorMessages); } - @SuppressWarnings('PMD.AvoidDebugStatements') private static void sendErrorEmail(Schema.SObjectType sobjectType, List errorMessages) { if (errorMessages.isEmpty() == true) { return; @@ -118,7 +117,6 @@ public without sharing class LoggerEmailSender { return errorMessages; } - @SuppressWarnings('PMD.AvoidDebugStatements') private static void sendEmail(Messaging.SingleEmailMessage message) { if (IS_EMAIL_DELIVERABILITY_ENABLED == true) { List messages = new List{ message }; diff --git a/nebula-logger/core/main/log-management/classes/LoggerTagHandler.cls b/nebula-logger/core/main/log-management/classes/LoggerTagHandler.cls index 72316d4ef..80fd8df90 100644 --- a/nebula-logger/core/main/log-management/classes/LoggerTagHandler.cls +++ b/nebula-logger/core/main/log-management/classes/LoggerTagHandler.cls @@ -17,7 +17,7 @@ public without sharing class LoggerTagHandler extends LoggerSObjectHandler { * @description Returns SObject Type that the handler is responsible for processing * @return The instance of `SObjectType` */ - public override SObjectType getSObjectType() { + public override Schema.SObjectType getSObjectType() { return Schema.LoggerTag__c.SObjectType; } diff --git a/nebula-logger/core/main/log-management/classes/RelatedLogEntriesController.cls b/nebula-logger/core/main/log-management/classes/RelatedLogEntriesController.cls index e48f92a66..f964d3347 100644 --- a/nebula-logger/core/main/log-management/classes/RelatedLogEntriesController.cls +++ b/nebula-logger/core/main/log-management/classes/RelatedLogEntriesController.cls @@ -9,8 +9,8 @@ */ @SuppressWarnings('PMD.ExcessivePublicCount') public with sharing class RelatedLogEntriesController { - private static final SObjectType LOG_SOBJECT_TYPE = Schema.Log__c.SObjectType; - private static final SObjectType LOG_ENTRY_SOBJECT_TYPE = Schema.LogEntry__c.SObjectType; + private static final Schema.SObjectType LOG_SOBJECT_TYPE = Schema.Log__c.SObjectType; + private static final Schema.SObjectType LOG_ENTRY_SOBJECT_TYPE = Schema.LogEntry__c.SObjectType; private static final String DEFAULT_SORT_FIELD_NAME = String.valueOf(Schema.LogEntry__c.Timestamp__c); private static final String DEFAULT_SORT_DIRECTION = 'DESC'; @@ -107,7 +107,6 @@ public with sharing class RelatedLogEntriesController { return String.join(fieldNames, ','); } - @SuppressWarnings('PMD.AvoidDebugStatements') private static String getOrderByClause(String sortByFieldName, String sortDirection) { sortByFieldName = String.isNotBlank(sortByFieldName) ? sortByFieldName : DEFAULT_SORT_FIELD_NAME; sortDirection = String.isNotBlank(sortDirection) ? sortDirection : DEFAULT_SORT_DIRECTION; @@ -123,7 +122,7 @@ public with sharing class RelatedLogEntriesController { private static String getDisplayFieldApiName(Schema.DescribeFieldResult lookupFieldDescribe) { String relationshipName = lookupFieldDescribe.getRelationshipName(); - SObjectType lookupSObjectType = lookupFieldDescribe.getReferenceTo().get(0); + Schema.SObjectType lookupSObjectType = lookupFieldDescribe.getReferenceTo().get(0); // Use username instead of name for user if (lookupSObjectType == Schema.User.SObjectType) { @@ -277,11 +276,11 @@ public with sharing class RelatedLogEntriesController { @AuraEnabled public String name { get; set; } - private FieldSetMetadata(SObjectType sobjectType, String fieldSetName) { + private FieldSetMetadata(Schema.SObjectType sobjectType, String fieldSetName) { this.fields = new List(); Schema.FieldSet fieldSet = sobjectType.getDescribe().fieldSets.getMap().get(fieldSetName); - for (FieldSetMember fieldSetMember : fieldSet.getFields()) { + for (Schema.FieldSetMember fieldSetMember : fieldSet.getFields()) { // Enforce field-level security (FLS) if (fieldSetMember.getSObjectField().getDescribe().isAccessible()) { this.fields.add(new FieldMetadata(fieldSetMember)); @@ -341,7 +340,7 @@ public with sharing class RelatedLogEntriesController { @AuraEnabled public String type { get; set; } - private FieldMetadata(FieldSetMember fieldSetMember) { + private FieldMetadata(Schema.FieldSetMember fieldSetMember) { Schema.DescribeFieldResult fieldDescribe = fieldSetMember.getSObjectField().getDescribe(); this.fieldName = fieldSetMember.getFieldPath(); diff --git a/nebula-logger/core/main/log-management/flexipages/LogRecordPage.flexipage-meta.xml b/nebula-logger/core/main/log-management/flexipages/LogRecordPage.flexipage-meta.xml index f5c97a038..a6cc540a7 100644 --- a/nebula-logger/core/main/log-management/flexipages/LogRecordPage.flexipage-meta.xml +++ b/nebula-logger/core/main/log-management/flexipages/LogRecordPage.flexipage-meta.xml @@ -178,8 +178,8 @@ uiBehavior readonly - Record.ParentLog__c - RecordParentLog__cField + Record.ParentLogLink__c + RecordParentLogLink__cField Facet-af147cb3-e6b1-4ef7-a00b-d4746d5a1c90 diff --git a/nebula-logger/core/main/log-management/layouts/Log__c-Log Layout.layout-meta.xml b/nebula-logger/core/main/log-management/layouts/Log__c-Log Layout.layout-meta.xml index 47c5814bb..17435940c 100644 --- a/nebula-logger/core/main/log-management/layouts/Log__c-Log Layout.layout-meta.xml +++ b/nebula-logger/core/main/log-management/layouts/Log__c-Log Layout.layout-meta.xml @@ -43,7 +43,7 @@ Readonly - ParentLog__c + ParentLogLink__c diff --git a/nebula-logger/core/main/log-management/objects/Log__c/compactLayouts/LogCompactLayout.compactLayout-meta.xml b/nebula-logger/core/main/log-management/objects/Log__c/compactLayouts/LogCompactLayout.compactLayout-meta.xml index 467c07ac8..249b7fd62 100644 --- a/nebula-logger/core/main/log-management/objects/Log__c/compactLayouts/LogCompactLayout.compactLayout-meta.xml +++ b/nebula-logger/core/main/log-management/objects/Log__c/compactLayouts/LogCompactLayout.compactLayout-meta.xml @@ -8,6 +8,5 @@ Priority__c Status__c LogEntriesSummary__c - ParentLog__c diff --git a/nebula-logger/core/main/log-management/objects/Log__c/fields/ParentLogLink__c.field-meta.xml b/nebula-logger/core/main/log-management/objects/Log__c/fields/ParentLogLink__c.field-meta.xml new file mode 100644 index 000000000..d4b9075b6 --- /dev/null +++ b/nebula-logger/core/main/log-management/objects/Log__c/fields/ParentLogLink__c.field-meta.xml @@ -0,0 +1,17 @@ + + + ParentLogLink__c + false + IF( + NOT(ISBLANK(ParentLog__c)), + HYPERLINK(ParentLog__c, ParentLog__r.Name + ' - ' + ParentLogTransactionId__c), + ParentLogTransactionId__c +) + BlankAsZero + + false + false + false + Text + false + diff --git a/nebula-logger/core/main/log-management/objects/Log__c/fields/ParentLogTransactionId__c.field-meta.xml b/nebula-logger/core/main/log-management/objects/Log__c/fields/ParentLogTransactionId__c.field-meta.xml new file mode 100644 index 000000000..d6fbace6e --- /dev/null +++ b/nebula-logger/core/main/log-management/objects/Log__c/fields/ParentLogTransactionId__c.field-meta.xml @@ -0,0 +1,13 @@ + + + ParentLogTransactionId__c + false + + 36 + false + false + false + false + Text + false + diff --git a/nebula-logger/core/main/log-management/permissionsets/LoggerAdmin.permissionset-meta.xml b/nebula-logger/core/main/log-management/permissionsets/LoggerAdmin.permissionset-meta.xml index 6cf000c60..a5c9e54ba 100644 --- a/nebula-logger/core/main/log-management/permissionsets/LoggerAdmin.permissionset-meta.xml +++ b/nebula-logger/core/main/log-management/permissionsets/LoggerAdmin.permissionset-meta.xml @@ -929,6 +929,16 @@ Log__c.ParentLog__c true + + false + Log__c.ParentLogLink__c + true + + + false + Log__c.ParentLogTransactionId__c + true + true Log__c.Priority__c diff --git a/nebula-logger/core/main/log-management/permissionsets/LoggerEndUser.permissionset-meta.xml b/nebula-logger/core/main/log-management/permissionsets/LoggerEndUser.permissionset-meta.xml index 6ba95179a..70c2ad468 100644 --- a/nebula-logger/core/main/log-management/permissionsets/LoggerEndUser.permissionset-meta.xml +++ b/nebula-logger/core/main/log-management/permissionsets/LoggerEndUser.permissionset-meta.xml @@ -729,6 +729,16 @@ Log__c.ParentLog__c true + + false + Log__c.ParentLogLink__c + true + + + false + Log__c.ParentLogTransactionId__c + true + false Log__c.ProfileId__c diff --git a/nebula-logger/core/main/log-management/permissionsets/LoggerLogCreator.permissionset-meta.xml b/nebula-logger/core/main/log-management/permissionsets/LoggerLogCreator.permissionset-meta.xml index 796fa6f9c..8e68d4123 100644 --- a/nebula-logger/core/main/log-management/permissionsets/LoggerLogCreator.permissionset-meta.xml +++ b/nebula-logger/core/main/log-management/permissionsets/LoggerLogCreator.permissionset-meta.xml @@ -28,7 +28,8 @@ Logger true - Provides access to generate log entries via Apex, Lightning Components, Flow and Process Builder + Provides access to generate log entries via Apex, Lightning Components, Flow and Process Builder. This is currently optional, but required if/when Salesforce activates the release update called "Require User Access to Apex Classes Invoked by Flow". false diff --git a/nebula-logger/core/main/log-management/permissionsets/LoggerLogViewer.permissionset-meta.xml b/nebula-logger/core/main/log-management/permissionsets/LoggerLogViewer.permissionset-meta.xml index 02a039642..010277ccd 100644 --- a/nebula-logger/core/main/log-management/permissionsets/LoggerLogViewer.permissionset-meta.xml +++ b/nebula-logger/core/main/log-management/permissionsets/LoggerLogViewer.permissionset-meta.xml @@ -857,6 +857,16 @@ Log__c.ParentLog__c true + + false + Log__c.ParentLogLink__c + true + + + false + Log__c.ParentLogTransactionId__c + true + false Log__c.Priority__c diff --git a/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls b/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls index efeb9b18e..f29f9ed4b 100644 --- a/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls +++ b/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls @@ -577,7 +577,7 @@ global with sharing class LogEntryEventBuilder { * @param stackTraceString The Apex stack trace string to parse * @return The same instance of `LogEntryEventBuilder`, useful for chaining methods */ - @SuppressWarnings('PMD.NcssMethodCount, PMD.StdCyclomaticComplexity, PMD.CyclomaticComplexity, PMD.CognitiveComplexity') + @SuppressWarnings('PMD.NcssMethodCount') global LogEntryEventBuilder parseStackTrace(String stackTraceString) { if (this.shouldSave == false) { return this; @@ -702,6 +702,8 @@ global with sharing class LogEntryEventBuilder { } if (Logger.getUserSettings().IsApexSystemDebugLoggingEnabled__c == true) { + // 1 of 2 places in the codebase (except tests) that should use System.debug() + // The rest of the codebase should use a method in Logger.cls System.debug(this.entryLoggingLevel, this.debugMessage); } } @@ -769,13 +771,13 @@ global with sharing class LogEntryEventBuilder { LoggingLevel userLoggingLevel = Logger.getUserLoggingLevel(); this.logEntryEvent.Locale__c = UserInfo.getLocale(); - this.logEntryEvent.NetworkId__c = Network.getNetworkId(); - this.logEntryEvent.LoginHistoryId__c = CACHED_AUTH_SESSION?.LoginHistoryId; this.logEntryEvent.LoginApplication__c = CACHED_AUTH_SESSION?.LoginHistory.Application; this.logEntryEvent.LoginBrowser__c = CACHED_AUTH_SESSION?.LoginHistory.Browser; + this.logEntryEvent.LoginHistoryId__c = CACHED_AUTH_SESSION?.LoginHistoryId; this.logEntryEvent.LoginPlatform__c = CACHED_AUTH_SESSION?.LoginHistory.Platform; this.logEntryEvent.LoginType__c = CACHED_AUTH_SESSION?.LoginType; this.logEntryEvent.LogoutUrl__c = CACHED_AUTH_SESSION?.LogoutUrl; + this.logEntryEvent.NetworkId__c = Network.getNetworkId(); this.logEntryEvent.ProfileId__c = UserInfo.getProfileId(); this.logEntryEvent.SessionId__c = CACHED_AUTH_SESSION?.Id; this.logEntryEvent.SessionSecurityLevel__c = CACHED_AUTH_SESSION?.SessionSecurityLevel; diff --git a/nebula-logger/core/main/logger-engine/classes/Logger.cls b/nebula-logger/core/main/logger-engine/classes/Logger.cls index c602a5566..cbc563847 100644 --- a/nebula-logger/core/main/logger-engine/classes/Logger.cls +++ b/nebula-logger/core/main/logger-engine/classes/Logger.cls @@ -9,13 +9,11 @@ * @see LogEntryEventBuilder * @see LogMessage */ -@SuppressWarnings( - 'PMD.ApexCrudViolation, PMD.AvoidDebugStatements, PMD.AvoidGlobalModifier, PMD.CyclomaticComplexity, PMD.CognitiveComplexity, PMD.ExcessiveClassLength' -) +@SuppressWarnings('PMD.AvoidDebugStatements, PMD.AvoidGlobalModifier, PMD.ExcessiveClassLength, PMD.CognitiveComplexity, PMD.CyclomaticComplexity') global with sharing class Logger { // There's no reliable way to get the version number dynamically in Apex @TestVisible - private static final String CURRENT_VERSION_NUMBER = 'v4.7.1'; + private static final String CURRENT_VERSION_NUMBER = 'v4.7.2'; private static final LoggingLevel DEFAULT_LOGGING_LEVEL = LoggingLevel.DEBUG; private static final List LOG_ENTRIES_BUFFER = new List(); private static final Map MOCK_SCENARIO_TO_SCENARIO_RULE = new Map(); @@ -53,6 +51,8 @@ global with sharing class Logger { } static { + // 1 of 2 places in the codebase (except tests) that should use System.debug() + // The rest of the codebase should use a method in Logger.cls System.debug(LoggingLevel.INFO, 'Logger - Version Number: ' + getVersionNumber()); System.debug(LoggingLevel.INFO, 'Logger - Transaction ID: ' + getTransactionId()); } @@ -2485,6 +2485,7 @@ global with sharing class Logger { * and `Log__c.Scenario__c`, and can be used to filter & group logs * @param scenario The name to use for the current transaction's scenario */ + @SuppressWarnings('PMD.ApexCrudViolation') global static void setScenario(String scenario) { transactionScenario = scenario; @@ -2546,7 +2547,7 @@ global with sharing class Logger { * All subsequent calls to saveLog() will use the transaction save method. * @param saveMethodName The String value of the save method to use for this specific save action. */ - @SuppressWarnings('PMD.NcssMethodCount') + @SuppressWarnings('PMD.CognitiveComplexity, PMD.CyclomaticComplexity, PMD.NcssMethodCount') public static void saveLog(String saveMethodName) { saveLogCallCount++; lastSaveMethodNameUsed = saveMethodName; diff --git a/nebula-logger/core/main/logger-engine/classes/LoggerDataStore.cls b/nebula-logger/core/main/logger-engine/classes/LoggerDataStore.cls index 623230546..28c12c4f4 100644 --- a/nebula-logger/core/main/logger-engine/classes/LoggerDataStore.cls +++ b/nebula-logger/core/main/logger-engine/classes/LoggerDataStore.cls @@ -8,7 +8,7 @@ * @description Class used to manage any data-related operations, including database DML statements, * publishing platform events via the event bus, and enqueueing queueable jobs */ -@SuppressWarnings('PMD.ApexCRUDViolation, PMD.CyclomaticComplexity, PMD.EmptyStatementBlock, PMD.ExcessivePublicCount, PMD.FieldDeclarationsShouldBeAtStart') +@SuppressWarnings('PMD.ExcessivePublicCount') public without sharing class LoggerDataStore { private static Database databaseInstance = new Database(); private static EventBus eventBusInstance = new EventBus(); @@ -59,6 +59,7 @@ public without sharing class LoggerDataStore { * @description Class used to centralize the handling of any DML operations */ public virtual class Database { + @SuppressWarnings('PMD.EmptyStatementBlock') protected Database() { } @@ -254,6 +255,7 @@ public without sharing class LoggerDataStore { * @description Class used to centralize the handling of any platform event publishing operations */ public virtual class EventBus { + @SuppressWarnings('PMD.EmptyStatementBlock') protected EventBus() { } @@ -280,6 +282,7 @@ public without sharing class LoggerDataStore { * @description Class used to centralize the handling of enqueueing any queueable jobs */ public virtual class JobQueue { + @SuppressWarnings('PMD.EmptyStatementBlock') protected JobQueue() { } diff --git a/nebula-logger/core/main/logger-engine/classes/LoggerSObjectHandler.cls b/nebula-logger/core/main/logger-engine/classes/LoggerSObjectHandler.cls index 878ac6d6e..640ca683e 100644 --- a/nebula-logger/core/main/logger-engine/classes/LoggerSObjectHandler.cls +++ b/nebula-logger/core/main/logger-engine/classes/LoggerSObjectHandler.cls @@ -10,6 +10,8 @@ @SuppressWarnings('PMD.ApexCRUDViolation, PMD.CyclomaticComplexity, PMD.EmptyStatementBlock, PMD.FieldDeclarationsShouldBeAtStart') public without sharing abstract class LoggerSObjectHandler { private static Boolean isEnabled = true; + private static final String FLOW_PLUGIN_CONFIGURATION_INPUT_NAME = 'pluginConfiguration'; + private static final String FLOW_PLUGIN_INPUT_NAME = 'pluginInput'; private static final Map> SOBJECT_TYPE_TO_EXECUTED_HANDLERS = new Map>(); private static final Map SOBJECT_TYPE_TO_HANDLER_CONFIGURATIONS = queryHandlerConfigurations(); @@ -180,7 +182,6 @@ public without sharing abstract class LoggerSObjectHandler { } } - @SuppressWarnings('PMD.AvoidDebugStatements') private void executeApexPlugin(LoggerPlugin__mdt configuration) { try { LoggerPlugin.Triggerable apexPlugin = LoggerPlugin.newTriggerableInstance(configuration.SObjectHandlerApexClass__c); @@ -196,12 +197,11 @@ public without sharing abstract class LoggerSObjectHandler { } } - @SuppressWarnings('PMD.AvoidDebugStatements') private void executeFlowPlugin(LoggerPlugin__mdt configuration) { try { Map flowInputs = new Map(); - flowInputs.put('pluginConfiguration', configuration); - flowInputs.put('pluginInput', this.input); + flowInputs.put(FLOW_PLUGIN_CONFIGURATION_INPUT_NAME, configuration); + flowInputs.put(FLOW_PLUGIN_INPUT_NAME, this.input); Flow.Interview flowPlugin = Flow.Interview.createInterview(configuration.SObjectHandlerFlowName__c, flowInputs); flowPlugin.start(); @@ -250,12 +250,12 @@ public without sharing abstract class LoggerSObjectHandler { private static Map queryHandlerConfigurations() { Map sobjectTypeToHandlerConfiguration = new Map(); for (LoggerSObjectHandler__mdt handlerConfiguration : [ - SELECT IsEnabled__c, SObjectHandlerApexClass__c, SObjectType__r.QualifiedApiName + SELECT IsEnabled__c, SObjectHandlerApexClass__c, SObjectType__r.QualifiedApiName, SObjectTypeOverride__c FROM LoggerSObjectHandler__mdt WHERE IsEnabled__c = TRUE ]) { handlerConfiguration.SObjectType__c = handlerConfiguration.SObjectType__r.QualifiedApiName; - Schema.SObjectType sobjectType = ((SObject) Type.forName(handlerConfiguration.SObjectType__c).newInstance()).getSObjectType(); + Schema.SObjectType sobjectType = prepHandlerType(handlerConfiguration); sobjectTypeToHandlerConfiguration.put(sobjectType, handlerConfiguration); } @@ -266,6 +266,14 @@ public without sharing abstract class LoggerSObjectHandler { return sobjectTypeToHandlerConfiguration; } + private static Schema.SObjectType prepHandlerType(LoggerSObjectHandler__mdt handlerConfiguration) { + if (String.isNotBlank(handlerConfiguration.SObjectTypeOverride__c)) { + handlerConfiguration.SObjectType__c = handlerConfiguration.SObjectTypeOverride__c; + } + + return ((SObject) Type.forName(handlerConfiguration.SObjectType__c).newInstance()).getSObjectType(); + } + @TestVisible private static LoggerSObjectHandler__mdt getHandlerConfiguration(Schema.SObjectType sobjectType) { return SOBJECT_TYPE_TO_HANDLER_CONFIGURATIONS.get(sobjectType); @@ -273,8 +281,7 @@ public without sharing abstract class LoggerSObjectHandler { @TestVisible private static void setMock(LoggerSObjectHandler__mdt handlerConfiguration) { - //TODO cleanup code duplication - Schema.SObjectType sobjectType = ((SObject) Type.forName(handlerConfiguration.SObjectType__c).newInstance()).getSObjectType(); + Schema.SObjectType sobjectType = prepHandlerType(handlerConfiguration); SOBJECT_TYPE_TO_HANDLER_CONFIGURATIONS.put(sobjectType, handlerConfiguration); } diff --git a/nebula-logger/core/tests/configuration/utilities/LoggerMockDataCreator.cls b/nebula-logger/core/tests/configuration/utilities/LoggerMockDataCreator.cls index a1a6d5de3..368fba8bf 100644 --- a/nebula-logger/core/tests/configuration/utilities/LoggerMockDataCreator.cls +++ b/nebula-logger/core/tests/configuration/utilities/LoggerMockDataCreator.cls @@ -22,27 +22,12 @@ public class LoggerMockDataCreator { /** * @description Instances of `AggregateResult` can not be created directly in Apex. - * This method uses a workaround to generate a mock. + * This method uses a workaround to generate a mock, although it will not have any fields or aggregate values populated on the object. * @return The mock instance of `AggregateResult` */ public static AggregateResult createAggregateResult() { - Map defaultMockAggregateKeyValues = new Map{ - 'fieldAvg' => 62.5, - 'fieldMax' => 100, - 'fieldMin' => 25, - 'fieldCount' => 4 - }; - return createAggregateResult(defaultMockAggregateKeyValues); - } - - /** - * @description Instances of `AggregateResult` can not be created directly in Apex. - * This method uses a workaround to generate a mock, using the provided map of aliases & aggregate values - * @param mockAggregateKeyValues A map of aliases & aggregate values to use when creating the mock `AggregateResult` - * @return The mock instance of `AggregateResult` - */ - public static AggregateResult createAggregateResult(Map mockAggregateKeyValues) { - return (AggregateResult) JSON.deserialize(JSON.serialize(mockAggregateKeyValues), AggregateResult.class); + Map emptyAggregateKeyValues = new Map(); + return (AggregateResult) JSON.deserialize(JSON.serialize(emptyAggregateKeyValues), AggregateResult.class); } /** @@ -485,7 +470,7 @@ public class LoggerMockDataCreator { /** * @description Class used to create or update an `SObject` record with static fake data. * This is useful in situations where you need to have fields populated, but the specific - * values used are not relevant to a particular test. + * values used are not relevant to a particular test method. * This class can be used when Apex writing tests for plugins. */ public without sharing class SObjectTestDataBuilder { diff --git a/nebula-logger/core/tests/log-management/classes/LogBatchPurger_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogBatchPurger_Tests.cls index de294434a..3f1a8d525 100644 --- a/nebula-logger/core/tests/log-management/classes/LogBatchPurger_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogBatchPurger_Tests.cls @@ -101,13 +101,13 @@ private class LogBatchPurger_Tests { Log__c log = logs.get(0); System.assertNotEquals(null, log.LogRetentionDate__c); System.assert(log.LogRetentionDate__c < System.today()); - Test.startTest(); + System.Test.startTest(); LoggerSObjectHandler.shouldExecute(true); LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); Database.executeBatch(new LogBatchPurger()); - Test.stopTest(); + System.Test.stopTest(); logs = [SELECT Id FROM Log__c WHERE Id IN :logs]; logEntries = [SELECT Id FROM LogEntry__c WHERE Id IN :logEntries]; System.assertEquals(0, logs.size(), logs); @@ -131,13 +131,13 @@ private class LogBatchPurger_Tests { Log__c log = logs.get(0); System.assertNotEquals(null, log.LogRetentionDate__c); System.assert(log.LogRetentionDate__c < System.today()); - Test.startTest(); + System.Test.startTest(); LoggerSObjectHandler.shouldExecute(false); LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); Database.executeBatch(new LogBatchPurger()); - Test.stopTest(); + System.Test.stopTest(); logs = [SELECT Id FROM Log__c WHERE Id IN :logs]; logEntries = [SELECT Id FROM LogEntry__c WHERE Id IN :logEntries]; System.assertEquals(0, logs.size(), logs); @@ -157,13 +157,13 @@ private class LogBatchPurger_Tests { update log; log = [SELECT Id, LogRetentionDate__c FROM Log__c]; System.assert(log.LogRetentionDate__c > System.today()); - Test.startTest(); + System.Test.startTest(); LoggerSObjectHandler.shouldExecute(false); LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); Database.executeBatch(new LogBatchPurger()); - Test.stopTest(); + System.Test.stopTest(); logs = [SELECT Id FROM Log__c WHERE Id IN :logs]; logEntries = [SELECT Id FROM LogEntry__c WHERE Id IN :logEntries]; System.assertEquals(1, logs.size()); @@ -184,13 +184,13 @@ private class LogBatchPurger_Tests { update log; log = [SELECT Id, LogRetentionDate__c FROM Log__c]; System.assertEquals(null, log.LogRetentionDate__c); - Test.startTest(); + System.Test.startTest(); LoggerSObjectHandler.shouldExecute(false); LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); Database.executeBatch(new LogBatchPurger()); - Test.stopTest(); + System.Test.stopTest(); logs = [SELECT Id FROM Log__c WHERE Id IN :logs]; logEntries = [SELECT Id FROM LogEntry__c WHERE Id IN :logEntries]; System.assertEquals(1, logs.size(), logs); @@ -208,13 +208,13 @@ private class LogBatchPurger_Tests { log = [SELECT Id, LogRetentionDate__c, TotalLogEntries__c FROM Log__c WHERE Id = :log.Id]; System.assertEquals(retentionDate, log.LogRetentionDate__c, 'Log should not have a retention date'); System.assertEquals(0, log.TotalLogEntries__c, 'Log should not have any related log entries'); - Test.startTest(); + System.Test.startTest(); LoggerSObjectHandler.shouldExecute(false); LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); Database.executeBatch(new LogBatchPurger()); - Test.stopTest(); + System.Test.stopTest(); List matchingLogs = [SELECT Id FROM Log__c WHERE Id = :log.Id]; System.assertEquals(0, matchingLogs.size(), 'Test log should have been deleted'); } @@ -229,13 +229,13 @@ private class LogBatchPurger_Tests { log = [SELECT Id, LogRetentionDate__c, TotalLogEntries__c FROM Log__c WHERE Id = :log.Id]; System.assertEquals(null, log.LogRetentionDate__c, 'Log should not have a retention date'); System.assertEquals(0, log.TotalLogEntries__c, 'Log should not have any related log entries'); - Test.startTest(); + System.Test.startTest(); LoggerSObjectHandler.shouldExecute(false); LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); Database.executeBatch(new LogBatchPurger()); - Test.stopTest(); + System.Test.stopTest(); List matchingLogs = [SELECT Id FROM Log__c WHERE Id = :log.Id]; System.assertEquals(0, matchingLogs.size(), 'Test log should have been deleted'); } diff --git a/nebula-logger/core/tests/log-management/classes/LogEntryEventHandler_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogEntryEventHandler_Tests.cls index 154a3dad5..596c84b7a 100644 --- a/nebula-logger/core/tests/log-management/classes/LogEntryEventHandler_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogEntryEventHandler_Tests.cls @@ -169,11 +169,11 @@ private class LogEntryEventHandler_Tests { // TransactionId__c = transactionId // ); - // Test.startTest(); + // System.Test.startTest(); // LogEntryEventHandler.TAGGING_IS_ENABLED = true; // LogEntryEventHandler.TAG_USING_TOPICS = true; // Database.SaveResult saveResult = EventBus.publish(logEntryEvent); - // Test.stopTest(); + // System.Test.stopTest(); // System.assertEquals(true, saveResult.isSuccess(), saveResult.getErrors()); @@ -437,7 +437,7 @@ private class LogEntryEventHandler_Tests { System.assertEquals(true, LoggerParameter.CALL_STATUS_API); LogEntryEvent__e logEntryEvent = createLogEntryEvent(); - // TODO Test.startTest() & stopTest() are still being used so that the callout in LogEntryEventHandler executes, + // TODO System.Test.startTest() & stopTest() are still being used so that the callout in LogEntryEventHandler executes, // but it be nice if this was instead mocked via LoggerMockDataStore (? or some other similar class?) System.Test.startTest(); Database.SaveResult saveResult = LoggerMockDataStore.getEventBus().publishRecord(logEntryEvent); @@ -472,7 +472,7 @@ private class LogEntryEventHandler_Tests { LoggerTestConfigurator.setMock(mockCallStatusApiParameter); LogEntryEvent__e logEntryEvent = createLogEntryEvent(); - // TODO Test.startTest() & stopTest() are still being used so that the callout in LogEntryEventHandler executes, + // TODO System.Test.startTest() & stopTest() are still being used so that the callout in LogEntryEventHandler executes, // but it be nice if this was instead mocked via LoggerMockDataStore (? or some other similar class?) System.Test.startTest(); Database.SaveResult saveResult = LoggerMockDataStore.getEventBus().publishRecord(logEntryEvent); @@ -502,12 +502,12 @@ private class LogEntryEventHandler_Tests { LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); LoggerTestConfigurator.getSObjectHandlerConfiguration(Schema.Log__c.SObjectType).IsEnabled__c = false; LoggerTestConfigurator.getSObjectHandlerConfiguration(Schema.LogEntry__c.SObjectType).IsEnabled__c = false; - Test.setMock(HttpCalloutMock.class, LoggerMockDataCreator.createHttpCallout().setStatusCode(400).setResponseBody(createStatusApiResponseJson())); + System.Test.setMock(HttpCalloutMock.class, LoggerMockDataCreator.createHttpCallout().setStatusCode(400).setResponseBody(createStatusApiResponseJson())); LoggerParameter__mdt mockCallStatusApiParameter = new LoggerParameter__mdt(DeveloperName = 'CallStatusApi', Value__c = 'false'); LoggerTestConfigurator.setMock(mockCallStatusApiParameter); LogEntryEvent__e logEntryEvent = createLogEntryEvent(); - // TODO Test.startTest() & stopTest() are still being used so that the callout in LogEntryEventHandler executes, + // TODO System.Test.startTest() & stopTest() are still being used so that the callout in LogEntryEventHandler executes, // but it be nice if this was instead mocked via LoggerMockDataStore (? or some other similar class?) System.Test.startTest(); Database.SaveResult saveResult = LoggerMockDataStore.getEventBus().publishRecord(logEntryEvent); @@ -537,14 +537,14 @@ private class LogEntryEventHandler_Tests { LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); LoggerTestConfigurator.getSObjectHandlerConfiguration(Schema.Log__c.SObjectType).IsEnabled__c = false; LoggerTestConfigurator.getSObjectHandlerConfiguration(Schema.LogEntry__c.SObjectType).IsEnabled__c = false; - Test.setMock(HttpCalloutMock.class, LoggerMockDataCreator.createHttpCallout().setStatusCode(400).setResponseBody(createStatusApiResponseJson())); + System.Test.setMock(HttpCalloutMock.class, LoggerMockDataCreator.createHttpCallout().setStatusCode(400).setResponseBody(createStatusApiResponseJson())); LoggerParameter__mdt mockCallStatusApiParameter = new LoggerParameter__mdt(DeveloperName = 'CallStatusApi', Value__c = 'true'); LoggerTestConfigurator.setMock(mockCallStatusApiParameter); LogEntryEvent__e logEntryEvent = createLogEntryEvent(); Database.SaveResult saveResult; try { - // TODO Test.startTest() & stopTest() are still being used so that the callout in LogEntryEventHandler executes, + // TODO System.Test.startTest() & stopTest() are still being used so that the callout in LogEntryEventHandler executes, // but it be nice if this was instead mocked via LoggerMockDataStore (? or some other similar class?) System.Test.startTest(); saveResult = LoggerMockDataStore.getEventBus().publishRecord(logEntryEvent); @@ -587,7 +587,6 @@ private class LogEntryEventHandler_Tests { logEntryEvent.UserLoggingLevelOrdinal__c = LoggingLevel.INFO.ordinal(); logEntryEvent.ProfileId__c = UserInfo.getProfileId(); logEntryEvent.TimestampString__c = String.valueOf(logEntryEvent.Timestamp__c.getTime()); - logEntryEvent.ParentLogTransactionId__c = null; logEntryEvent.RecordId__c = UserInfo.getUserId(); logEntryEvent.RecordCollectionSize__c = 1; logEntryEvent.RecordCollectionType__c = 'Single'; @@ -626,7 +625,7 @@ private class LogEntryEventHandler_Tests { OrganizationNamespacePrefix__c, OrganizationType__c, OwnerId, - ParentLog__c, + ParentLogTransactionId__c, ProfileId__c, ProfileName__c, Scenario__c, @@ -755,6 +754,7 @@ private class LogEntryEventHandler_Tests { System.assertEquals(logEntryEvent.LogoutUrl__c, log.LogoutUrl__c, 'log.LogoutUrl__c was not properly set'); System.assertEquals(logEntryEvent.NetworkId__c, log.NetworkId__c, 'log.NetworkId__c was not properly set'); System.assertEquals(logOwnerId, log.OwnerId, 'log.OwnerId was not properly set'); + System.assertEquals(logEntryEvent.ParentLogTransactionId__c, log.ParentLogTransactionId__c, 'log.ParentLogTransactionId__c was not properly set'); System.assertEquals(logEntryEvent.ProfileId__c, log.ProfileId__c, 'log.ProfileId__c was not properly set'); System.assertEquals(logEntryEvent.ProfileName__c, log.ProfileName__c, 'log.ProfileName__c was not properly set'); System.assertEquals(logEntryEvent.Scenario__c, log.Scenario__c, 'log.Scenario__c was not properly set'); diff --git a/nebula-logger/core/tests/log-management/classes/LogEntryFieldSetPicklist_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogEntryFieldSetPicklist_Tests.cls index 9fb7bbf8b..459537e15 100644 --- a/nebula-logger/core/tests/log-management/classes/LogEntryFieldSetPicklist_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogEntryFieldSetPicklist_Tests.cls @@ -9,20 +9,20 @@ private class LogEntryFieldSetPicklist_Tests { @IsTest static void it_should_return_null_for_default_value() { // Admins should choose a field set, so always return null for the default - Test.startTest(); + System.Test.startTest(); LogEntryFieldSetPicklist instance = new LogEntryFieldSetPicklist(); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(null, instance.getDefaultValue()); } @IsTest static void it_should_return_all_field_sets_as_values() { - Map expectedFieldSets = Schema.SObjectType.LogEntry__c.fieldSets.getMap(); + Map expectedFieldSets = Schema.SObjectType.LogEntry__c.fieldSets.getMap(); - Test.startTest(); + System.Test.startTest(); LogEntryFieldSetPicklist instance = new LogEntryFieldSetPicklist(); - Test.stopTest(); + System.Test.stopTest(); List dataRows = instance.getValues().getDataRows(); System.assertEquals(expectedFieldSets.size(), dataRows.size()); @@ -32,7 +32,7 @@ private class LogEntryFieldSetPicklist_Tests { System.assert(expectedFieldSets.containsKey(fieldSetName)); - FieldSet fieldSet = expectedFieldSets.get(fieldSetName); + Schema.FieldSet fieldSet = expectedFieldSets.get(fieldSetName); System.assertEquals(fieldSet.getLabel(), fieldSetLabel); } } diff --git a/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls index 182082e55..eec7c2c3e 100644 --- a/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls @@ -11,7 +11,7 @@ private class LogEntryHandler_Tests { LoggerSObjectHandler.shouldExecute(false); Log__c log = (Log__c) LoggerMockDataCreator.createDataBuilder(Schema.Log__c.SObjectType).populateRequiredFields().getRecord(); insert log; - Test.setCreatedDate(log.Id, System.now().addDays(-8)); + System.Test.setCreatedDate(log.Id, System.now().addDays(-8)); } @IsTest diff --git a/nebula-logger/core/tests/log-management/classes/LogHandler_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogHandler_Tests.cls index 99b9a3fce..630e685e4 100644 --- a/nebula-logger/core/tests/log-management/classes/LogHandler_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogHandler_Tests.cls @@ -193,6 +193,32 @@ private class LogHandler_Tests { System.assertEquals(UserInfo.getUserId(), log.OwnerId, log); } + @IsTest + static void it_should_skip_setting_parent_log_when_it_does_not_exist() { + String parentLogTransactionId = 'ABC-1234'; + Log__c log = new Log__c(ParentLogTransactionId__c = parentLogTransactionId, TransactionId__c = 'XYZ-5678'); + + insert log; + + log = [SELECT Id, ParentLogTransactionId__c, ParentLog__c FROM Log__c WHERE Id = :log.Id]; + System.assertEquals(parentLogTransactionId, log.ParentLogTransactionId__c, log); + System.assertEquals(null, log.ParentLog__c, log); + } + + @IsTest + static void it_should_set_parent_log_when_it_exists() { + String parentLogTransactionId = 'ABC-1234'; + Log__c parentLog = new Log__c(TransactionId__c = parentLogTransactionId); + insert parentLog; + Log__c log = new Log__c(ParentLogTransactionId__c = parentLogTransactionId, TransactionId__c = 'XYZ-5678'); + + insert log; + + log = [SELECT Id, ParentLogTransactionId__c, ParentLog__c FROM Log__c WHERE Id = :log.Id]; + System.assertEquals(parentLogTransactionId, log.ParentLogTransactionId__c, log); + System.assertEquals(parentLog.Id, log.ParentLog__c, log); + } + @IsTest static void it_should_keep_existing_retention_details_when_populated() { setupConfigurations(); diff --git a/nebula-logger/core/tests/log-management/classes/LogMassDeleteExtension_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogMassDeleteExtension_Tests.cls index b0e173215..5c1a94303 100644 --- a/nebula-logger/core/tests/log-management/classes/LogMassDeleteExtension_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogMassDeleteExtension_Tests.cls @@ -37,7 +37,7 @@ private class LogMassDeleteExtension_Tests { ApexPages.StandardSetController controller = new ApexPages.StandardSetController(logs); controller.setSelected(logs); PageReference pageReference = Page.LogMassDelete; - Test.setCurrentPage(pageReference); + System.Test.setCurrentPage(pageReference); LogMassDeleteExtension extension = new LogMassDeleteExtension(controller); List returnedDeletableLogs = extension.getDeletableLogs(); @@ -61,7 +61,7 @@ private class LogMassDeleteExtension_Tests { ApexPages.StandardSetController controller = new ApexPages.StandardSetController(logs); controller.setSelected(logsToDelete); PageReference pageReference = Page.LogMassDelete; - Test.setCurrentPage(pageReference); + System.Test.setCurrentPage(pageReference); LogMassDeleteExtension extension = new LogMassDeleteExtension(controller); extension.deleteSelectedLogs(); diff --git a/nebula-logger/core/tests/log-management/classes/LoggerSObjectMetadata_Tests.cls b/nebula-logger/core/tests/log-management/classes/LoggerSObjectMetadata_Tests.cls index 803773c8e..d2b9f7b75 100644 --- a/nebula-logger/core/tests/log-management/classes/LoggerSObjectMetadata_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LoggerSObjectMetadata_Tests.cls @@ -27,7 +27,7 @@ private class LoggerSObjectMetadata_Tests { validateSObjectDetails(userSObjectType, sobjectSchema); } - private static void validateSObjectDetails(SObjectType sobjectType, LoggerSObjectMetadata.SObjectSchema sobjectSchema) { + private static void validateSObjectDetails(Schema.SObjectType sobjectType, LoggerSObjectMetadata.SObjectSchema sobjectSchema) { // SObject details System.assertEquals(sobjectType.getDescribe().getLabel(), sobjectSchema.label); System.assertEquals(sobjectType.getDescribe().getLabelPlural(), sobjectSchema.labelPlural); diff --git a/nebula-logger/core/tests/log-management/classes/RelatedLogEntriesController_Tests.cls b/nebula-logger/core/tests/log-management/classes/RelatedLogEntriesController_Tests.cls index 9efd31e79..aba289cb7 100644 --- a/nebula-logger/core/tests/log-management/classes/RelatedLogEntriesController_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/RelatedLogEntriesController_Tests.cls @@ -47,7 +47,7 @@ private class RelatedLogEntriesController_Tests { String sortDirection = 'ASC'; String search = null; - Test.startTest(); + System.Test.startTest(); RelatedLogEntriesController.LogEntryQueryResult result = RelatedLogEntriesController.getQueryResult( recordId, @@ -58,7 +58,7 @@ private class RelatedLogEntriesController_Tests { sortDirection, search ); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(fieldSetName, result.fieldSet.name); @@ -95,7 +95,7 @@ private class RelatedLogEntriesController_Tests { } System.assertEquals(1, countOfMatches, logEntries); - Test.startTest(); + System.Test.startTest(); RelatedLogEntriesController.LogEntryQueryResult result = RelatedLogEntriesController.getQueryResult( recordId, @@ -106,7 +106,7 @@ private class RelatedLogEntriesController_Tests { sortDirection, search ); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(fieldSetName, result.fieldSet.name); // FIXME diff --git a/nebula-logger/core/tests/logger-engine/classes/ComponentLogger_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/ComponentLogger_Tests.cls index 93a7edd17..3a9daf24e 100644 --- a/nebula-logger/core/tests/logger-engine/classes/ComponentLogger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/ComponentLogger_Tests.cls @@ -87,7 +87,7 @@ private class ComponentLogger_Tests { componentLogEntry.record = currentUser; componentLogEntry.timestamp = System.now().addDays(-1 / 24); componentLogEntry.tags = new List{ 'some tag', 'one more tag' }; - Test.startTest(); + System.Test.startTest(); System.assertEquals(0, Logger.saveLogCallCount); System.assertEquals(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.assertEquals(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls index a7906acc7..97a64cf9d 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls @@ -105,7 +105,7 @@ private class FlowCollectionLogEntry_Tests { LoggingLevel userLoggingLevel = LoggingLevel.FINEST; LoggingLevel flowCollectionEntryLoggingLevel = LoggingLevel.DEBUG; System.assert(userLoggingLevel.ordinal() < flowCollectionEntryLoggingLevel.ordinal()); - Test.startTest(); + System.Test.startTest(); System.assertEquals(0, Limits.getQueueableJobs(), 'Test should start with 0 queueable jobs used'); Logger.getUserSettings().LoggingLevel__c = userLoggingLevel.name(); LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowLogEntry_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowLogEntry_Tests.cls index 984b5dea2..5abbc94e2 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowLogEntry_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowLogEntry_Tests.cls @@ -188,7 +188,7 @@ private class FlowLogEntry_Tests { static void it_should_set_log_scenario() { LoggerDataStore.setMock(LoggerMockDataStore.getEventBus()); LoggingLevel userLoggingLevel = LoggingLevel.FINEST; - Test.startTest(); + System.Test.startTest(); Logger.getUserSettings().LoggingLevel__c = userLoggingLevel.name(); LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); FlowLogEntry flowEntry = createFlowLogEntry(); @@ -216,7 +216,7 @@ private class FlowLogEntry_Tests { LoggingLevel userLoggingLevel = LoggingLevel.FINEST; LoggingLevel flowEntryLoggingLevel = LoggingLevel.DEBUG; System.assert(userLoggingLevel.ordinal() < flowEntryLoggingLevel.ordinal()); - Test.startTest(); + System.Test.startTest(); Logger.getUserSettings().LoggingLevel__c = userLoggingLevel.name(); LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); List tags = new List{ 'first tag', 'SECOND TAG' }; diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowLogger_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowLogger_Tests.cls index c5bdb7525..785b803db 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowLogger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowLogger_Tests.cls @@ -43,7 +43,7 @@ private class FlowLogger_Tests { static void it_should_auto_save_entry_when_saveLog_is_true() { LoggerDataStore.setMock(LoggerMockDataStore.getEventBus()); LoggingLevel entryLoggingLevel = LoggingLevel.DEBUG; - Test.startTest(); + System.Test.startTest(); Logger.getUserSettings().LoggingLevel__c = entryLoggingLevel.name(); LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); System.assertEquals(0, Logger.getBufferSize()); diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls index ca06b3418..e92507e6c 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls @@ -27,7 +27,7 @@ private class FlowRecordLogEntry_Tests { LoggingLevel userLoggingLevel = LoggingLevel.FINEST; LoggingLevel flowRecordEntryLoggingLevel = LoggingLevel.DEBUG; System.assert(userLoggingLevel.ordinal() < flowRecordEntryLoggingLevel.ordinal()); - Test.startTest(); + System.Test.startTest(); Logger.getUserSettings().LoggingLevel__c = userLoggingLevel.name(); LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); FlowRecordLogEntry flowRecordEntry = createFlowRecordLogEntry(); diff --git a/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls index 7b230d3c9..363482d6e 100644 --- a/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls @@ -893,7 +893,7 @@ private class LogEntryEventBuilder_Tests { } @IsTest - static void it_should_set_detailed_fields() { + static void it_should_not_set_user_fields_when_anonymous_mode_disabled() { // Get expected data Organization organization = LoggerMockDataCreator.getOrganization(); String organizationEnvironmentType = LoggerMockDataCreator.getOrganizationEnvironmentType(); @@ -920,6 +920,40 @@ private class LogEntryEventBuilder_Tests { System.assertEquals(USER.UserRole?.Name, builder.getLogEntryEvent().UserRoleName__c); } + @IsTest + static void it_should_not_set_user_fields_when_anonymous_mode_enabled() { + Logger.getUserSettings().IsAnonymousModeEnabled__c = true; + + LogEntryEventBuilder builder = Logger.debug('test log entry'); + + System.assertEquals(null, builder.getLogEntryEvent().Locale__c); + System.assertEquals(null, builder.getLogEntryEvent().LoggedById__c); + System.assertEquals(null, builder.getLogEntryEvent().LoggedByUsername__c); + System.assertEquals(null, builder.getLogEntryEvent().LoginApplication__c); + System.assertEquals(null, builder.getLogEntryEvent().LoginBrowser__c); + System.assertEquals(null, builder.getLogEntryEvent().LoginHistoryId__c); + System.assertEquals(null, builder.getLogEntryEvent().LoginPlatform__c); + System.assertEquals(null, builder.getLogEntryEvent().LoginType__c); + System.assertEquals(null, builder.getLogEntryEvent().LogoutUrl__c); + System.assertEquals(null, builder.getLogEntryEvent().ProfileId__c); + System.assertEquals(null, builder.getLogEntryEvent().ProfileName__c); + System.assertEquals(null, builder.getLogEntryEvent().SessionId__c); + System.assertEquals(null, builder.getLogEntryEvent().SessionSecurityLevel__c); + System.assertEquals(null, builder.getLogEntryEvent().SessionType__c); + System.assertEquals(null, builder.getLogEntryEvent().SourceIp__c); + System.assertEquals(null, builder.getLogEntryEvent().ThemeDisplayed__c); + System.assertEquals(null, builder.getLogEntryEvent().TimeZoneId__c); + System.assertEquals(null, builder.getLogEntryEvent().TimeZoneName__c); + System.assertEquals(null, builder.getLogEntryEvent().UserLicenseDefinitionKey__c); + System.assertEquals(null, builder.getLogEntryEvent().UserLicenseId__c); + System.assertEquals(null, builder.getLogEntryEvent().UserLicenseName__c); + System.assertEquals(null, builder.getLogEntryEvent().UserLoggingLevel__c); + System.assertEquals(null, builder.getLogEntryEvent().UserLoggingLevelOrdinal__c); + System.assertEquals(null, builder.getLogEntryEvent().UserRoleId__c); + System.assertEquals(null, builder.getLogEntryEvent().UserRoleName__c); + System.assertEquals(null, builder.getLogEntryEvent().UserType__c); + } + @IsTest static void it_should_use_configured_log_entry_event_fields_for_debug_string() { LoggerParameter.setMock( diff --git a/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectHandler_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectHandler_Tests.cls index aa8cdd7fc..cccd481be 100644 --- a/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectHandler_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectHandler_Tests.cls @@ -33,6 +33,26 @@ private class LoggerSObjectHandler_Tests { ); } + @IsTest + static void it_should_return_handler_via_override() { + Schema.SObjectType sobjectType = new MockSObjectHandler().getSObjectType(); + LoggerSObjectHandler.setMock( + new LoggerSObjectHandler__mdt( + IsEnabled__c = true, + SObjectHandlerApexClass__c = MockSObjectHandler.class.getName(), + SObjectTypeOverride__c = sobjectType.getDescribe().getName() + ) + ); + + LoggerSObjectHandler configuredInstance = LoggerSObjectHandler.getHandler(sobjectType); + + System.assertEquals( + true, + configuredInstance instanceof MockSObjectHandler, + 'The handler returned via override should be an instance of the configured class, MockSObjectHandler' + ); + } + @IsTest static void it_should_return_default_sobject_handler_implementation_when_no_configuration_provided() { Schema.SObjectType sobjectType = new MockDefaultImplementationSObjectHandler().getSObjectType(); @@ -317,7 +337,7 @@ private class LoggerSObjectHandler_Tests { } public class MockDefaultImplementationSObjectHandler extends LoggerSObjectHandler { - public override SObjectType getSObjectType() { + public override Schema.SObjectType getSObjectType() { return Schema.User.SObjectType; } } @@ -339,7 +359,7 @@ private class LoggerSObjectHandler_Tests { this.sobjectType = sobjectType; } - public override SObjectType getSObjectType() { + public override Schema.SObjectType getSObjectType() { return this.sobjectType; } diff --git a/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls index 98252de77..85daf4b42 100644 --- a/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls @@ -101,6 +101,7 @@ private class Logger_Tests { @IsTest static void it_should_return_transaction_id() { String transactionId = Logger.getTransactionId(); + System.assert(String.isNotBlank(transactionId)); System.assertEquals(System.Request.getCurrent().getRequestId(), transactionId); } @@ -110,6 +111,7 @@ private class Logger_Tests { Pattern pattern = Pattern.compile('[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}'); Logger.Uuid uuid = new Logger.Uuid(); + System.assertEquals(36, uuid.getValue().length()); Matcher matcher = pattern.matcher(uuid.getValue()); System.assert(matcher.matches(), 'Generated UUID=' + uuid.getValue()); @@ -119,6 +121,7 @@ private class Logger_Tests { static void it_should_set_logger_version_number() { for (Integer i = 0; i < 10; i++) { LogEntryEventBuilder builder = Logger.info('my log entry'); + System.assertNotEquals(null, builder.getLogEntryEvent().LoggerVersionNumber__c); System.assertEquals(Logger.CURRENT_VERSION_NUMBER, builder.getLogEntryEvent().LoggerVersionNumber__c); } @@ -128,12 +131,14 @@ private class Logger_Tests { static void it_should_set_transaction_entry_number() { for (Integer i = 0; i < 10; i++) { LogEntryEventBuilder builder = Logger.info('my log entry'); + System.assertEquals(i + 1, builder.getLogEntryEvent().TransactionEntryNumber__c); } } @IsTest - static void it_should_default_scenario_when_configured() { + static void it_should_set_scenario_when_default_scenario_configured() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data String transactionScenarioName = 'some test scenario for this transaction'; LoggerSettings__c userSettings = LoggerSettings__c.getInstance(); userSettings.DefaultLogScenario__c = transactionScenarioName; @@ -152,7 +157,8 @@ private class Logger_Tests { } @IsTest - static void it_should_set_scenario() { + static void it_should_set_scenario_when_specified() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data String transactionId = Logger.getTransactionId(); String transactionScenarioName = 'some test scenario for this transaction'; @@ -169,7 +175,8 @@ private class Logger_Tests { } @IsTest - static void it_should_set_scenario_and_apply_scenario_rule_logging_level() { + static void it_should_apply_scenario_rule_logging_level_when_scenario_is_set() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data String transactionId = Logger.getTransactionId(); String transactionScenarioName = 'some test scenario for this transaction'; LogScenarioRule__mdt scenarioRule = new LogScenarioRule__mdt(Scenario__c = transactionScenarioName, UserLoggingLevel__c = LoggingLevel.FINER.name()); @@ -195,6 +202,7 @@ private class Logger_Tests { @IsTest static void it_should_use_last_scenario_when_multiple_scenarios_specified() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data String transactionId = Logger.getTransactionId(); String initialTransactionScenarioName = 'some test scenario for this transaction'; String lastTransactionScenarioName = 'some test scenario for this transaction'; @@ -215,49 +223,48 @@ private class Logger_Tests { @IsTest static void it_should_set_parent_transaction_id() { String expectedParentTransactionId = 'imagineThisWereAGuid'; + Logger.setParentLogTransactionId(expectedParentTransactionId); + System.assertEquals(expectedParentTransactionId, Logger.getParentLogTransactionId()); } @IsTest static void it_should_ignore_parent_transaction_id_when_set_to_current_transaction_id() { String currentTransactionId = Logger.getTransactionId(); + Logger.setParentLogTransactionId(currentTransactionId); + System.assertEquals(null, Logger.getParentLogTransactionId()); } @IsTest static void it_should_return_quiddity_level() { List acceptableDefaultQuidditiesForTests = new List{ Quiddity.RUNTEST_ASYNC, Quiddity.RUNTEST_DEPLOY, Quiddity.RUNTEST_SYNC }; - System.assertEquals(true, acceptableDefaultQuidditiesForTests.contains(Logger.getCurrentQuiddity())); - System.assertEquals(System.Request.getCurrent().getQuiddity(), Logger.getCurrentQuiddity()); + Quiddity currentQuiddity = Logger.getCurrentQuiddity(); + + System.assertEquals(true, acceptableDefaultQuidditiesForTests.contains(currentQuiddity)); + System.assertEquals(System.Request.getCurrent().getQuiddity(), currentQuiddity); } @IsTest static void it_should_return_user_logging_level() { - LoggingLevel expectedValue = LoggingLevel.FINE; - Logger.getUserSettings().LoggingLevel__c = expectedValue.name(); + LoggingLevel expectedLoggingLevel = LoggingLevel.FINE; + Logger.getUserSettings().LoggingLevel__c = expectedLoggingLevel.name(); - Test.startTest(); - LoggingLevel returnedValue = Logger.getUserLoggingLevel(); - Test.stopTest(); + LoggingLevel returnedLoggingLevel = Logger.getUserLoggingLevel(); - System.assertEquals(expectedValue, returnedValue); + System.assertEquals(expectedLoggingLevel, returnedLoggingLevel); } @IsTest static void it_should_return_true_when_enabled() { Boolean expectedValue = true; - - Test.startTest(); - Logger.getUserSettings().IsEnabled__c = expectedValue; Boolean returnedValue = Logger.isEnabled(); - Test.stopTest(); - System.assertEquals(expectedValue, returnedValue); } @@ -265,128 +272,88 @@ private class Logger_Tests { static void it_should_return_true_when_provided_logging_level_is_enabled() { LoggingLevel loggingLevel = LoggingLevel.FINE; Boolean expectedValue = true; - - Test.startTest(); - Logger.getUserSettings().IsEnabled__c = expectedValue; Logger.getUserSettings().LoggingLevel__c = loggingLevel.name(); Boolean returnedValue = Logger.isEnabled(loggingLevel); - Test.stopTest(); - System.assertEquals(expectedValue, returnedValue); } @IsTest static void it_should_return_true_when_error_logging_level_is_enabled() { Boolean expectedValue = true; - - Test.startTest(); - Logger.getUserSettings().IsEnabled__c = expectedValue; Logger.getUserSettings().LoggingLevel__c = LoggingLevel.ERROR.name(); Boolean returnedValue = Logger.isErrorEnabled(); - Test.stopTest(); - System.assertEquals(expectedValue, returnedValue); } @IsTest static void it_should_return_true_when_warn_logging_level_is_enabled() { Boolean expectedValue = true; - - Test.startTest(); - Logger.getUserSettings().IsEnabled__c = expectedValue; Logger.getUserSettings().LoggingLevel__c = LoggingLevel.WARN.name(); Boolean returnedValue = Logger.isWarnEnabled(); - Test.stopTest(); - System.assertEquals(expectedValue, returnedValue); } @IsTest static void it_should_return_true_when_info_logging_level_is_enabled() { Boolean expectedValue = true; - - Test.startTest(); - Logger.getUserSettings().IsEnabled__c = expectedValue; Logger.getUserSettings().LoggingLevel__c = LoggingLevel.INFO.name(); Boolean returnedValue = Logger.isInfoEnabled(); - Test.stopTest(); - System.assertEquals(expectedValue, returnedValue); } @IsTest static void it_should_return_true_when_debug_logging_level_is_enabled() { Boolean expectedValue = true; - - Test.startTest(); - Logger.getUserSettings().IsEnabled__c = expectedValue; Logger.getUserSettings().LoggingLevel__c = LoggingLevel.DEBUG.name(); Boolean returnedValue = Logger.isDebugEnabled(); - Test.stopTest(); - System.assertEquals(expectedValue, returnedValue); } @IsTest static void it_should_return_true_when_fine_logging_level_is_enabled() { Boolean expectedValue = true; - - Test.startTest(); - Logger.getUserSettings().IsEnabled__c = expectedValue; Logger.getUserSettings().LoggingLevel__c = LoggingLevel.FINE.name(); Boolean returnedValue = Logger.isFineEnabled(); - Test.stopTest(); - System.assertEquals(expectedValue, returnedValue); } @IsTest static void it_should_return_true_when_finer_logging_level_is_enabled() { Boolean expectedValue = true; - - Test.startTest(); - Logger.getUserSettings().IsEnabled__c = expectedValue; Logger.getUserSettings().LoggingLevel__c = LoggingLevel.FINER.name(); Boolean returnedValue = Logger.isFinerEnabled(); - Test.stopTest(); - System.assertEquals(expectedValue, returnedValue); } @IsTest static void it_should_return_true_when_finest_logging_level_is_enabled() { Boolean expectedValue = true; - - Test.startTest(); - Logger.getUserSettings().IsEnabled__c = expectedValue; Logger.getUserSettings().LoggingLevel__c = LoggingLevel.FINEST.name(); Boolean returnedValue = Logger.isFinestEnabled(); - Test.stopTest(); - System.assertEquals(expectedValue, returnedValue); } @@ -394,19 +361,18 @@ private class Logger_Tests { static void it_should_return_true_when_saving_is_suspended() { System.assertEquals(false, Logger.isSavingSuspended()); - Test.startTest(); Logger.suspendSaving(); - Test.stopTest(); System.assertEquals(true, Logger.isSavingSuspended()); } @IsTest static void it_should_suspend_saving() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfExistingLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfExistingLogEntries); - Test.startTest(); + System.Test.startTest(); Logger.getUserSettings().IsEnabled__c = true; Logger.getUserSettings().LoggingLevel__c = LoggingLevel.DEBUG.name(); @@ -416,7 +382,7 @@ private class Logger_Tests { Logger.debug('test log entry'); Logger.saveLog(); - Test.stopTest(); + System.Test.stopTest(); countOfExistingLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfExistingLogEntries); @@ -424,10 +390,11 @@ private class Logger_Tests { @IsTest static void it_should_resume_saving() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfLogEntries); - Test.startTest(); + System.Test.startTest(); Logger.getUserSettings().IsEnabled__c = true; Logger.getUserSettings().LoggingLevel__c = LoggingLevel.FINEST.name(); @@ -454,7 +421,7 @@ private class Logger_Tests { System.Test.getEventBus().deliver(); - Test.stopTest(); + System.Test.stopTest(); countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(logEntriesToCreate, countOfLogEntries); @@ -462,9 +429,9 @@ private class Logger_Tests { @IsTest static void it_should_save_accurate_timestamp_when_logging_user_has_different_time_zone() { + // TODO Move this test to LogEntryEventBuilder_Tests, see if there's a way to eliminate creating a user User automatedProcessUser = [SELECT Id, TimeZoneSidKey FROM User WHERE Name = 'Automated Process' AND Profile.Name = NULL]; User testStandardUser = LoggerMockDataCreator.createUser(); - // Make sure that the test user has a different time zone from the automated process user if (automatedProcessUser.TimeZoneSidKey == testStandardUser.TimeZoneSidKey) { switch on automatedProcessUser.TimeZoneSidKey { @@ -501,20 +468,15 @@ private class Logger_Tests { static void it_should_return_the_buffer_size() { System.assertEquals(0, Logger.getBufferSize()); - setUserLoggingLevel(LoggingLevel.DEBUG); - - Test.startTest(); - Logger.debug('test log entry'); Logger.warn('another test log entry'); - Test.stopTest(); - System.assertEquals(2, Logger.getBufferSize()); } @IsTest static void it_should_not_save_when_saving_is_disabled() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfLogEntries); @@ -529,7 +491,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getPublishImmediateDml()); - Test.startTest(); + System.Test.startTest(); Logger.saveLog(); System.assertEquals(0, Limits.getPublishImmediateDml()); @@ -537,7 +499,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getCallouts()); System.assertEquals(0, Limits.getDmlStatements()); - Test.stopTest(); + System.Test.stopTest(); countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfLogEntries); @@ -545,6 +507,7 @@ private class Logger_Tests { @IsTest static void it_should_save_via_event_bus_when_defaulted() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfLogEntries); @@ -559,7 +522,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getPublishImmediateDml()); - Test.startTest(); + System.Test.startTest(); Logger.saveLog(); System.assertEquals(1, Limits.getPublishImmediateDml()); @@ -567,7 +530,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getCallouts()); System.assertEquals(0, Limits.getDmlStatements()); - Test.stopTest(); + System.Test.stopTest(); countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(2, countOfLogEntries); @@ -575,6 +538,7 @@ private class Logger_Tests { @IsTest static void it_should_save_via_event_bus_when_specified_via_settings() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfLogEntries); @@ -585,7 +549,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getPublishImmediateDml()); - Test.startTest(); + System.Test.startTest(); Logger.saveLog(Logger.SaveMethod.EVENT_BUS); System.assertEquals(1, Limits.getPublishImmediateDml()); @@ -593,7 +557,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getCallouts()); System.assertEquals(0, Limits.getDmlStatements()); - Test.stopTest(); + System.Test.stopTest(); countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(2, countOfLogEntries); @@ -601,6 +565,7 @@ private class Logger_Tests { @IsTest static void it_should_save_via_event_bus_when_specified_via_setSaveMethod() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfLogEntries); @@ -611,7 +576,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getPublishImmediateDml()); - Test.startTest(); + System.Test.startTest(); Logger.SaveMethod expectedSaveMethod = Logger.SaveMethod.EVENT_BUS; Logger.setSaveMethod(expectedSaveMethod); @@ -622,7 +587,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getCallouts()); System.assertEquals(0, Limits.getDmlStatements()); - Test.stopTest(); + System.Test.stopTest(); countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(2, countOfLogEntries); @@ -630,6 +595,7 @@ private class Logger_Tests { @IsTest static void it_should_save_via_queueable_when_defaulted() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfLogEntries); @@ -637,7 +603,7 @@ private class Logger_Tests { Logger.getUserSettings().DefaultSaveMethod__c = 'QUEUEABLE'; upsert Logger.getUserSettings(); - Test.startTest(); + System.Test.startTest(); System.assertEquals(Logger.SaveMethod.QUEUEABLE, Logger.getSaveMethod()); @@ -654,7 +620,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getCallouts()); System.assertEquals(0, Limits.getDmlStatements()); - Test.stopTest(); + System.Test.stopTest(); countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(2, countOfLogEntries); @@ -662,6 +628,7 @@ private class Logger_Tests { @IsTest static void it_should_save_via_queueable_when_specified_via_settings() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfLogEntries); @@ -672,7 +639,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getQueueableJobs()); - Test.startTest(); + System.Test.startTest(); Logger.saveLog(Logger.SaveMethod.QUEUEABLE); System.assertEquals(0, Limits.getPublishImmediateDml()); @@ -682,7 +649,7 @@ private class Logger_Tests { System.Test.getEventBus().deliver(); - Test.stopTest(); + System.Test.stopTest(); countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(2, countOfLogEntries); @@ -690,6 +657,7 @@ private class Logger_Tests { @IsTest static void it_should_save_via_queueable_when_specified_via_setSaveMethod() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfLogEntries); @@ -700,7 +668,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getQueueableJobs()); - Test.startTest(); + System.Test.startTest(); Logger.SaveMethod expectedSaveMethod = Logger.SaveMethod.QUEUEABLE; Logger.setSaveMethod(expectedSaveMethod); @@ -713,7 +681,7 @@ private class Logger_Tests { System.Test.getEventBus().deliver(); - Test.stopTest(); + System.Test.stopTest(); countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(2, countOfLogEntries); @@ -721,7 +689,8 @@ private class Logger_Tests { @IsTest static void it_should_save_via_rest_api_when_defaulted() { - Test.setMock(HttpCalloutMock.class, LoggerMockDataCreator.createHttpCallout().setStatusCode(200)); + // TODO eliminate references to Log__c, find alternative way to assert on expected data + System.Test.setMock(HttpCalloutMock.class, LoggerMockDataCreator.createHttpCallout().setStatusCode(200)); Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfLogEntries); @@ -737,7 +706,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getCallouts()); - Test.startTest(); + System.Test.startTest(); Logger.saveLog(); System.assertEquals(0, Limits.getPublishImmediateDml()); @@ -745,12 +714,13 @@ private class Logger_Tests { System.assertEquals(1, Limits.getCallouts()); System.assertEquals(0, Limits.getDmlStatements()); - Test.stopTest(); + System.Test.stopTest(); } @IsTest static void it_should_save_via_rest_api_when_specified_via_settings() { - Test.setMock(HttpCalloutMock.class, LoggerMockDataCreator.createHttpCallout().setStatusCode(200)); + // TODO eliminate references to Log__c, find alternative way to assert on expected data + System.Test.setMock(HttpCalloutMock.class, LoggerMockDataCreator.createHttpCallout().setStatusCode(200)); Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfLogEntries); @@ -762,7 +732,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getCallouts()); - Test.startTest(); + System.Test.startTest(); Logger.saveLog(Logger.SaveMethod.REST); System.assertEquals(0, Limits.getPublishImmediateDml()); @@ -770,12 +740,13 @@ private class Logger_Tests { System.assertEquals(1, Limits.getCallouts()); System.assertEquals(0, Limits.getDmlStatements()); - Test.stopTest(); + System.Test.stopTest(); } @IsTest static void it_should_save_via_rest_api_when_specified_via_setSaveMethod() { - Test.setMock(HttpCalloutMock.class, LoggerMockDataCreator.createHttpCallout().setStatusCode(200)); + // TODO eliminate references to Log__c, find alternative way to assert on expected data + System.Test.setMock(HttpCalloutMock.class, LoggerMockDataCreator.createHttpCallout().setStatusCode(200)); Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfLogEntries); @@ -787,7 +758,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getCallouts()); - Test.startTest(); + System.Test.startTest(); Logger.SaveMethod expectedSaveMethod = Logger.SaveMethod.REST; Logger.setSaveMethod(expectedSaveMethod); @@ -798,12 +769,13 @@ private class Logger_Tests { System.assertEquals(1, Limits.getCallouts()); System.assertEquals(0, Limits.getDmlStatements()); - Test.stopTest(); + System.Test.stopTest(); } @IsTest static void it_should_throw_exception_when_save_via_rest_api_fails() { - Test.setMock(HttpCalloutMock.class, LoggerMockDataCreator.createHttpCallout().setStatusCode(400)); + // TODO eliminate references to Log__c, find alternative way to assert on expected data + System.Test.setMock(HttpCalloutMock.class, LoggerMockDataCreator.createHttpCallout().setStatusCode(400)); Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.assertEquals(0, countOfLogEntries); @@ -815,7 +787,7 @@ private class Logger_Tests { System.assertEquals(0, Limits.getCallouts()); - Test.startTest(); + System.Test.startTest(); try { Logger.saveLog(Logger.SaveMethod.REST); @@ -827,11 +799,12 @@ private class Logger_Tests { System.assertEquals(1, Limits.getCallouts()); System.assertEquals(0, Limits.getDmlStatements()); - Test.stopTest(); + System.Test.stopTest(); } @IsTest static void it_should_save_via_synchronous_dml_when_defaulted() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data LoggerSObjectHandler.setMock( new LoggerSObjectHandler__mdt( DeveloperName = 'Mock_Log_Entry_Event_Config', @@ -847,7 +820,7 @@ private class Logger_Tests { List logEntryEvents = new List(); logEntryEvents.add(Logger.debug('test log entry').getLogEntryEvent()); logEntryEvents.add(Logger.debug('another test log entry').getLogEntryEvent()); - Test.startTest(); + System.Test.startTest(); System.assertEquals(0, Limits.getPublishImmediateDml()); System.assertEquals(0, Limits.getQueueableJobs()); System.assertEquals(0, Limits.getCallouts()); @@ -880,11 +853,12 @@ private class Logger_Tests { System.assertEquals(logEntryEvents.size(), mockLogEntryEventAfterInsertHandler.executedTriggerNew.size()); System.assertEquals(logEntryEvents.get(0), mockLogEntryEventAfterInsertHandler.executedTriggerNew.get(0)); System.assertEquals(logEntryEvents.get(1), mockLogEntryEventAfterInsertHandler.executedTriggerNew.get(1)); - Test.stopTest(); + System.Test.stopTest(); } @IsTest static void it_should_save_via_synchronous_dml_when_specified_via_settings() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data LoggerSObjectHandler.setMock( new LoggerSObjectHandler__mdt( DeveloperName = 'Mock_Log_Entry_Event_Config', @@ -896,7 +870,7 @@ private class Logger_Tests { List logEntryEvents = new List(); logEntryEvents.add(Logger.debug('test log entry').getLogEntryEvent()); logEntryEvents.add(Logger.debug('another test log entry').getLogEntryEvent()); - Test.startTest(); + System.Test.startTest(); System.assertEquals(0, Limits.getPublishImmediateDml()); System.assertEquals(0, Limits.getQueueableJobs()); System.assertEquals(0, Limits.getCallouts()); @@ -931,11 +905,12 @@ private class Logger_Tests { System.assertEquals(logEntryEvents.size(), mockLogEntryEventAfterInsertHandler.executedTriggerNew.size()); System.assertEquals(logEntryEvents.get(0), mockLogEntryEventAfterInsertHandler.executedTriggerNew.get(0)); System.assertEquals(logEntryEvents.get(1), mockLogEntryEventAfterInsertHandler.executedTriggerNew.get(1)); - Test.stopTest(); + System.Test.stopTest(); } @IsTest static void it_should_save_via_synchronous_dml_when_specified_via_setSaveMethod() { + // TODO eliminate references to Log__c, find alternative way to assert on expected data LoggerSObjectHandler.setMock( new LoggerSObjectHandler__mdt( DeveloperName = 'Mock_Log_Entry_Event_Config', @@ -947,7 +922,7 @@ private class Logger_Tests { List logEntryEvents = new List(); logEntryEvents.add(Logger.debug('test log entry').getLogEntryEvent()); logEntryEvents.add(Logger.debug('another test log entry').getLogEntryEvent()); - Test.startTest(); + System.Test.startTest(); System.assertEquals(0, Limits.getPublishImmediateDml()); System.assertEquals(0, Limits.getQueueableJobs()); System.assertEquals(0, Limits.getCallouts()); @@ -982,121 +957,18 @@ private class Logger_Tests { System.assertEquals(logEntryEvents.size(), mockLogEntryEventAfterInsertHandler.executedTriggerNew.size()); System.assertEquals(logEntryEvents.get(0), mockLogEntryEventAfterInsertHandler.executedTriggerNew.get(0)); System.assertEquals(logEntryEvents.get(1), mockLogEntryEventAfterInsertHandler.executedTriggerNew.get(1)); - Test.stopTest(); - } - - @IsTest - static void it_should_not_set_user_fields_when_anonymous_mode_enabled() { - Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; - System.assertEquals(0, countOfLogEntries); - - Logger.getUserSettings().IsAnonymousModeEnabled__c = true; - Logger.debug('test log entry'); - Logger.debug('another test log entry'); - - Test.startTest(); - Logger.saveLog(); - Test.stopTest(); - - Log__c log = [ - SELECT - Id, - Locale__c, - LoggedBy__c, - LoggedByUsername__c, - LoggedByUsernameLink__c, - LoginApplication__c, - LoginBrowser__c, - LoginHistoryId__c, - LoginPlatform__c, - LoginType__c, - LogoutUrl__c, - NetworkId__c, - NetworkLoginUrl__c, - NetworkLogoutUrl__c, - NetworkName__c, - NetworkSelfRegistrationUrl__c, - NetworkUrlPathPrefix__c, - OrganizationDomainUrl__c, - OrganizationEnvironmentType__c, - OrganizationId__c, - OrganizationInstanceName__c, - OrganizationName__c, - OrganizationNamespacePrefix__c, - OrganizationType__c, - ProfileId__c, - ProfileName__c, - SessionId__c, - SessionSecurityLevel__c, - SessionType__c, - SourceIp__c, - ThemeDisplayed__c, - TimeZoneId__c, - TimeZoneName__c, - UserLicenseDefinitionKey__c, - UserLicenseId__c, - UserLicenseName__c, - UserLoggingLevel__c, - UserLoggingLevelOrdinal__c, - UserRoleId__c, - UserRoleName__c, - UserType__c - FROM Log__c - ]; - - System.assertEquals('Anonymous', log.LoggedByUsernameLink__c); - System.assertEquals(null, log.NetworkName__c); - System.assertEquals(null, log.NetworkLoginUrl__c); - System.assertEquals(null, log.NetworkLogoutUrl__c); - System.assertEquals(null, log.NetworkSelfRegistrationUrl__c); - System.assertEquals(null, log.NetworkUrlPathPrefix__c); - System.assertEquals(null, log.LoggedBy__c); - System.assertEquals(null, log.LoggedByUsername__c); - System.assertEquals(null, log.ProfileName__c); - System.assertEquals(null, log.UserLicenseDefinitionKey__c); - System.assertEquals(null, log.UserLicenseId__c); - System.assertEquals(null, log.UserLicenseName__c); - System.assertEquals(null, log.UserRoleName__c); - System.assertEquals(null, log.Locale__c); - System.assertEquals(null, log.NetworkId__c); - System.assertEquals(null, log.LoginHistoryId__c); - System.assertEquals(null, log.LoginApplication__c); - System.assertEquals(null, log.LoginBrowser__c); - System.assertEquals(null, log.LoginPlatform__c); - System.assertEquals(null, log.LoginType__c); - System.assertEquals(null, log.LogoutUrl__c); - System.assertEquals(null, log.ProfileId__c); - System.assertEquals(null, log.SessionId__c); - System.assertEquals(null, log.SessionSecurityLevel__c); - System.assertEquals(null, log.SessionType__c); - System.assertEquals(null, log.SourceIp__c); - System.assertEquals(null, log.TimeZoneId__c); - System.assertEquals(null, log.TimeZoneName__c); - System.assertEquals(null, log.UserLoggingLevel__c); - System.assertEquals(null, log.UserLoggingLevelOrdinal__c); - System.assertEquals(null, log.UserRoleId__c); - System.assertEquals(null, log.UserType__c); - System.assertEquals(null, log.ThemeDisplayed__c); + System.Test.stopTest(); } @IsTest static void it_should_flush_buffer() { - System.assertEquals(0, Logger.getBufferSize()); - - setUserLoggingLevel(LoggingLevel.DEBUG); - - Test.startTest(); - Logger.debug('test log entry'); Logger.debug('another test log entry'); System.assertEquals(2, Logger.getBufferSize()); Logger.flushBuffer(); - Logger.debug('the only log entry to save'); - System.assertEquals(1, Logger.getBufferSize()); - - Test.stopTest(); + System.assertEquals(0, Logger.getBufferSize()); } // Start ERROR methods for LogMessage @@ -1108,11 +980,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1132,11 +1004,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1156,11 +1028,11 @@ private class Logger_Tests { List deleteResults = getDeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), deleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1180,11 +1052,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1204,11 +1076,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1228,11 +1100,11 @@ private class Logger_Tests { List saveResults = getSaveResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), saveResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1252,11 +1124,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1276,11 +1148,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1300,11 +1172,11 @@ private class Logger_Tests { List undeleteResults = getUndeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), undeleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1324,11 +1196,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1348,11 +1220,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1372,11 +1244,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1396,11 +1268,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1420,11 +1292,11 @@ private class Logger_Tests { List upsertResults = getUpsertResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), upsertResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1442,11 +1314,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1464,11 +1336,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), getRecord().Id, getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1486,11 +1358,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1508,11 +1380,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), getRecord(), getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1530,11 +1402,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1552,12 +1424,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), users, getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1575,12 +1447,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1598,11 +1470,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1624,11 +1496,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1648,11 +1520,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1672,11 +1544,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1696,11 +1568,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1720,11 +1592,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1744,11 +1616,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1768,11 +1640,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1792,11 +1664,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1816,11 +1688,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1840,11 +1712,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1864,11 +1736,11 @@ private class Logger_Tests { List deleteResults = getDeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), deleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1888,11 +1760,11 @@ private class Logger_Tests { List saveResults = getSaveResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), saveResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1912,11 +1784,11 @@ private class Logger_Tests { List undeleteResults = getUndeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), undeleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1936,11 +1808,11 @@ private class Logger_Tests { List upsertResults = getUpsertResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), upsertResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1958,11 +1830,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -1980,11 +1852,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), getRecord().Id, getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2002,11 +1874,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2024,11 +1896,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), getRecord(), getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2046,11 +1918,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2068,12 +1940,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), users, getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2091,12 +1963,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2114,11 +1986,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2139,11 +2011,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2163,11 +2035,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2187,11 +2059,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2211,11 +2083,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2235,11 +2107,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2259,11 +2131,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2283,11 +2155,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2307,11 +2179,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2331,11 +2203,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2355,11 +2227,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2377,11 +2249,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2399,11 +2271,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getRecord().Id, getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2421,11 +2293,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2443,11 +2315,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getRecord(), getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2465,11 +2337,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2487,12 +2359,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), users, getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2510,12 +2382,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2533,11 +2405,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2559,11 +2431,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2583,11 +2455,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2607,11 +2479,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2631,11 +2503,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2655,11 +2527,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2679,11 +2551,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2703,11 +2575,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2727,11 +2599,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2751,11 +2623,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2775,11 +2647,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2797,11 +2669,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2819,11 +2691,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getRecord().Id, getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2841,11 +2713,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2863,11 +2735,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getRecord(), getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2885,11 +2757,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2907,12 +2779,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), users, getException()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2930,12 +2802,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2953,11 +2825,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -2979,11 +2851,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3003,11 +2875,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3027,11 +2899,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3051,11 +2923,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3075,11 +2947,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3099,11 +2971,11 @@ private class Logger_Tests { List deleteResults = getDeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), deleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3123,11 +2995,11 @@ private class Logger_Tests { List saveResults = getSaveResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), saveResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3147,11 +3019,11 @@ private class Logger_Tests { List undeleteResults = getUndeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), undeleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3171,11 +3043,11 @@ private class Logger_Tests { List upsertResults = getUpsertResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), upsertResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3193,11 +3065,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3215,11 +3087,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3237,12 +3109,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3260,11 +3132,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3286,11 +3158,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3310,11 +3182,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3334,11 +3206,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3358,11 +3230,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3382,11 +3254,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3406,11 +3278,11 @@ private class Logger_Tests { List deleteResults = getDeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), deleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3430,11 +3302,11 @@ private class Logger_Tests { List saveResults = getSaveResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), saveResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3454,11 +3326,11 @@ private class Logger_Tests { List undeleteResults = getUndeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), undeleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3478,11 +3350,11 @@ private class Logger_Tests { List upsertResults = getUpsertResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), upsertResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3500,11 +3372,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3522,11 +3394,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3544,12 +3416,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3567,11 +3439,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3593,11 +3465,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3617,11 +3489,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3641,11 +3513,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3665,11 +3537,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3689,11 +3561,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3713,11 +3585,11 @@ private class Logger_Tests { List deleteResults = getDeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), deleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3737,11 +3609,11 @@ private class Logger_Tests { List saveResults = getSaveResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), saveResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3761,11 +3633,11 @@ private class Logger_Tests { List undeleteResults = getUndeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), undeleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3785,11 +3657,11 @@ private class Logger_Tests { List upsertResults = getUpsertResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), upsertResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3807,11 +3679,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3829,11 +3701,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3851,12 +3723,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3874,11 +3746,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3900,11 +3772,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3924,11 +3796,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3948,11 +3820,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3972,11 +3844,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -3996,11 +3868,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4020,11 +3892,11 @@ private class Logger_Tests { List deleteResults = getDeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), deleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4044,11 +3916,11 @@ private class Logger_Tests { List saveResults = getSaveResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), saveResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4068,11 +3940,11 @@ private class Logger_Tests { List undeleteResults = getUndeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), undeleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4092,11 +3964,11 @@ private class Logger_Tests { List upsertResults = getUpsertResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4114,11 +3986,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4136,11 +4008,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4158,12 +4030,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4181,11 +4053,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4207,11 +4079,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4231,11 +4103,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4255,11 +4127,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4279,11 +4151,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4303,11 +4175,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4327,11 +4199,11 @@ private class Logger_Tests { List deleteResults = getDeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), deleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4351,11 +4223,11 @@ private class Logger_Tests { List saveResults = getSaveResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), saveResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4375,11 +4247,11 @@ private class Logger_Tests { List undeleteResults = getUndeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), undeleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4399,11 +4271,11 @@ private class Logger_Tests { List upsertResults = getUpsertResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), upsertResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4421,11 +4293,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4443,11 +4315,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4465,12 +4337,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4488,11 +4360,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4514,11 +4386,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4538,11 +4410,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4562,11 +4434,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4586,11 +4458,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4610,11 +4482,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4634,11 +4506,11 @@ private class Logger_Tests { List deleteResults = getDeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), deleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4658,11 +4530,11 @@ private class Logger_Tests { List saveResults = getSaveResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), saveResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4682,11 +4554,11 @@ private class Logger_Tests { List undeleteResults = getUndeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), undeleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4706,11 +4578,11 @@ private class Logger_Tests { List upsertResults = getUpsertResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), upsertResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4728,11 +4600,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4750,11 +4622,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4772,12 +4644,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4795,11 +4667,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4821,11 +4693,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4845,11 +4717,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4869,11 +4741,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4893,11 +4765,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4917,11 +4789,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4941,11 +4813,11 @@ private class Logger_Tests { List deleteResults = getDeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), deleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4965,11 +4837,11 @@ private class Logger_Tests { List saveResults = getSaveResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), saveResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -4989,11 +4861,11 @@ private class Logger_Tests { List undeleteResults = getUndeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), undeleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5013,11 +4885,11 @@ private class Logger_Tests { List upsertResults = getUpsertResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), upsertResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5035,11 +4907,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5057,11 +4929,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5079,12 +4951,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5102,11 +4974,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5128,11 +5000,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5152,11 +5024,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5176,11 +5048,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5200,11 +5072,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5224,11 +5096,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5248,11 +5120,11 @@ private class Logger_Tests { List deleteResults = getDeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), deleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5272,11 +5144,11 @@ private class Logger_Tests { List saveResults = getSaveResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), saveResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5296,11 +5168,11 @@ private class Logger_Tests { List undeleteResults = getUndeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), undeleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5320,11 +5192,11 @@ private class Logger_Tests { List upsertResults = getUpsertResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), upsertResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5342,11 +5214,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5364,11 +5236,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5386,12 +5258,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5409,11 +5281,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5435,11 +5307,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5459,11 +5331,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5483,11 +5355,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5507,11 +5379,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5531,11 +5403,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5555,11 +5427,11 @@ private class Logger_Tests { List deleteResults = getDeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), deleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5579,11 +5451,11 @@ private class Logger_Tests { List saveResults = getSaveResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), saveResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5603,11 +5475,11 @@ private class Logger_Tests { List undeleteResults = getUndeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), undeleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5627,11 +5499,11 @@ private class Logger_Tests { List upsertResults = getUpsertResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), upsertResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5649,11 +5521,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5671,11 +5543,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5693,12 +5565,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5716,11 +5588,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5742,11 +5614,11 @@ private class Logger_Tests { Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), deleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5766,11 +5638,11 @@ private class Logger_Tests { Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), saveResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5790,11 +5662,11 @@ private class Logger_Tests { Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), undeleteResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5814,11 +5686,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5838,11 +5710,11 @@ private class Logger_Tests { Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), upsertResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5862,11 +5734,11 @@ private class Logger_Tests { List deleteResults = getDeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), deleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5886,11 +5758,11 @@ private class Logger_Tests { List saveResults = getSaveResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), saveResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5910,11 +5782,11 @@ private class Logger_Tests { List undeleteResults = getUndeleteResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), undeleteResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5934,11 +5806,11 @@ private class Logger_Tests { List upsertResults = getUpsertResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), upsertResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5956,11 +5828,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), getRecord().Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -5978,11 +5850,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), getRecord()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -6000,12 +5872,12 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), users); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -6023,11 +5895,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); @@ -6049,12 +5921,12 @@ private class Logger_Tests { System.assertEquals(false, Logger.meetsUserLoggingLevel(logEntryLoggingLevel)); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); Boolean shouldSave = true; LogEntryEventBuilder entryBuilder = Logger.newEntry(logEntryLoggingLevel, getLogMessage(), shouldSave); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(shouldSave, entryBuilder.shouldSave()); @@ -6075,12 +5947,12 @@ private class Logger_Tests { System.assertEquals(false, Logger.meetsUserLoggingLevel(logEntryLoggingLevel)); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); Boolean shouldSave = false; LogEntryEventBuilder entryBuilder = Logger.newEntry(logEntryLoggingLevel, getLogMessage(), shouldSave); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(0, Logger.getBufferSize()); System.assertEquals(shouldSave, entryBuilder.shouldSave()); @@ -6093,11 +5965,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.newEntry(loggingLevel, getLogMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(true, entryBuilder.shouldSave()); @@ -6120,12 +5992,12 @@ private class Logger_Tests { System.assertEquals(false, Logger.meetsUserLoggingLevel(logEntryLoggingLevel)); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); Boolean shouldSave = true; LogEntryEventBuilder entryBuilder = Logger.newEntry(logEntryLoggingLevel, getMessage(), shouldSave); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(shouldSave, entryBuilder.shouldSave()); @@ -6146,12 +6018,12 @@ private class Logger_Tests { System.assertEquals(false, Logger.meetsUserLoggingLevel(logEntryLoggingLevel)); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); Boolean shouldSave = false; LogEntryEventBuilder entryBuilder = Logger.newEntry(logEntryLoggingLevel, getMessage(), shouldSave); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(0, Logger.getBufferSize()); System.assertEquals(shouldSave, entryBuilder.shouldSave()); @@ -6164,11 +6036,11 @@ private class Logger_Tests { setUserLoggingLevel(loggingLevel); System.assertEquals(0, Logger.getBufferSize()); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.newEntry(loggingLevel, getMessage()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize()); System.assertEquals(true, entryBuilder.shouldSave()); @@ -6201,9 +6073,9 @@ private class Logger_Tests { Log__c log = new Log__c(TransactionId__c = '1234'); insert log; - Test.startTest(); + System.Test.startTest(); Log__c returnedLog = Logger.getLog(log.Id); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(log.Id, returnedLog.Id); } @@ -6213,9 +6085,9 @@ private class Logger_Tests { Log__c log = new Log__c(TransactionId__c = '1234'); insert log; - Test.startTest(); + System.Test.startTest(); Log__c returnedLog = Logger.getLog(log.TransactionId__c); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(log.Id, returnedLog.Id); } @@ -6255,9 +6127,6 @@ private class Logger_Tests { return deleteResults; } - // TODO only some standard objects can be merged - need to find a way to either mock or trigger a merge result that works in all orgs - // static Database.MergeResult getMergeResult(Boolean isSuccess) { } - static List getSaveResultList() { List saveResults = new List(); for (Integer i = 0; i < 3; i++) { @@ -6317,7 +6186,7 @@ private class Logger_Tests { this.sobjectType = Schema.LogEntryEvent__e.SObjectType; } - public override SObjectType getSObjectType() { + public override Schema.SObjectType getSObjectType() { return this.sobjectType; } diff --git a/nebula-logger/extra-tests/classes/ExampleInboundEmailHandler.cls b/nebula-logger/extra-tests/classes/ExampleInboundEmailHandler.cls index 9b33d35aa..5b72c34b3 100644 --- a/nebula-logger/extra-tests/classes/ExampleInboundEmailHandler.cls +++ b/nebula-logger/extra-tests/classes/ExampleInboundEmailHandler.cls @@ -1,3 +1,8 @@ +//------------------------------------------------------------------------------------------------// +// 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. // +//------------------------------------------------------------------------------------------------// + /** * @description Example inbound email handler class */ @@ -13,7 +18,6 @@ global with sharing class ExampleInboundEmailHandler implements Messaging.Inboun * @param env The envelope of the incoming email * @return The result of the inbound email and email handling. */ - @SuppressWarnings('PMD.AvoidDebugStatements') global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope env) { Messaging.InboundEmailResult result = new Messaging.InboundEmailResult(); try { @@ -23,9 +27,9 @@ global with sharing class ExampleInboundEmailHandler implements Messaging.Inboun Logger.error(logEntryMessage, apexException); } finally { result.success = true; - System.debug(LoggingLevel.DEBUG, 'Logger buffer size before save: ' + Logger.getBufferSize()); + Logger.debug('Logger buffer size before save: ' + Logger.getBufferSize()); Logger.saveLog(); - System.debug(LoggingLevel.DEBUG, 'Logger buffer size after save: ' + Logger.getBufferSize()); + Logger.debug('Logger buffer size after save: ' + Logger.getBufferSize()); } return result; diff --git a/nebula-logger/extra-tests/classes/FieldSet.cls b/nebula-logger/extra-tests/classes/FieldSet.cls new file mode 100644 index 000000000..68a8f130c --- /dev/null +++ b/nebula-logger/extra-tests/classes/FieldSet.cls @@ -0,0 +1,10 @@ +//------------------------------------------------------------------------------------------------// +// 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. // +//------------------------------------------------------------------------------------------------// + +// This class intentionally does nothing - it's here to ensure that any references +// in Nebula Logger's codebase use `Schema.FieldSet` instead of just `FieldSet` +@SuppressWarnings('PMD.ApexDoc, PMD.EmptyStatementBlock') +public without sharing class FieldSet { +} diff --git a/nebula-logger/extra-tests/classes/FieldSet.cls-meta.xml b/nebula-logger/extra-tests/classes/FieldSet.cls-meta.xml new file mode 100644 index 000000000..891916bb0 --- /dev/null +++ b/nebula-logger/extra-tests/classes/FieldSet.cls-meta.xml @@ -0,0 +1,5 @@ + + + 54.0 + Active + diff --git a/nebula-logger/extra-tests/classes/FieldSetMember.cls b/nebula-logger/extra-tests/classes/FieldSetMember.cls new file mode 100644 index 000000000..6df3c391b --- /dev/null +++ b/nebula-logger/extra-tests/classes/FieldSetMember.cls @@ -0,0 +1,10 @@ +//------------------------------------------------------------------------------------------------// +// 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. // +//------------------------------------------------------------------------------------------------// + +// This class intentionally does nothing - it's here to ensure that any references +// in Nebula Logger's codebase use `Schema.FieldSetMember` instead of just `FieldSetMember` +@SuppressWarnings('PMD.ApexDoc, PMD.EmptyStatementBlock') +public without sharing class FieldSetMember { +} diff --git a/nebula-logger/extra-tests/classes/FieldSetMember.cls-meta.xml b/nebula-logger/extra-tests/classes/FieldSetMember.cls-meta.xml new file mode 100644 index 000000000..891916bb0 --- /dev/null +++ b/nebula-logger/extra-tests/classes/FieldSetMember.cls-meta.xml @@ -0,0 +1,5 @@ + + + 54.0 + Active + diff --git a/nebula-logger/extra-tests/classes/SObjectField.cls b/nebula-logger/extra-tests/classes/SObjectField.cls new file mode 100644 index 000000000..4a7a98f26 --- /dev/null +++ b/nebula-logger/extra-tests/classes/SObjectField.cls @@ -0,0 +1,10 @@ +//------------------------------------------------------------------------------------------------// +// 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. // +//------------------------------------------------------------------------------------------------// + +// This class intentionally does nothing - it's here to ensure that any references +// in Nebula Logger's codebase use `Schema.SObjectField` instead of just `SObjectField` +@SuppressWarnings('PMD.ApexDoc, PMD.EmptyStatementBlock') +public without sharing class SObjectField { +} diff --git a/nebula-logger/extra-tests/classes/SObjectField.cls-meta.xml b/nebula-logger/extra-tests/classes/SObjectField.cls-meta.xml new file mode 100644 index 000000000..891916bb0 --- /dev/null +++ b/nebula-logger/extra-tests/classes/SObjectField.cls-meta.xml @@ -0,0 +1,5 @@ + + + 54.0 + Active + diff --git a/nebula-logger/extra-tests/classes/SObjectType.cls b/nebula-logger/extra-tests/classes/SObjectType.cls new file mode 100644 index 000000000..935acbd44 --- /dev/null +++ b/nebula-logger/extra-tests/classes/SObjectType.cls @@ -0,0 +1,10 @@ +//------------------------------------------------------------------------------------------------// +// 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. // +//------------------------------------------------------------------------------------------------// + +// This class intentionally does nothing - it's here to ensure that any references +// in Nebula Logger's codebase use `Schema.SObjectType` instead of just `SObjectType` +@SuppressWarnings('PMD.ApexDoc, PMD.EmptyStatementBlock') +public without sharing class SObjectType { +} diff --git a/nebula-logger/extra-tests/classes/SObjectType.cls-meta.xml b/nebula-logger/extra-tests/classes/SObjectType.cls-meta.xml new file mode 100644 index 000000000..891916bb0 --- /dev/null +++ b/nebula-logger/extra-tests/classes/SObjectType.cls-meta.xml @@ -0,0 +1,5 @@ + + + 54.0 + Active + diff --git a/nebula-logger/extra-tests/classes/Test.cls b/nebula-logger/extra-tests/classes/Test.cls new file mode 100644 index 000000000..a46eb1bd2 --- /dev/null +++ b/nebula-logger/extra-tests/classes/Test.cls @@ -0,0 +1,10 @@ +//------------------------------------------------------------------------------------------------// +// 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. // +//------------------------------------------------------------------------------------------------// + +// This class intentionally does nothing - it's here to ensure that any references +// in Nebula Logger's codebase use `System.Test` instead of just `Test` +@SuppressWarnings('PMD.ApexDoc, PMD.EmptyStatementBlock') +public without sharing class Test { +} diff --git a/nebula-logger/extra-tests/classes/Test.cls-meta.xml b/nebula-logger/extra-tests/classes/Test.cls-meta.xml new file mode 100644 index 000000000..891916bb0 --- /dev/null +++ b/nebula-logger/extra-tests/classes/Test.cls-meta.xml @@ -0,0 +1,5 @@ + + + 54.0 + Active + diff --git a/nebula-logger/extra-tests/tests/LogBatchPurger_Tests_Integration.cls b/nebula-logger/extra-tests/tests/LogBatchPurger_Tests_Integration.cls index e505762a9..1723d1a2d 100644 --- a/nebula-logger/extra-tests/tests/LogBatchPurger_Tests_Integration.cls +++ b/nebula-logger/extra-tests/tests/LogBatchPurger_Tests_Integration.cls @@ -48,9 +48,9 @@ private class LogBatchPurger_Tests_Integration { System.assertEquals(false, Schema.Log__c.SObjectType.getDescribe().isDeletable()); try { - Test.startTest(); + System.Test.startTest(); Database.executeBatch(new LogBatchPurger()); - Test.stopTest(); + System.Test.stopTest(); } catch (NoAccessException ex) { System.assertEquals(LogBatchPurger.NO_DELETE_ACCESS_EXCEPTION_MESSAGE, ex.getMessage()); } diff --git a/nebula-logger/extra-tests/tests/LogMassDeleteExtension_Tests_Integration.cls b/nebula-logger/extra-tests/tests/LogMassDeleteExtension_Tests_Integration.cls index 0087b86c7..deac95b57 100644 --- a/nebula-logger/extra-tests/tests/LogMassDeleteExtension_Tests_Integration.cls +++ b/nebula-logger/extra-tests/tests/LogMassDeleteExtension_Tests_Integration.cls @@ -36,7 +36,7 @@ private class LogMassDeleteExtension_Tests_Integration { ApexPages.StandardSetController controller = new ApexPages.StandardSetController(logs); controller.setSelected(logsToDelete); PageReference pageReference = Page.LogMassDelete; - Test.setCurrentPage(pageReference); + System.Test.setCurrentPage(pageReference); User standardUser = LoggerMockDataCreator.createUser(STANDARD_USER_PROFILE.Id); System.runAs(standardUser) { System.assertEquals(false, Schema.Log__c.SObjectType.getDescribe().isDeletable()); diff --git a/nebula-logger/extra-tests/tests/LoggerSObjectHandler_Tests_Flow.cls b/nebula-logger/extra-tests/tests/LoggerSObjectHandler_Tests_Flow.cls index 3855b4ada..e6cc3cc6e 100644 --- a/nebula-logger/extra-tests/tests/LoggerSObjectHandler_Tests_Flow.cls +++ b/nebula-logger/extra-tests/tests/LoggerSObjectHandler_Tests_Flow.cls @@ -36,7 +36,7 @@ private class LoggerSObjectHandler_Tests_Flow { } private class MockLogHandler extends LoggerSObjectHandler { - public override SObjectType getSObjectType() { + public override Schema.SObjectType getSObjectType() { return Schema.Log__c.SObjectType; } } diff --git a/nebula-logger/extra-tests/tests/Logger_Tests_ExperienceSite.cls b/nebula-logger/extra-tests/tests/Logger_Tests_ExperienceSite.cls index 70fde7ed5..9838876e2 100644 --- a/nebula-logger/extra-tests/tests/Logger_Tests_ExperienceSite.cls +++ b/nebula-logger/extra-tests/tests/Logger_Tests_ExperienceSite.cls @@ -49,7 +49,7 @@ private class Logger_Tests_ExperienceSite { Log__c log = new Log__c(TransactionId__c = '1234'); insert log; - Test.startTest(); + System.Test.startTest(); // Even if Experience Cloud is enabled, the expected test site might not exist, so exit early if the guest user cannot be found List guestUsers = [SELECT Id FROM USER WHERE Profile.NAME = :GUEST_USER_PROFILE_NAME]; @@ -66,7 +66,7 @@ private class Logger_Tests_ExperienceSite { String expectedExceptionMessage = 'FIELD_INTEGRITY_EXCEPTION, field integrity exception (Guest users cannot be record owners.)'; System.assert(ex.getMessage().contains(expectedExceptionMessage), 'Exception did not contain expected message.'); } - Test.stopTest(); + System.Test.stopTest(); } @IsTest diff --git a/nebula-logger/extra-tests/tests/Logger_Tests_InboundEmailHandler.cls b/nebula-logger/extra-tests/tests/Logger_Tests_InboundEmailHandler.cls index 5a7b8ba47..09e7c6547 100644 --- a/nebula-logger/extra-tests/tests/Logger_Tests_InboundEmailHandler.cls +++ b/nebula-logger/extra-tests/tests/Logger_Tests_InboundEmailHandler.cls @@ -18,7 +18,7 @@ private class Logger_Tests_InboundEmailHandler { email.subject = 'My example email'; Messaging.InboundEnvelope envelope = new Messaging.InboundEnvelope(); ExampleInboundEmailHandler emailHandler = new ExampleInboundEmailHandler(); - Test.startTest(); + System.Test.startTest(); LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); String transactionId = Logger.getTransactionId(); System.assertNotEquals(1, Logger.saveLogCallCount, 'No logging should have occurred yet'); @@ -26,13 +26,13 @@ private class Logger_Tests_InboundEmailHandler { Messaging.InboundEmailResult result = emailHandler.handleInboundEmail(email, envelope); System.assertNotEquals(0, Logger.saveLogCallCount, 'ExampleInboundEmailHandler class should have logged & saved some logging data'); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(true, result.success, 'InboundEmailResult returned a failure message'); List logs = [SELECT Id, TransactionId__c FROM Log__c]; System.assertEquals(1, logs.size(), 'Logs size did not match expected value of 1.'); - System.assertEquals(transactionId, logs.get(0).TransactionId__c, 'Transaction Id does match expected value.'); + System.assertEquals(transactionId, logs.get(0).TransactionId__c, 'Transaction Id does match expected value'); List logEntries = [SELECT Id, Message__c FROM LogEntry__c]; - System.assertEquals(1, logEntries.size(), 'Log entries size did not match expected value of 1.'); - System.assertEquals(ExampleInboundEmailHandler.logEntryMessage, logEntries.get(0).Message__c, 'Log entries message did not match expected value.'); + System.assertEquals(2, logEntries.size(), 'Log entries size did not match expected value of 2 ' + JSON.serializePretty(logEntries)); + System.assertEquals(ExampleInboundEmailHandler.logEntryMessage, logEntries.get(0).Message__c, 'Log entries message did not match expected value'); } } diff --git a/nebula-logger/extra-tests/tests/Logger_Tests_MergeResult.cls b/nebula-logger/extra-tests/tests/Logger_Tests_MergeResult.cls index 32240a0d5..2c634305b 100644 --- a/nebula-logger/extra-tests/tests/Logger_Tests_MergeResult.cls +++ b/nebula-logger/extra-tests/tests/Logger_Tests_MergeResult.cls @@ -34,11 +34,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Logging level name was incorrect.'); @@ -71,11 +71,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Logging level was incorrect.'); @@ -103,11 +103,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Logging level was incorrect.'); @@ -140,11 +140,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -177,11 +177,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -214,11 +214,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -246,11 +246,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -283,11 +283,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -320,11 +320,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -357,11 +357,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -389,11 +389,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -426,11 +426,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -463,11 +463,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -500,11 +500,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -532,11 +532,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -569,11 +569,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -606,11 +606,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -643,11 +643,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -675,11 +675,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log event logging level was incorrect.'); @@ -712,11 +712,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -749,11 +749,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -786,11 +786,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -818,11 +818,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -855,11 +855,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -892,11 +892,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -929,11 +929,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -961,11 +961,11 @@ private class Logger_Tests_MergeResult { Database.MergeResult mergeResult = LoggerMockDataCreator.createDatabaseMergeResult(true); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), mergeResult); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); @@ -998,11 +998,11 @@ private class Logger_Tests_MergeResult { List mergeResults = getMergeResultList(); - Test.startTest(); + System.Test.startTest(); LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), mergeResults); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(1, Logger.getBufferSize(), 'Logger buffer size was incorrect.'); System.assertEquals(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c, 'Log entry event logging level was incorrect.'); diff --git a/nebula-logger/managed-package/core/main/configuration/classes/LoggerInstallHandler_Tests.cls b/nebula-logger/managed-package/core/main/configuration/classes/LoggerInstallHandler_Tests.cls index 763aad77d..068437a38 100644 --- a/nebula-logger/managed-package/core/main/configuration/classes/LoggerInstallHandler_Tests.cls +++ b/nebula-logger/managed-package/core/main/configuration/classes/LoggerInstallHandler_Tests.cls @@ -18,10 +18,10 @@ private class LoggerInstallHandler_Tests { Version version = null; Boolean isUpgrade = false; - Test.startTest(); + System.Test.startTest(); LoggerInstallHandler installHandler = new LoggerInstallHandler(); - Test.testInstall(installHandler, version, isUpgrade); - Test.stopTest(); + System.Test.testInstall(installHandler, version, isUpgrade); + System.Test.stopTest(); // Verify that we now have 1 record... List loggerSettings = [SELECT Id FROM LoggerSettings__c]; @@ -56,14 +56,14 @@ private class LoggerInstallHandler_Tests { Version version = null; Boolean isUpgrade = false; - Test.startTest(); + System.Test.startTest(); LoggerInstallHandler installHandler = new LoggerInstallHandler(); installHandler.settingsWithouDefaultSaveMethod = mockSettings; - Test.testInstall(installHandler, version, isUpgrade); + System.Test.testInstall(installHandler, version, isUpgrade); - Test.stopTest(); + System.Test.stopTest(); for (LoggerSettings__c setting : mockSettings) { System.assertNotEquals(null, setting.DefaultSaveMethod__c); diff --git a/nebula-logger/plugins/.images/btn-install-unlocked-package-plugin-production.png b/nebula-logger/plugins/.images/btn-install-unlocked-package-plugin-production.png new file mode 100644 index 000000000..ca8e21863 Binary files /dev/null and b/nebula-logger/plugins/.images/btn-install-unlocked-package-plugin-production.png differ diff --git a/nebula-logger/plugins/.images/btn-install-unlocked-package-plugin-sandbox.png b/nebula-logger/plugins/.images/btn-install-unlocked-package-plugin-sandbox.png index 6b271f988..a7c8cbf97 100644 Binary files a/nebula-logger/plugins/.images/btn-install-unlocked-package-plugin-sandbox.png and b/nebula-logger/plugins/.images/btn-install-unlocked-package-plugin-sandbox.png differ diff --git a/nebula-logger/plugins/.images/btn-install-unlocked-package-plugin.png b/nebula-logger/plugins/.images/btn-install-unlocked-package-plugin.png deleted file mode 100644 index 9c3bbf6a8..000000000 Binary files a/nebula-logger/plugins/.images/btn-install-unlocked-package-plugin.png and /dev/null differ diff --git a/nebula-logger/plugins/async-failure-additions/.images/opt-into-batch-logging-with-logger-parameter.png b/nebula-logger/plugins/async-failure-additions/.images/opt-into-batch-logging-with-logger-parameter.png new file mode 100644 index 000000000..c0291d4b4 Binary files /dev/null and b/nebula-logger/plugins/async-failure-additions/.images/opt-into-batch-logging-with-logger-parameter.png differ diff --git a/nebula-logger/plugins/async-failure-additions/README.md b/nebula-logger/plugins/async-failure-additions/README.md new file mode 100644 index 000000000..2c7063db8 --- /dev/null +++ b/nebula-logger/plugins/async-failure-additions/README.md @@ -0,0 +1,53 @@ +# Async Failure Additions plugin for Nebula Logger + +> :information_source: This plugin requires `v4.7.2` or newer of Nebula Logger's unlocked package + +[![Install Unlocked Package Plugin in a Sandbox](../.images/btn-install-unlocked-package-plugin-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lhiQAA) +[![Install Unlocked Package Plugin in Production](../.images/btn-install-unlocked-package-plugin-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lhiQAA) + +## What's Included + +### Unexpected Batch Error Logging + +By default, this plugin adds support for logging unexpected Batch class failures in Apex. All a batch class needs to do is implement the marker `Database.RaisesPlatformEvents` interface _and_ create a `LoggerParameter__mdt` record where the `Value` field matches the name of the batch class you are looking to add logging for, and the DeveloperName (the "Name" field) starts with `BatchError`: + +```java +// the class MUST implement Database.RaisesPlatformEvents for this to work correctly! +public class MyExampleBatchable implements Database.Batchable, Database.RaisesPlatformEvents { + // etc ... +} +``` + +And the CMDT record: + +![Setting up the Logger Parameter record to opt into unexpected Batch failures](./.images/opt-into-batch-logging-with-logger-parameter.png) + +Once you've correctly configured those two things (the marker interface `Database.RaisesPlatformEvents` on the Apex batchable class, and the Logger Parameter CMDT record), your class will now log any uncaught exceptions that cause that batch class to fail unexpectedly. + +--- + +If you want to customize additional behavior off of the trigger that subscribes to `BatchApexErrorEvent`, you can do so by creating a new Trigger SObject Handler CMDT record using the `TriggerSObjectHandler__mdt.SObjectTypeOverride__c` field (since `BatchApexErrorEvent` isn't one of the supported Entity Definition picklist results). The Logger SObject Handler Name should correspond to a valid instance of `LoggerSObjectHandler` - the instance of `LogBatchApexEventHandler` included in this plugin shows what an example logging implementation for unexpected failures would look like, if you want to go down that route. + +### Queueable Error Logging + +If you have Apex classes that implement `System.Queueable`, you can add error logging with some minimal code additions: + +```java +public class MyExampleQueueable implements System.Queueable { + public void execute (System.QueueableContext qc) { + System.attachFinalizer(new LogFinalizer()); + } +} +``` + +If you'd like to do _additional_ processing, you can alternatively choose to _extend_ `LogFinalizer`: + +```java +public class MyCustomFinalizer extends LogFinalizer { + protected override void innerExecute(System.FinalizerContext fc) { + // do whatever you'd like! + // errors will be logged automatically in addition to what you choose to do here + // no need to call Logger.saveLog() manually on this code path + } +} +``` diff --git a/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler.cls b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler.cls new file mode 100644 index 000000000..4fd27b73f --- /dev/null +++ b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler.cls @@ -0,0 +1,67 @@ +//------------------------------------------------------------------------------------------------// +// 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 Plugins + * @description `BatchApexErrorEvent` handler to log unexpected batch errors for classes that implement `Database.RaisesPlatformEvents` and opt into processing via `LoggerParameter__mdt` + * @see LoggerSObjectHandler + */ +public without sharing class LogBatchApexErrorEventHandler extends LoggerSObjectHandler { + public static final String BATCH_ERROR_LOGGER = 'BatchError'; + public static final String LOG_MESSAGE = 'An unexpected job error occurred: {0} with exception type: {1} and message: {2} during batch phase: {3}.\nStacktrace: {4}'; + private static Boolean shouldSaveLogs = false; + + private List batchApexErrorEvents; + + /** + * @description Opts into the default constructor + */ + public LogBatchApexErrorEventHandler() { + super(); + } + + public override Schema.SObjectType getSObjectType() { + return Schema.BatchApexErrorEvent.SObjectType; + } + + protected override void executeAfterInsert(List triggerNew) { + this.batchApexErrorEvents = (List) triggerNew; + this.handleJobErrors(); + } + + private void handleJobErrors() { + Set asyncApexJobIds = new Set(); + for (BatchApexErrorEvent evt : this.batchApexErrorEvents) { + asyncApexJobIds.add(evt.AsyncApexJobId); + } + + Map jobIdToClass = new Map([SELECT Id, ApexClass.Name FROM AsyncApexJob WHERE Id IN :asyncApexJobIds]); + Logger.error('Batch job terminated unexpectedly'); + for (BatchApexErrorEvent errorEvent : this.batchApexErrorEvents) { + shouldSaveLogs = this.getShouldSaveLogs(jobIdToClass, errorEvent); + LogMessage logMessage = new LogMessage( + LOG_MESSAGE, + new List{ errorEvent.AsyncApexJobId, errorEvent.ExceptionType, errorEvent.Message, errorEvent.Phase, errorEvent.StackTrace } + ); + Logger.error(logMessage); + } + if (shouldSaveLogs) { + Logger.saveLog(); + } + } + + private Boolean getShouldSaveLogs(Map jobIdToClass, BatchApexErrorEvent errorEvent) { + if (shouldSaveLogs == false) { + AsyncApexJob job = jobIdToClass.get(errorEvent.AsyncApexJobId); + List configurationList = LoggerParameter.matchOnPrefix(BATCH_ERROR_LOGGER); + for (LoggerParameter__mdt config : configurationList) { + if (config.Value__c == job?.ApexClass.Name) { + shouldSaveLogs = true; + break; + } + } + } + return shouldSaveLogs; + } +} diff --git a/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler.cls-meta.xml b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler.cls-meta.xml new file mode 100644 index 000000000..891916bb0 --- /dev/null +++ b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler.cls-meta.xml @@ -0,0 +1,5 @@ + + + 54.0 + Active + diff --git a/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler_Tests.cls b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler_Tests.cls new file mode 100644 index 000000000..e327d41dd --- /dev/null +++ b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler_Tests.cls @@ -0,0 +1,100 @@ +//------------------------------------------------------------------------------------------------// +// 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. // +//------------------------------------------------------------------------------------------------// +@SuppressWarnings('PMD.ApexDoc, PMD.ApexAssertionsShouldIncludeMessage, PMD.MethodNamingConventions, PMD.ApexUnitTestClassShouldHaveAsserts') +@IsTest(IsParallel=true) +private class LogBatchApexErrorEventHandler_Tests implements Database.Batchable, Database.RaisesPlatformEvents { + private enum Phase { + START, + EXECUTE, + FINISH + } + + private final Phase throwLocation; + + @IsTest + static void it_should_create_log_when_batch_job_throws_in_start_method() { + runTestForPhase(Phase.START); + } + + @IsTest + static void it_should_create_log_when_batch_job_throws_in_execute_method() { + runTestForPhase(Phase.EXECUTE); + } + + @IsTest + static void it_should_create_log_when_batch_job_throws_in_finish_method() { + runTestForPhase(Phase.FINISH); + } + + @SuppressWarnings('PMD.EmptyCatchBlock') + private static void runTestForPhase(Phase phase) { + Logger.getUserSettings().IsApexSystemDebugLoggingEnabled__c = false; + LoggerParameter__mdt mockParam = new LoggerParameter__mdt(); + mockParam.Value__c = LogBatchApexErrorEventHandler_Tests.class.getName(); + mockParam.DeveloperName = LogBatchApexErrorEventHandler.BATCH_ERROR_LOGGER + 'Test'; + LoggerParameter.setMock(mockParam); + try { + System.Test.startTest(); + Database.executeBatch(new LogBatchApexErrorEventHandler_Tests(phase)); + System.Test.stopTest(); + } catch (Exception ex) { + // via https://salesforce.stackexchange.com/questions/263419/testing-batchapexerrorevent-trigger + } + // at this point, we're still two async-levels deep into Platform Event-land; we need to call "deliver()" twice + System.Test.getEventBus().deliver(); // fires the platform event for Database.RaisesPlatformEvents + System.Test.getEventBus().deliver(); // fires the logger's platform event + + assertLogWasCreatedForPhase(phase); + } + + private static void assertLogWasCreatedForPhase(Phase phase) { + Log__c log = getLog(); + System.assertNotEquals(null, log, 'Log should have been created!'); + System.assertEquals(2, log.LogEntries__r.size(), 'Two log entries should have been created'); + System.assertEquals('Batch job terminated unexpectedly', log.LogEntries__r[0].Message__c); + System.assertEquals( + String.format( + LogBatchApexErrorEventHandler.LOG_MESSAGE, + new List{ 'someId', 'System.IllegalArgumentException', phase.name(), phase.name(), 'stacktrace' } + ) + .subStringAfter('with') + .substringBefore('Stacktrace:'), + log.LogEntries__r[1].Message__c.substringAfter('with').substringBefore('Stacktrace:') + ); + } + + /** + * the `BatchApexErrorEvent` type has a property, `Phase` with three possible values: + * - START + * - EXECUTE + * - FINISH + */ + public LogBatchApexErrorEventHandler_Tests(Phase throwLocation) { + this.throwLocation = throwLocation; + } + + public Database.QueryLocator start(Database.BatchableContext bc) { + throwOnLocationMatch(Phase.START); + return Database.getQueryLocator([SELECT Id FROM User LIMIT 1]); + } + + public void execute(Database.BatchableContext bc, List scope) { + throwOnLocationMatch(Phase.EXECUTE); + } + + public void finish(Database.BatchableContext bc) { + throwOnLocationMatch(Phase.FINISH); + } + + private void throwOnLocationMatch(Phase phase) { + if (this.throwLocation == phase) { + throw new IllegalArgumentException(this.throwLocation.name()); + } + } + + private static Log__c getLog() { + return [SELECT Id, (SELECT Message__c FROM LogEntries__r) FROM Log__c]; + } +} diff --git a/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler_Tests.cls-meta.xml b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler_Tests.cls-meta.xml new file mode 100644 index 000000000..891916bb0 --- /dev/null +++ b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler_Tests.cls-meta.xml @@ -0,0 +1,5 @@ + + + 54.0 + Active + diff --git a/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFinalizer.cls b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFinalizer.cls new file mode 100644 index 000000000..8e29533f7 --- /dev/null +++ b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFinalizer.cls @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------------------------// +// 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 Plugins + * @description `System.Finalizer` implementation that can be used by subscribers to log errors + */ +public without sharing virtual class LogFinalizer implements System.Finalizer { + /** + * @description Is called by any `System.Queueable` where the finalizer is attached after the Queueable's `execute` method finishes + * @param fc The `System.FinalizerContext` associated with the finalizer + */ + public void execute(System.FinalizerContext fc) { + switch on fc.getResult() { + when UNHANDLED_EXCEPTION { + Logger.error('There was an error during this queueable job'); + Logger.error('Error details', fc.getException()); + } + } + this.innerExecute(fc); + Logger.saveLog(); + } + + /** + * @description Subscribers can optionally override this method with their own implementation to do further processing/re-queueing + * @param fc The `System.FinalizerContext` associated with the finalizer + */ + @SuppressWarnings('PMD.EmptyStatementBlock') + protected virtual void innerExecute(System.FinalizerContext fc) { + // subscribers can override this to do their own post-processing if necessary, otherwise it's a no-op + } +} diff --git a/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFinalizer.cls-meta.xml b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFinalizer.cls-meta.xml new file mode 100644 index 000000000..891916bb0 --- /dev/null +++ b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFinalizer.cls-meta.xml @@ -0,0 +1,5 @@ + + + 54.0 + Active + diff --git a/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFinalizer_Tests.cls b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFinalizer_Tests.cls new file mode 100644 index 000000000..fc4a56f8d --- /dev/null +++ b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFinalizer_Tests.cls @@ -0,0 +1,55 @@ +//------------------------------------------------------------------------------------------------// +// 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. // +//------------------------------------------------------------------------------------------------// +@SuppressWarnings('PMD.ApexDoc, PMD.ApexAssertionsShouldIncludeMessage, PMD.MethodNamingConventions') +@IsTest(IsParallel=true) +private class LogFinalizer_Tests { + private static final String EXPECTED_ERROR_MESSAGE = 'Gack'; + @IsTest + static void it_should_not_log_on_queueable_success() { + System.Test.startTest(); + System.enqueueJob(new ExampleQueueable()); + System.Test.stopTest(); + System.Test.getEventBus().deliver(); + + System.assertEquals(0, [SELECT COUNT() FROM Log__c], 'Should not log if no errors'); + } + + @IsTest + static void it_should_log_on_queueable_error() { + try { + System.Test.startTest(); + System.enqueueJob(new ExampleFailedQueueable()); + System.Test.stopTest(); + } catch (Exception ex) { + System.assertEquals(EXPECTED_ERROR_MESSAGE, ex.getMessage()); + } + System.Test.getEventBus().deliver(); + + List logEntries = [SELECT Message__c, ExceptionMessage__c FROM LogEntry__c]; + System.assertEquals(2, logEntries.size(), 'Should log for errors'); + LogEntry__c firstEntry = logEntries.get(0); + System.assertEquals('There was an error during this queueable job', firstEntry.Message__c); + LogEntry__c secondEntry = logEntries.get(1); + System.assertEquals('Error details', secondEntry.Message__c); + System.assertEquals(EXPECTED_ERROR_MESSAGE, secondEntry.ExceptionMessage__c); + } + + private virtual class ExampleQueueable implements System.Queueable { + public void execute(System.QueueableContext qc) { + System.attachFinalizer(new LogFinalizer()); + this.innerExecute(); + } + + @SuppressWarnings('PMD.EmptyStatementBlock') + protected virtual void innerExecute() { + } + } + + private virtual class ExampleFailedQueueable extends ExampleQueueable { + protected override void innerExecute() { + throw new IllegalArgumentException(EXPECTED_ERROR_MESSAGE); + } + } +} diff --git a/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFinalizer_Tests.cls-meta.xml b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFinalizer_Tests.cls-meta.xml new file mode 100644 index 000000000..891916bb0 --- /dev/null +++ b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFinalizer_Tests.cls-meta.xml @@ -0,0 +1,5 @@ + + + 54.0 + Active + diff --git a/nebula-logger/plugins/async-failure-additions/plugin/triggers/LogBatchApexErrorEventTrigger.trigger b/nebula-logger/plugins/async-failure-additions/plugin/triggers/LogBatchApexErrorEventTrigger.trigger new file mode 100644 index 000000000..8c68f608e --- /dev/null +++ b/nebula-logger/plugins/async-failure-additions/plugin/triggers/LogBatchApexErrorEventTrigger.trigger @@ -0,0 +1,7 @@ +//------------------------------------------------------------------------------------------------// +// 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. // +//------------------------------------------------------------------------------------------------// +trigger LogBatchApexErrorEventTrigger on BatchApexErrorEvent(after insert) { + LoggerSObjectHandler.getHandler(Schema.BatchApexErrorEvent.SObjectType, new LogBatchApexErrorEventHandler()).execute(); +} diff --git a/nebula-logger/plugins/async-failure-additions/plugin/triggers/LogBatchApexErrorEventTrigger.trigger-meta.xml b/nebula-logger/plugins/async-failure-additions/plugin/triggers/LogBatchApexErrorEventTrigger.trigger-meta.xml new file mode 100644 index 000000000..5e573d796 --- /dev/null +++ b/nebula-logger/plugins/async-failure-additions/plugin/triggers/LogBatchApexErrorEventTrigger.trigger-meta.xml @@ -0,0 +1,5 @@ + + + 54.0 + Active + diff --git a/nebula-logger/plugins/big-object-archiving/README.md b/nebula-logger/plugins/big-object-archiving/README.md index 403644da2..882f84944 100644 --- a/nebula-logger/plugins/big-object-archiving/README.md +++ b/nebula-logger/plugins/big-object-archiving/README.md @@ -2,16 +2,16 @@ > :information_source: This plugin requires `v4.7.1` or newer of Nebula Logger's unlocked package -[![Install Unlocked Package](../.images/btn-install-unlocked-package-plugin-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lgLQAQ) -Adds a Big Object - `LogEntryArchive__b` - to Nebula Logger for archiving of logging data. +[![Install Unlocked Package Plugin in a Sandbox](../.images/btn-install-unlocked-package-plugin-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lgLQAQ) +[![Install Unlocked Package Plugin in Production](../.images/btn-install-unlocked-package-plugin-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lgLQAQ) -The `LogEntryArchive__b` object can be used to: +Adds a Big Object - `LogEntryArchive__b` - to Nebula Logger for archiving of logging data. The `LogEntryArchive__b` object can be used to: - **To immediately publish logging data, instead of using platform events**. Out of the box, Nebula Logger leverages platform events (`LogEntryEvent__e`) as the mechanism for saving logging data, even if an error occurs. It then transforms the platform event data in `LogEntryEvent__e` and stores it in `Log__c` and `LogEntry__c` for reporting & managing of logs. If you want to skip the platform events altogether, and don't need to report on the data via Log**c or LogEntry**c, then you can leverage the Big Object Archiving plugin to immediately write to `LogEntryArchive__b`, giving you a way to store logging data on platform, without consuming your data storage limits (although it's worth noting that Big Objects have their own storage limits as well). - **To later archive `Log__c` and `LogEntry__c` data**. If you want to leverage the benefits of having logging data in `Log__c` and `LogEntry__c`, but need to delete some records due to storage limits, the plugin also provides the ability to archive `Log__c` and `LogEntry__c` data into the big object `LogEntryArchive__b`. This is accomplished by setting a "Log Purge Action" to "Archive" on any `Log__c` records that you want to archive into the `LogEntryArchive__b` big object. - When the `LogBatchPurger` job runs, any `Log__c` (and related `LogEntry__c` records) with a "Log Purge Action" of "Archive" and a "Log Retention Date" <= TODAY will first be copied into the big object `LogEntryArchive__b`, before being deleted in `Log__c` and `LogEntry__c`. -![Big Object Archiving plugin: Log Entry Archives tab](./images/log-entry-archives-tab.png) +![Big Object Archiving plugin: Log Entry Archives tab](./.images/log-entry-archives-tab.png) --- @@ -19,7 +19,7 @@ The `LogEntryArchive__b` object can be used to: This plugin includes some add-on metadata for Nebula Logger to support storing logging data within a big object -1. BigObject `LogEntryArchive__b` +1. Big Object `LogEntryArchive__b` 2. Custom tab "Log Entry Archives" to display the included LWC `logEntryArchives` 3. Apex classes `LogEntryArchivePlugin`, `LogEntryArchiveBuilder` and corresponding test classes 4. Plugin configuration details stored in Logger's CMDT objects `LoggerPlugin__mdt` and `LoggerParameter__mdt` diff --git a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls index 0c841fe60..b6fa08821 100644 --- a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls +++ b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls @@ -5,7 +5,7 @@ /** * @group Plugins - * @description Builder class to create an instance of `LogEntryArchive__b`, used by the BigObject plugin + * @description Builder class to create an instance of `LogEntryArchive__b`, used by the Big Object plugin * @see LogEntryArchivePlugin * @see LogEntryEventBuilder */ diff --git a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchivePlugin.cls b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchivePlugin.cls index 8e70b2f8b..6a62f86c1 100644 --- a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchivePlugin.cls +++ b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchivePlugin.cls @@ -5,7 +5,7 @@ /** * @group Plugins - * @description Optional plugin that provides a BigObject, `LogEntryArchive__b`, as an alternative option + * @description Optional plugin that provides a Big Object, `LogEntryArchive__b`, as an alternative option * to the platform event `LogEntryEvent__e` * @see LoggerPlugin */ diff --git a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchivePlugin_Tests.cls b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchivePlugin_Tests.cls index 9f939c478..0187fa995 100644 --- a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchivePlugin_Tests.cls +++ b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchivePlugin_Tests.cls @@ -34,11 +34,11 @@ private class LogEntryArchivePlugin_Tests { createPluginConfiguration(); LogBatchPurger batchPurger = new LogBatchPurger(); Log__c log = [SELECT Id, (SELECT Id FROM LogEntries__r) FROM Log__c WHERE LogPurgeAction__c = :LogEntryArchivePlugin.BIG_OBJECT_LOG_PURGE_ACTION]; - Test.startTest(); + System.Test.startTest(); Database.executeBatch(batchPurger); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(log.LogEntries__r.size(), LogEntryArchivePlugin.LOG_ENTRY_ARCHIVES_TO_SAVE.size()); List existingLogs = [SELECT Id FROM Log__c WHERE LogPurgeAction__c = :LogEntryArchivePlugin.BIG_OBJECT_LOG_PURGE_ACTION]; System.assertEquals(0, existingLogs.size()); @@ -66,11 +66,11 @@ private class LogEntryArchivePlugin_Tests { logToSkip.LogEntries__r.isEmpty(), 'Test has started under the wrong condiations - log record should have some related log entries' ); - Test.startTest(); + System.Test.startTest(); Database.executeBatch(batchPurger); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals( logToArchive.LogEntries__r.size(), LogEntryArchivePlugin.LOG_ENTRY_ARCHIVES_TO_SAVE.size(), @@ -98,12 +98,12 @@ private class LogEntryArchivePlugin_Tests { logEntryTags.add(new LogEntryTag__c(LogEntry__c = logEntry.Id, Tag__c = tag.Id)); } insert logEntryTags; - Test.startTest(); + System.Test.startTest(); Database.executeBatch(batchPurger); System.assertEquals(0, Limits.getPublishImmediateDml()); - Test.stopTest(); + System.Test.stopTest(); System.assertEquals(0, Limits.getPublishImmediateDml()); System.assertEquals(logToArchive.LogEntries__r.size(), LogEntryArchivePlugin.LOG_ENTRY_ARCHIVES_TO_SAVE.size()); for (LogEntryArchive__b logEntryArchive : LogEntryArchivePlugin.LOG_ENTRY_ARCHIVES_TO_SAVE) { @@ -198,7 +198,7 @@ private class LogEntryArchivePlugin_Tests { Logger.getUserSettings().DefaultSaveMethod__c = LogEntryArchivePlugin.BIG_OBJECT_QUEUEABLE_LOGGER_SAVE_METHOD; createPluginConfiguration(); Logger.info('Testing big object creation').getLogEntryEvent(); - Test.startTest(); + System.Test.startTest(); System.assertEquals(0, Limits.getAsyncCalls(), 'Should not have executed any queueable jobs'); Logger.saveLog(); @@ -216,7 +216,7 @@ private class LogEntryArchivePlugin_Tests { LogEntryArchivePlugin.lastSaveMethodUsed, 'Last save method used should have been set to BIG_OBJECT_QUEUEABLE' ); - Test.stopTest(); + System.Test.stopTest(); } private static void createParameterConfigurations() { diff --git a/nebula-logger/plugins/big-object-archiving/plugin/customMetadata/LoggerPlugin.LogEntryArchive.md-meta.xml b/nebula-logger/plugins/big-object-archiving/plugin/customMetadata/LoggerPlugin.LogEntryArchive.md-meta.xml index c541e6dc4..b311f1326 100644 --- a/nebula-logger/plugins/big-object-archiving/plugin/customMetadata/LoggerPlugin.LogEntryArchive.md-meta.xml +++ b/nebula-logger/plugins/big-object-archiving/plugin/customMetadata/LoggerPlugin.LogEntryArchive.md-meta.xml @@ -20,7 +20,7 @@ Description__c - Adds the ability to log directly to the BigObject LogEntryArchive__b + Adds the ability to log directly to the Big Object LogEntryArchive__b IsEnabled__c diff --git a/nebula-logger/plugins/big-object-archiving/plugin/permissionsets/LoggerLogEntryArchiveAdmin.permissionset-meta.xml b/nebula-logger/plugins/big-object-archiving/plugin/permissionsets/LoggerLogEntryArchiveAdmin.permissionset-meta.xml index 1cc2bb531..b4d8482a1 100644 --- a/nebula-logger/plugins/big-object-archiving/plugin/permissionsets/LoggerLogEntryArchiveAdmin.permissionset-meta.xml +++ b/nebula-logger/plugins/big-object-archiving/plugin/permissionsets/LoggerLogEntryArchiveAdmin.permissionset-meta.xml @@ -1,6 +1,6 @@ - Provides admin access to the BigObject LogEntryEventArchive__b, included with the BigObject plugin for Nebula Logger + Provides admin access to the metadata included in the Big Object plugin for Nebula Logger true LogEntryArchive__b.ApiReleaseNumber__c diff --git a/nebula-logger/plugins/log-retention-rules/README.md b/nebula-logger/plugins/log-retention-rules/README.md index a7d0c0817..3e1dc95fe 100644 --- a/nebula-logger/plugins/log-retention-rules/README.md +++ b/nebula-logger/plugins/log-retention-rules/README.md @@ -2,7 +2,8 @@ > :information_source: This plugin requires `v4.7.1` or newer of Nebula Logger's unlocked package -[![Install Unlocked Package Plugin](../.images/btn-install-unlocked-package-plugin-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lgGQAQ) +[![Install Unlocked Package Plugin in a Sandbox](../.images/btn-install-unlocked-package-plugin-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lgGQAQ) +[![Install Unlocked Package Plugin in Production](../.images/btn-install-unlocked-package-plugin-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lgGQAQ) Adds the ability to create & deploy advanced, configurable rules for setting the retention date of `Log__c` records, using custom metadata types `LogRetentionRule__mdt` and `LogRetentionRuleCondition__mdt`. @@ -30,7 +31,7 @@ This plugin is currently in beta and cannot be installed in production - however After installing the plugin, you can add rules using the custom metadata types `LogRetentionRule__mdt` and `LogRetentionRuleCondition__mdt`. Multiple rules can be configured in your orgs, as shown below: -![Log Retention Rules plugin: Example Rule](./content/example-log-retention-rules-list-view.png) +![Log Retention Rules plugin: Example Rule](./.images/example-log-retention-rules-list-view.png) In this example rule, for every inserted `LogEntry__c` record, 2 conditions are checked: @@ -39,4 +40,4 @@ In this example rule, for every inserted `LogEntry__c` record, 2 conditions are If any `LogEntry__c` record is inserted that meets these 2 conditions, then the parent `Log__c` record will have the field `LogRetentionDate__c` set to `System.today() + 30`. -![Log Retention Rules plugin: Example Rule](./content/example-log-retention-rule-with-conditions.png) +![Log Retention Rules plugin: Example Rule](./.images/example-log-retention-rule-with-conditions.png) diff --git a/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionRulesPlugin_Tests.cls b/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionRulesPlugin_Tests.cls index d40c190ad..f8c1fef0c 100644 --- a/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionRulesPlugin_Tests.cls +++ b/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionRulesPlugin_Tests.cls @@ -25,7 +25,7 @@ private class LogRetentionRulesPlugin_Tests { LogRetentionRulesPlugin.setMockRetentionRuleConditions(rule, conditions); Log__c log = new Log__c(TransactionId__c = '1234'); insert log; - Test.setCreatedDate(log.Id, now.addDays(-1)); + System.Test.setCreatedDate(log.Id, now.addDays(-1)); log = [SELECT Id, LogRetentionDate__c FROM Log__c WHERE Id = :log.Id]; System.assertEquals(originalLogRetentionDate, log.LogRetentionDate__c); @@ -54,7 +54,7 @@ private class LogRetentionRulesPlugin_Tests { Log__c log = new Log__c(TransactionId__c = '1234'); insert log; - Test.setCreatedDate(log.Id, now); + System.Test.setCreatedDate(log.Id, now); log = [SELECT Id, LogRetentionDate__c FROM Log__c WHERE Id = :log.Id]; System.assertEquals(originalLogRetentionDate, log.LogRetentionDate__c); diff --git a/nebula-logger/plugins/logger-admin-dashboard/README.md b/nebula-logger/plugins/logger-admin-dashboard/README.md index c463c7c88..92893dd77 100644 --- a/nebula-logger/plugins/logger-admin-dashboard/README.md +++ b/nebula-logger/plugins/logger-admin-dashboard/README.md @@ -2,7 +2,8 @@ > :information_source: This plugin requires `v4.6.12` or newer of Nebula Logger's unlocked package -[![Install Unlocked Package Plugin](../.images/btn-install-unlocked-package-plugin-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015l3yQAA) +[![Install Unlocked Package Plugin in a Sandbox](../.images/btn-install-unlocked-package-plugin-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015l3yQAA) +[![Install Unlocked Package Plugin in Production](../.images/btn-install-unlocked-package-plugin-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015l3yQAA) To help monitor logs in your org, this plugin includes a new Logger Admin dynamic dashboard, as well as several new reports. The dashboard displays several report charts to quickly see summary info about your logs. It supports filtering on: @@ -10,4 +11,4 @@ To help monitor logs in your org, this plugin includes a new Logger Admin dynami - Logging Level: based on `LogEntry__c.LoggingLevel__c` - Origin Type: based on `LogEntry__c.OriginType__c` -![Logger Admin Dashboard](./images/logger-admin-dashboard.png) +![Logger Admin Dashboard](./.images/logger-admin-dashboard.png) diff --git a/nebula-logger/plugins/slack/README.md b/nebula-logger/plugins/slack/README.md index 07fdb637f..ea29601d7 100644 --- a/nebula-logger/plugins/slack/README.md +++ b/nebula-logger/plugins/slack/README.md @@ -2,11 +2,12 @@ > :information_source: This plugin requires `v4.7.1` or newer of Nebula Logger's unlocked package -[![Install Unlocked Package](../.images/btn-install-unlocked-package-plugin-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lgQQAQ) +[![Install Unlocked Package Plugin in a Sandbox](../.images/btn-install-unlocked-package-plugin-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lgQQAQ) +[![Install Unlocked Package Plugin in Production](../.images/btn-install-unlocked-package-plugin-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015lgQQAQ) Adds a Slack integration for the unlocked package edition of Nebula Logger. Any logs with log entries that meet a certain (configurable) logging level will automatically be posted to your Slack channel via an asynchronous `Queueable` job. -![Slack plugin: notification](./images/slack-plugin-notification.png) +![Slack plugin: notification](./.images/slack-plugin-notification.png) --- @@ -48,4 +49,4 @@ Check out [Slack's webhooks documentation](https://api.slack.com/messaging/webho The Slack integration should now be setup & working - any new logs that meet the specified notification logging level (step 6 above) will send a Slack notification. -![Slack plugin: parameters](./images/slack-plugin-parameters.png) +![Slack plugin: parameters](./.images/slack-plugin-parameters.png) diff --git a/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin.cls b/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin.cls index 5fc0dc945..64b7ca3ad 100644 --- a/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin.cls +++ b/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin.cls @@ -55,7 +55,6 @@ public without sharing class SlackLoggerPlugin implements LoggerPlugin.Triggerab * @description Handles the queuable execute logic. Required by the Queueable interface. * @param queueableContext Context of the current queuable instance. */ - @SuppressWarnings('PMD.AvoidDebugStatements') public void execute(System.QueueableContext queueableContext) { // Since this runs in an async context, requery the logs just in case any field values have changed this.requeryLogs(); diff --git a/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin_Tests.cls b/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin_Tests.cls index 555548494..9fa3e5cc1 100644 --- a/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin_Tests.cls +++ b/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin_Tests.cls @@ -28,9 +28,9 @@ private class SlackLoggerPlugin_Tests { System.assertEquals(1, log.LogEntries__r.size(), 'Log entries size was not equal to 1.'); System.assertEquals(false, log.SendSlackNotification__c, 'SendSlackNotification was incorrectly set to true.'); System.assertEquals(null, log.SlackNotificationDate__c, 'SlackNotificationDate was not null.'); - Test.startTest(); + System.Test.startTest(); LoggerMockDataCreator.MockHttpCallout calloutMock = LoggerMockDataCreator.createHttpCallout().setStatusCode(200); - Test.setMock(HttpCalloutMock.class, calloutMock); + System.Test.setMock(HttpCalloutMock.class, calloutMock); // Load the mock configurations - the plugin framework won't load actual CMDT records during tests LoggingLevel slackLoggingLevel = LoggingLevel.ERROR; System.assert(logEntryLoggingLevel.ordinal() < slackLoggingLevel.ordinal(), 'Slack logging level ordinal was incorrect.'); @@ -45,7 +45,7 @@ private class SlackLoggerPlugin_Tests { // Verify that the internal queueable job has been enqueued System.assertEquals(0, Limits.getAsyncCalls(), 'The queueable job should not have been enqueued'); // Stop the test so the internal queueable job runs - Test.stopTest(); + System.Test.stopTest(); log = queryLogs(logEntryLoggingLevel).get(0); System.assertEquals(1, log.LogEntries__r.size(), 'Log entries size was not equal to 1.'); System.assertEquals(false, log.SendSlackNotification__c, 'SendSlackNotification incorrectly set to true.'); @@ -75,9 +75,9 @@ private class SlackLoggerPlugin_Tests { System.assertEquals(1, log.LogEntries__r.size(), 'Log entries did not match the expected count of 1.'); System.assertEquals(false, log.SendSlackNotification__c, 'SendSlackNotification was incorrectly set to true.'); System.assertEquals(null, log.SlackNotificationDate__c, 'SlackNotificationDate was not null.'); - Test.startTest(); + System.Test.startTest(); LoggerMockDataCreator.MockHttpCallout calloutMock = LoggerMockDataCreator.createHttpCallout().setStatusCode(200); - Test.setMock(HttpCalloutMock.class, calloutMock); + System.Test.setMock(HttpCalloutMock.class, calloutMock); // Load the mock configurations - the plugin framework won't load actual CMDT records during tests mockConfigurations(logEntryLoggingLevel); System.assert( @@ -93,7 +93,7 @@ private class SlackLoggerPlugin_Tests { // Verify that the internal queueable job has been enqueued System.assertEquals(1, Limits.getAsyncCalls(), 'The queueable job should have been enqueued'); // Stop the test so the internal queueable job runs - Test.stopTest(); + System.Test.stopTest(); log = [SELECT Id, MaxLogEntryLoggingLevelOrdinal__c, SendSlackNotification__c, SlackNotificationDate__c FROM Log__c]; System.assertEquals(true, log.SendSlackNotification__c, 'SendSlackNotification was incorrectly set to false.'); System.assertNotEquals(null, log.SlackNotificationDate__c, 'SlackNotificationDate was null.'); @@ -123,9 +123,9 @@ private class SlackLoggerPlugin_Tests { System.assertEquals(1, log.LogEntries__r.size(), 'Log entries did not match the expected count of 1.'); System.assertEquals(false, log.SendSlackNotification__c, 'SendSlackNotification was incorrectly set to true.'); System.assertEquals(null, log.SlackNotificationDate__c, 'SlackNotificationDate was not null.'); - Test.startTest(); + System.Test.startTest(); LoggerMockDataCreator.MockHttpCallout calloutMock = LoggerMockDataCreator.createHttpCallout().setStatusCode(200); - Test.setMock(HttpCalloutMock.class, calloutMock); + System.Test.setMock(HttpCalloutMock.class, calloutMock); // Load the mock configurations - the plugin framework won't load actual CMDT records during tests mockConfigurations(logEntryLoggingLevel); System.assert( @@ -141,7 +141,7 @@ private class SlackLoggerPlugin_Tests { // Verify that the internal queueable job has been enqueued System.assertEquals(1, Limits.getAsyncCalls(), 'The queueable job should have been enqueued'); // Stop the test so the internal queueable job runs - Test.stopTest(); + System.Test.stopTest(); log = [SELECT Id, MaxLogEntryLoggingLevelOrdinal__c, SendSlackNotification__c, SlackNotificationDate__c FROM Log__c]; System.assertEquals(true, log.SendSlackNotification__c, 'SendSlackNotification was incorrectly set to false.'); System.assertNotEquals(null, log.SlackNotificationDate__c, 'SlackNotificationDate was null.'); @@ -171,9 +171,9 @@ private class SlackLoggerPlugin_Tests { System.assertEquals(1, log.LogEntries__r.size(), 'Log entries did not match the expected count of 1.'); System.assertEquals(false, log.SendSlackNotification__c, 'SendSlackNotification was incorrectly set to true.'); System.assertEquals(null, log.SlackNotificationDate__c, 'SlackNotificationDate was not null.'); - Test.startTest(); + System.Test.startTest(); LoggerMockDataCreator.MockHttpCallout calloutMock = LoggerMockDataCreator.createHttpCallout().setStatusCode(200); - Test.setMock(HttpCalloutMock.class, calloutMock); + System.Test.setMock(HttpCalloutMock.class, calloutMock); // Load the mock configurations - the plugin framework won't load actual CMDT records during tests mockConfigurations(logEntryLoggingLevel); System.assert( @@ -189,7 +189,7 @@ private class SlackLoggerPlugin_Tests { // Verify that the internal queueable job has been enqueued System.assertEquals(1, Limits.getAsyncCalls(), 'The queueable job should have been enqueued'); // Stop the test so the internal queueable job runs - Test.stopTest(); + System.Test.stopTest(); log = [SELECT Id, MaxLogEntryLoggingLevelOrdinal__c, SendSlackNotification__c, SlackNotificationDate__c FROM Log__c]; System.assertEquals(true, log.SendSlackNotification__c, 'SendSlackNotification was incorrectly set to false.'); System.assertNotEquals(null, log.SlackNotificationDate__c, 'SlackNotificationDate was null.'); diff --git a/package-lock.json b/package-lock.json index 048973be6..357f6351f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "nebula-logger", - "version": "4.7.1", + "version": "4.7.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -7101,8 +7101,7 @@ "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" }, "ansi-styles": { "version": "3.2.1", @@ -7359,8 +7358,7 @@ "async": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", - "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", - "dev": true + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==" }, "async-hook-jl": { "version": "1.7.6", @@ -9389,12 +9387,11 @@ } }, "ejs": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.6.tgz", - "integrity": "sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw==", - "dev": true, + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz", + "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==", "requires": { - "jake": "^10.6.1" + "jake": "^10.8.5" } }, "electron-to-chromium": { @@ -10624,12 +10621,29 @@ "dev": true }, "filelist": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz", - "integrity": "sha512-z7O0IS8Plc39rTCq6i6iHxk43duYOn8uFJiWSewIq0Bww1RNybVHSCjahmcC87ZqAm4OTvFzlzeGu3XAzG1ctQ==", - "dev": true, + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.3.tgz", + "integrity": "sha512-LwjCsruLWQULGYKy7TX0OPtrL9kLpojOFKc5VCTxdFTV7w5zbsgqVKfnkKG7Qgjtq50gKfO56hJv88OfcGb70Q==", "requires": { - "minimatch": "^3.0.4" + "minimatch": "^5.0.1" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "requires": { + "brace-expansion": "^2.0.1" + } + } } }, "filesize": { @@ -11072,7 +11086,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, "requires": { "is-glob": "^4.0.1" } @@ -11993,8 +12006,7 @@ "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" }, "is-fullwidth-code-point": { "version": "3.0.0", @@ -12012,7 +12024,6 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, "requires": { "is-extglob": "^2.1.1" } @@ -12337,12 +12348,11 @@ } }, "jake": { - "version": "10.8.4", - "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.4.tgz", - "integrity": "sha512-MtWeTkl1qGsWUtbl/Jsca/8xSoK3x0UmS82sNbjqxxG/de/M/3b1DntdjHgPMC50enlTNwXOCRqPXLLt5cCfZA==", - "dev": true, + "version": "10.8.5", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz", + "integrity": "sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==", "requires": { - "async": "0.9.x", + "async": "^3.2.3", "chalk": "^4.0.2", "filelist": "^1.0.1", "minimatch": "^3.0.4" @@ -12352,22 +12362,14 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "requires": { "color-convert": "^2.0.1" } }, - "async": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", - "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", - "dev": true - }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -12377,7 +12379,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, "requires": { "color-name": "~1.1.4" } @@ -12385,20 +12386,17 @@ "color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, "requires": { "has-flag": "^4.0.0" } @@ -13924,8 +13922,7 @@ "json-schema": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", - "dev": true + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" }, "json-schema-traverse": { "version": "0.4.1", diff --git a/package.json b/package.json index 662b8009d..1addae3f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nebula-logger", - "version": "4.7.1", + "version": "4.7.2", "description": "Designed for Salesforce admins, developers & architects. A robust logger for Apex, Flow, Process Builder & Integrations.", "author": "Jonathan Gillespie", "license": "MIT", @@ -58,10 +58,11 @@ "permset:assign:admin": "sfdx force:user:permset:assign --permsetname LoggerAdmin", "permset:assign:big-object-admin": "sfdx force:user:permset:assign --permsetname LoggerLogEntryArchiveAdmin", "permset:assign:slack-admin": "sfdx force:user:permset:assign --permsetname LoggerSlackPluginAdmin", - "plugin:version:create:big-object-archiving": "sfdx force:package:version:create --json --package \"Nebula Logger - Core Plugin - Big Object Archiving\" --codecoverage --installationkeybypass --wait 30", - "plugin:version:create:log-retention-rules": "sfdx force:package:version:create --json --package \"Nebula Logger - Core Plugin - Log Retention Rules\" --codecoverage --installationkeybypass --wait 30", - "plugin:version:create:logger-admin-dashboard": "sfdx force:package:version:create --json --package \"Nebula Logger - Core Plugin - Logger Admin Dashboard\" --codecoverage --installationkeybypass --wait 30", - "plugin:version:create:slack": "sfdx force:package:version:create --json --package \"Nebula Logger - Core Plugin - Slack\" --codecoverage --installationkeybypass --wait 30", + "plugin:version:create:async-failure-additions": "sfdx force:package:version:create --json --package \"Nebula Logger - Plugin - Async Failure Additions\" --codecoverage --installationkeybypass --wait 30", + "plugin:version:create:big-object": "sfdx force:package:version:create --json --package \"Nebula Logger - Plugin - Big Object Archiving\" --codecoverage --installationkeybypass --wait 30", + "plugin:version:create:log-retention-rules": "sfdx force:package:version:create --json --package \"Nebula Logger - Plugin - Log Retention Rules\" --codecoverage --installationkeybypass --wait 30", + "plugin:version:create:logger-admin-dashboard": "sfdx force:package:version:create --json --package \"Nebula Logger - Plugin - Logger Admin Dashboard\" --codecoverage --installationkeybypass --wait 30", + "plugin:version:create:slack": "sfdx force:package:version:create --json --package \"Nebula Logger - Plugin - Slack\" --codecoverage --installationkeybypass --wait 30", "prepare": "husky install && chmod +x ./.husky/pre-commit", "prettier:fix": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", "prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", @@ -79,7 +80,12 @@ "test:lwc": "sfdx-lwc-jest --coverage --skipApiVersionCheck --verbose" }, "dependencies": { + "ansi-regex": ">=5.0.1", + "async": ">=2.6.4", + "ejs": ">=3.1.7", "follow-redirects": ">=1.14.8", + "glob-parent": ">=5.1.2", + "json-schema": ">=0.4.0", "markdown-it": ">=12.3.2", "marked": ">=4.0.10", "nanoid": ">=3.1.31", diff --git a/sfdx-project.json b/sfdx-project.json index 1f150cf23..ee0878d52 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -7,12 +7,25 @@ "package": "Nebula Logger - Core", "path": "./nebula-logger/core", "definitionFile": "./config/scratch-orgs/base-scratch-def.json", - "versionNumber": "4.7.1.NEXT", - "versionName": "Plugin Framework Overhaul", - "versionDescription": "New approach implemented for plugins, providing more control within LoggerSObjectHandler, and the ability to create plugins for LogBatchPurger", + "versionNumber": "4.7.2.NEXT", + "versionName": "Parent Log Transaction ID Bugfix", + "versionDescription": "Fixes an issue that would prevent logs from saving if the specified parent log transaction ID could not be found", "releaseNotesUrl": "https://github.com/jongpie/NebulaLogger/releases", "default": true }, + { + "default": false, + "package": "Nebula Logger - Plugin - Async Failure Additions", + "path": "./nebula-logger/plugins/async-failure-additions/plugin", + "dependencies": [ + { + "package": "Nebula Logger - Core@4.7.2-1-parent-log-transaction-id-bugfix" + } + ], + "versionName": "Initial release with Finalizer and BatchApexErrorEvent functionality", + "versionNumber": "1.0.0.NEXT", + "versionDescription": "Adds the capability to get Logs created for unexpected Apex Batch class failures through LoggerParameter__mdt additions, and provides a Finalizer implementation for logging Queueable failures" + }, { "package": "Nebula Logger - Plugin - Big Object Archiving", "path": "./nebula-logger/plugins/big-object-archiving/plugin", @@ -62,7 +75,7 @@ ], "versionName": "Beta Release: Round 3", "versionNumber": "0.10.0.NEXT", - "versionDescription": "TODO", + "versionDescription": "Updated Slack plugin to work with Nebula Logger v4.7.1", "default": false }, { @@ -104,6 +117,9 @@ "Nebula Logger - Core@4.6.16-0-ui-cleanup": "04t5Y0000015lLzQAI", "Nebula Logger - Core@4.7.0-25-spring-'22-release": "04t5Y0000015lXSQAY", "Nebula Logger - Core@4.7.1-8-plugin-framework-overhaul": "04t5Y0000015lgBQAQ", + "Nebula Logger - Core@4.7.2-1-parent-log-transaction-id-bugfix": "04t5Y0000015lhdQAA", + "Nebula Logger - Plugin - Async Failure Additions": "0Ho5Y000000blO4SAI", + "Nebula Logger - Plugin - Async Failure Additions@1.0.0-3": "04t5Y0000015lhiQAA", "Nebula Logger - Plugin - Big Object Archiving": "0Ho5Y000000blMSSAY", "Nebula Logger - Plugin - Big Object Archiving@0.9.0-2": "04t5Y0000015lgLQAQ", "Nebula Logger - Plugin - Log Retention Rules": "0Ho5Y000000blNfSAI",