Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions force-app/main/adapter/in/sobjects/contact/ContactAdapter.cls
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,13 @@ public inherited sharing class ContactAdapter extends fflib_SObjects2 {
Address__c contactAddress = contactAddressesToInsertByContact.get(contact);
contact.Current_Address__c = contactAddress.Id;
}

SfdoInstrumentationService.getInstance().log(
SfdoInstrumentationEnum.Feature.Addresses,
SfdoInstrumentationEnum.Component.TriggerAction,
SfdoInstrumentationEnum.Action.Dml_Insert,
new Map<String, String>{ 'SourceClass' => 'ContactAdapter' },
contactAddressesToInsertByContact.size());
}

private void updateContactAddressFromExistingAddress(Contact contact, Address__c existingAddressFromContact) {
Expand Down
1 change: 1 addition & 0 deletions force-app/main/default/classes/BDI_DataImportService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ global with sharing class BDI_DataImportService {
sfdoInstrumentationEnum.Feature.GiftEntry,
sfdoInstrumentationEnum.Component.Page,
sfdoInstrumentationEnum.Action.Save,
new Map<String, String>{ 'SourceClass' => 'BDI_DataImportService' },
insertedGifts);
}

Expand Down
11 changes: 8 additions & 3 deletions force-app/main/default/classes/BDI_DataImport_TEST.cls
Original file line number Diff line number Diff line change
Expand Up @@ -1949,10 +1949,10 @@ public with sharing class BDI_DataImport_TEST {
ID ApexJobId = Database.executeBatch(bdi, 10);
Test.stopTest();

System.assertEquals(2, mockService.value, 'The instrumentation service should have indicated two new Gifts were inserted');
System.assertEquals(sfdoInstrumentationEnum.Feature.GiftEntry, mockService.feature,
'The instrumentation service should have indicated GiftEntry');
}
System.assertEquals(2, mockService.value, 'The instrumentation service should have indicated two new Gifts were inserted');
}

/*********************************************************************************************************
* @description When the Data Import Service has been mocked to simulate coming in through the UI, verify
Expand All @@ -1963,6 +1963,9 @@ public with sharing class BDI_DataImport_TEST {
private static void shouldNotInstrumentNewDonationsWhenNotThroughUserInterface() {
SfdoInstrumentationMock_TEST.MockService mockService = SfdoInstrumentationMock_TEST.injectMockedInstrumentationService();

// SfdoInstrumentationService.instance = null; // reset instrumentation
// UTIL_UnitTestData_TEST.turnOffAutomaticHHNaming(); // prevent this from running its instrumentation

List<DataImport__c> dataImports = new List<DataImport__c>();
dataImports.add(newDI('c1', 'C1', 100));
insert dataImports;
Expand All @@ -1973,7 +1976,9 @@ public with sharing class BDI_DataImport_TEST {
ID ApexJobId = Database.executeBatch(bdi, 10);
Test.stopTest();

System.assertEquals(null, mockService.value, 'The instrumentation service should have indicated two new Gifts were inserted');
for (SfdoInstrumentationMock_TEST.LastCallData callData : mockService.lastCallStack) {
System.assertNotEquals(SfdoInstrumentationEnum.Feature.DataImportEngine, callData.feature, 'The BDI instrumentation should have executed');
}
}

/*********************************************************************************************************
Expand Down
6 changes: 3 additions & 3 deletions force-app/main/default/classes/Callable_API.cls
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ global with sharing class Callable_API implements System.Callable {
String oppStage = paramService.getString(CallableApiParameters.PARAM_OPPORTUNITY_STAGE);
return OPP_StageMappingUtil.determineOppStateFromOppStage(oppStage);

} when 'crlp.getdefinitionsforrolluptype' {
} when 'crlp.getdefinitionsforrolluptype' { // internal use only, deprecated
String rollupType = paramService.getString(CallableApiParameters.PARAM_ROLLUP_TYPE);

CRLP_ApiService crlpApiSvc = new CRLP_ApiService();
List<CRLP_Rollup> response = crlpApiSvc.getRollupDefinitions(rollupType);

return JSON.serialize(response, true);

} when 'crlp.executerollups' {
} when 'crlp.executerollups' { // internal use only, deprecated
Id parentId = paramService.getString(CallableApiParameters.PARAM_ROLLUP_PARENTID);
String rollupType = paramService.getString(CallableApiParameters.PARAM_ROLLUP_TYPE);
List<CRLP_Rollup> rollupDefs = paramService.getRollupDefinitions(CallableApiParameters.PARAM_ROLLUP_DEFS);
Expand All @@ -120,7 +120,7 @@ global with sharing class Callable_API implements System.Callable {
CRLP_ApiService crlpApiSvc = new CRLP_ApiService();
return crlpApiSvc.isCrlpEnabled();

} when 'err.dispatchaction' {
} when 'err.dispatchaction' { // internal use only
// This method is to be used only by Salesforce.org apps and is subject to change at any time. Do NOT call this method.
// If you do so, your functionality can break without any warning or liability from Salesforce.

Expand Down
1 change: 1 addition & 0 deletions force-app/main/default/classes/ContactMergeService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public class ContactMergeService {
SfdoInstrumentationEnum.Feature.ContactMerge,
SfdoInstrumentationEnum.Component.Page,
SfdoInstrumentationEnum.Action.ContactMergeResultCount,
new Map<String, String>{ 'SourceClass' => 'ContactMergeService' },
losers.size() + 1);

successfulMerge = true;
Expand Down
1 change: 1 addition & 0 deletions force-app/main/default/classes/EP_EngagementPlans_TDTM.cls
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public with sharing class EP_EngagementPlans_TDTM extends TDTM_Runnable {
SfdoInstrumentationEnum.Feature.EngagementPlans,
SfdoInstrumentationEnum.Component.TriggerAction,
SfdoInstrumentationEnum.Action.Create,
new Map<String, String>{ 'SourceClass' => 'EP_EngagementPlans_TDTM' },
engagementPlans.size());
}

Expand Down
6 changes: 5 additions & 1 deletion force-app/main/default/classes/HH_Container_LCTRL.cls
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ public with sharing class HH_Container_LCTRL {
SfdoInstrumentationEnum.Feature.ManageHousehold,
SfdoInstrumentationEnum.Component.Page,
SfdoInstrumentationEnum.Action.HouseholdMemberAdded,
new Map<String, String>{ 'SourceClass' => 'HH_Container_LCTRL' },
listInsert.size());
}
}
Expand Down Expand Up @@ -515,6 +516,7 @@ public with sharing class HH_Container_LCTRL {
SfdoInstrumentationEnum.Feature.ManageHousehold,
SfdoInstrumentationEnum.Component.Page,
SfdoInstrumentationEnum.Action.HouseholdMerged,
new Map<String, String>{ 'SourceClass' => 'HH_Container_LCTRL' },
listHHMerge.size());
}

Expand Down Expand Up @@ -570,7 +572,9 @@ public with sharing class HH_Container_LCTRL {
SfdoInstrumentationService.getInstance().log(
SfdoInstrumentationEnum.Feature.ManageHousehold,
SfdoInstrumentationEnum.Component.Page,
SfdoInstrumentationEnum.Action.HouseholdNamingSettingsUpdated, 1);
SfdoInstrumentationEnum.Action.HouseholdNamingSettingsUpdated,
new Map<String, String>{ 'SourceClass' => 'HH_Container_LCTRL' },
1);
originalHouseholdCustomNameSetting = (String) hh.get('npo02__SYSTEM_CUSTOM_NAMING__c');
}
}
Expand Down
2 changes: 1 addition & 1 deletion force-app/main/default/classes/HH_Container_TEST.cls
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ private class HH_Container_TEST {
Contact[] hhContactsToRemove = new Contact[0];
Account[] accountsToMerge = new Account[] { accounts[1], accounts[2] };

System.assertEquals(null, SfdoInstrumentationService.instance, 'The Instrumentation Service Instance should not have been instantiated yet');
SfdoInstrumentationService.instance = null;

Test.startTest();
accounts[0].npo02__SYSTEM_CUSTOM_NAMING__c = 'npo02__Formal_Greeting__c';
Expand Down
28 changes: 26 additions & 2 deletions force-app/main/default/classes/LVL_LevelAssignBATCH_TEST.cls
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ private class LVL_LevelAssignBATCH_TEST {
private static Level__c lvlPlatinum { get; set; }
private static Level__c lvlAcctZinc { get; set; }

private static final Integer CONTACT_COUNT = 8;
private static final Integer ACCOUNT_COUNT = 2;

/*********************************************************************************************************
* @description creates Bronze, Silver, and Gold Level records for test code to use.
*/
Expand Down Expand Up @@ -161,7 +164,7 @@ private class LVL_LevelAssignBATCH_TEST {
private static DateTime dtCon6Modified { get; set; }

private static void createTestContacts(String uniqueCounter) {
contacts = UTIL_UnitTestData_TEST.createMultipleTestContacts(8);
contacts = UTIL_UnitTestData_TEST.createMultipleTestContacts(CONTACT_COUNT);
for (Contact c : contacts) {
c.LastName += uniqueCounter;
}
Expand Down Expand Up @@ -199,7 +202,7 @@ private class LVL_LevelAssignBATCH_TEST {
*/
private static List<Account> accounts { get; set; }
private static void createTestAccounts(String uniqueCounter) {
accounts = UTIL_UnitTestData_TEST.createMultipleTestAccounts(2, null);
accounts = UTIL_UnitTestData_TEST.createMultipleTestAccounts(ACCOUNT_COUNT, null);
for (Account a : accounts) {
a.Name += uniqueCounter;
}
Expand Down Expand Up @@ -232,6 +235,16 @@ private class LVL_LevelAssignBATCH_TEST {

verifyContactLevels();

System.assertEquals(SfdoInstrumentationEnum.Feature.EngagementPlans.name(), SfdoInstrumentationService.lastCallData.lastFeatureName,
'The Instrumentation LastFeatureName should be EngagementPlans');
System.assertEquals(1, SfdoInstrumentationService.lastCallData.lastValue,
'The Instrumentation LastValue should be 1');
// System.assertEquals(true, new Map<String, String>{ 'SourceClass' => 'LVL_LevelAssign_BATCH', 'Target Object' => 'Contact' }, SfdoInstrumentationService.lastCallData.lastContext,
System.assertEquals('LVL_LevelAssign_BATCH', SfdoInstrumentationService.lastCallData.lastContext.get('SourceClass'),
'The Instrumentation LastContext should be LVL_Batch');
System.assertEquals('Contact', SfdoInstrumentationService.lastCallData.lastContext.get('Target Object'),
'The Instrumentation LastContext should be Contact');

Levels_Settings__c levelSettings = Levels_Settings__c.getInstance();
System.assertEquals(null, levelSettings.LastJobStartTimeAccount__c,
'The LastJobStartTimeAccount__c should not be populated');
Expand Down Expand Up @@ -262,6 +275,17 @@ private class LVL_LevelAssignBATCH_TEST {
Database.executeBatch(batch);
Test.stopTest();

System.assertEquals(SfdoInstrumentationEnum.Feature.Levels.name(), SfdoInstrumentationService.lastCallData.lastFeatureName,
'The Instrumentation LastFeatureName should be Levels');
System.assertEquals(SfdoInstrumentationEnum.Component.Batch.name(), SfdoInstrumentationService.lastCallData.lastComponentName,
'The Instrumentation LastComponentName should be Batch');
System.assertEquals(CONTACT_COUNT-1, SfdoInstrumentationService.lastCallData.lastValue,
'The Instrumentation LastValue should be 7');
System.assertEquals('LVL_LevelAssign_BATCH', SfdoInstrumentationService.lastCallData.lastContext.get('SourceClass'),
'The Instrumentation LastContext should be LVL_Batch');
System.assertEquals('Contact', SfdoInstrumentationService.lastCallData.lastContext.get('Target Object'),
'The Instrumentation LastContext should be Contact');

Contact conZero = [SELECT Id, npo02__LastMembershipLevel__c FROM Contact WHERE Id = :contacts[0].Id];
System.assertEquals(null, conZero.npo02__LastMembershipLevel__c);
}
Expand Down
13 changes: 13 additions & 0 deletions force-app/main/default/classes/LVL_LevelAssign_BATCH.cls
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,22 @@ public without sharing class LVL_LevelAssign_BATCH implements Database.Batchable
} // ladder
} // scope

SfdoInstrumentationService.getInstance().log(
SfdoInstrumentationEnum.Feature.Levels,
SfdoInstrumentationEnum.Component.Batch,
SfdoInstrumentationEnum.Action.Dml_Update,
new Map<String, String>{ 'Target Object' => sObjectName, 'SourceClass' => 'LVL_LevelAssign_BATCH' },
recordsById.size());

update recordsById.values();
if (!newEngagementPlans.isEmpty()) {
insert newEngagementPlans;
SfdoInstrumentationService.getInstance().log(
SfdoInstrumentationEnum.Feature.EngagementPlans,
SfdoInstrumentationEnum.Component.Batch,
SfdoInstrumentationEnum.Action.Dml_Insert,
new Map<String, String>{ 'Target Object' => sObjectName, 'SourceClass' => 'LVL_LevelAssign_BATCH' },
newEngagementPlans.size());
}
if (!errorsCreatingEngagementPlans.isEmpty()) {
insert errorsCreatingEngagementPlans;
Expand Down
3 changes: 3 additions & 0 deletions force-app/main/default/classes/RD2_ApiService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public inherited sharing class RD2_ApiService {
SfdoInstrumentationEnum.Feature.EnhancedRecurringDonations,
SfdoInstrumentationEnum.Component.API,
SfdoInstrumentationEnum.Action.QuerySchedules,
new Map<String, String>{ 'SourceClass' => 'RD2_ApiService' },
schedulesByRdId.size());

return JSON.serialize(schedulesByRdId);
Expand Down Expand Up @@ -223,6 +224,7 @@ public inherited sharing class RD2_ApiService {
SfdoInstrumentationEnum.Feature.EnhancedRecurringDonations,
SfdoInstrumentationEnum.Component.API,
SfdoInstrumentationEnum.Action.QueryInstallments,
new Map<String, String>{ 'SourceClass' => 'RD2_ApiService' },
installmentsByRdId.size());

return JSON.serialize(installmentsByRdId);
Expand Down Expand Up @@ -281,6 +283,7 @@ public inherited sharing class RD2_ApiService {
SfdoInstrumentationEnum.Feature.EnhancedRecurringDonations,
SfdoInstrumentationEnum.Component.API,
SfdoInstrumentationEnum.Action.Pause,
new Map<String, String>{ 'SourceClass' => 'RD2_ApiService' },
Limits.getDmlRows() - startingDmlRows);

return response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ public without sharing class RD2_OpportunityEvaluation_BATCH
new Map<String, Object>{
'RD Records Processed' => recordsProcessed,
'RD Records Failed' => recordsFailed,
'Opportunity Records Created ' => recordsCreated
'Opportunity Records Created ' => recordsCreated,
'SourceClass' => 'RD2_OpportunityEvaluation_BATCH'
},
recordsCreated
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public class RD2_RecurringDonations_TDTM extends TDTM_Runnable {
SfdoInstrumentationEnum.Feature.EnhancedRecurringDonations,
SfdoInstrumentationEnum.Component.TriggerAction,
SfdoInstrumentationEnum.Action.Create,
new Map<String, String>{ 'SourceClass' => 'RD2_RecurringDonations_TDTM' },
rds.size());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public class RD_RecurringDonations_TDTM extends TDTM_Runnable {
SfdoInstrumentationEnum.Feature.LegacyRecurringDonations,
SfdoInstrumentationEnum.Component.TriggerAction,
SfdoInstrumentationEnum.Action.Create,
new Map<String, String>{ 'SourceClass' => 'RD_RecurringDonations_TDTM' },
newlist.size());
}

Expand Down
11 changes: 11 additions & 0 deletions force-app/main/default/classes/STG_PanelRDHealthCheck_TEST.cls
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ private class STG_PanelRDHealthCheck_TEST {
*/
@IsTest
private static void shouldValidateLegacyRecurringDonationsConfig() {
if (isRD2MetadataDeployed()) {
// don't run this if RD2 metadata is already deployed
return;
}

configureLegacyRDSettings();

STG_PanelHealthCheck_CTRL ctrl = new STG_PanelHealthCheck_CTRL();
Expand All @@ -69,6 +74,11 @@ private class STG_PanelRDHealthCheck_TEST {
*/
@IsTest
private static void shouldValidateLegacyWithCustomInstallmentPeriods() {
if (isRD2MetadataDeployed()) {
// don't run this if RD2 metadata is already deployed
return;
}

npe03__Custom_Installment_Settings__c customInstallment = new npe03__Custom_Installment_Settings__c(
npe03__Increment__c = 'Weeks',
npe03__Value__c = 2,
Expand Down Expand Up @@ -146,6 +156,7 @@ private class STG_PanelRDHealthCheck_TEST {
@IsTest
private static void shouldValidateLegacyPeriodPicklistEntries() {
if (isRD2MetadataDeployed()) {
// don't run this if RD2 metadata is already deployed
return;
}

Expand Down
Loading
Loading