From f18e3944b82566a07c5fef628c764a7204533756 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 22 Dec 2022 13:54:59 -0800 Subject: [PATCH 01/27] Issue-437 - Pass selector's SObjectType to QueryFactory. - Supporting test and improvement --- .../main/classes/fflib_SObjectSelector.cls | 4 +- .../classes/fflib_SObjectSelectorTest.cls | 58 +++++++++++++++++++ 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls b/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls index 20a56f7a883..2664f248795 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls @@ -385,7 +385,7 @@ public abstract with sharing class fflib_SObjectSelector } // Automatically select the CurrencyIsoCode for MC orgs (unless the object is a known exception to the rule) if(UserInfo.isMultiCurrencyOrganization() && CURRENCY_ISO_CODE_ENABLED){ - queryFactory.selectField(relationshipFieldPath+'.CurrencyIsoCode'); + queryFactory.selectField(relationshipFieldPath+'.CurrencyIsoCode', getSObjectType()); } } @@ -468,7 +468,7 @@ public abstract with sharing class fflib_SObjectSelector // Automatically select the CurrencyIsoCode for MC orgs (unless the object is a known exception to the rule) if(UserInfo.isMultiCurrencyOrganization() && CURRENCY_ISO_CODE_ENABLED) - queryFactory.selectField('CurrencyIsoCode'); + queryFactory.selectField('CurrencyIsoCode', getSObjectType()); } // Parse the getOrderBy() diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls index c982d9144d4..cebc99ab541 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls @@ -491,6 +491,8 @@ private with sharing class fflib_SObjectSelectorTest }; if (UserInfo.isMultiCurrencyOrganization()) { expectedSelectFields.add('CurrencyIsoCode'); + expectedSelectFields.add('Lead.CurrencyIsoCode'); + expectedSelectFields.add('Lead.Owner.CurrencyIsoCode'); // Because the Selector is for User; Group would not have } //When @@ -505,6 +507,46 @@ private with sharing class fflib_SObjectSelectorTest System.assertEquals(expectedSelectFields, new Set(actualSelectFields)); } + @isTest + static void testPolymorphicSelectWithRelatedTypeWherePolymorphicNotImpactedByMulticurrency() { + //Given + + Testfflib_CampaignMemberSelector cmSelector = new Testfflib_CampaignMemberSelector(); + fflib_QueryFactory qf = cmSelector.newQueryFactory(); + new Testfflib_LeadSelector().configureQueryFactoryFields(qf, 'Lead'); + new Testfflib_GroupSelector().configureQueryFactoryFields(qf, 'Lead.Owner'); + + + Set expectedSelectFields = new Set{ + 'Id', 'Status', 'Lead.Id', 'Lead.OwnerId', 'Lead.Owner.Id' + }; + Set unexpectedSelectFields = new Set(); + if (UserInfo.isMultiCurrencyOrganization()) { + expectedSelectFields.add('CurrencyIsoCode'); + expectedSelectFields.add('Lead.CurrencyIsoCode'); + + unexpectedSelectFields.add('Lead.Owner.CurrencyIsoCode'); // Because Group does NOT have CurrencyIsoCode + } + + //When + String soql = qf.toSOQL(); + + //Then + Pattern soqlPattern = Pattern.compile('SELECT (.*) FROM CampaignMember ORDER BY CreatedDate ASC NULLS FIRST '); + Matcher soqlMatcher = soqlPattern.matcher(soql); + soqlMatcher.matches(); + + List actualSelectFields = soqlMatcher.group(1).deleteWhiteSpace().split(','); + Set actualSelectFieldsSet = new Set(actualSelectFields); + Assert.areEqual(expectedSelectFields, actualSelectFieldsSet); + if (unexpectedSelectFields.size() > 0) { + Assert.isFalse( + actualSelectFieldsSet.containsAll(unexpectedSelectFields), + String.format('The fields {0} were not expected on actualSelectFieldsSet {1}', new List>{unexpectedSelectFields, actualSelectFieldsSet}) + ); + } + } + private class Testfflib_CampaignMemberSelector extends fflib_SObjectSelector { public Testfflib_CampaignMemberSelector() { super(); @@ -539,6 +581,22 @@ private with sharing class fflib_SObjectSelectorTest } } + private class Testfflib_GroupSelector extends fflib_SObjectSelector { + public Testfflib_GroupSelector() { + super(); + } + + public List getSObjectFieldList() { + return new List{ + Group.Id + }; + } + + public Schema.SObjectType getSObjectType() { + return Group.sObjectType; + } + } + private class Testfflib_LeadSelector extends fflib_SObjectSelector { public Testfflib_LeadSelector() { super(); From 3e1e199a96eb1007471d6a97b0fbd1bc04136c96 Mon Sep 17 00:00:00 2001 From: John Storey Date: Tue, 31 Jan 2023 11:55:15 -0800 Subject: [PATCH 02/27] Merging UserMode feature into branch and fix tests accordingly --- .../classes/fflib_SObjectSelectorTest.cls | 60 ++++++++++++++++--- 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls index 66e608db39b..8841ca44cdd 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls @@ -443,7 +443,7 @@ private with sharing class fflib_SObjectSelectorTest String soql = sel.createSelectAllWithAccountSOQL(); - String expected = 'SELECT name, id, amount, closedate, account\\.name, account\\.billingpostalcode(.*)FROM Opportunity WITH SYSTEM_MODE ORDER BY Name ASC NULLS FIRST '; + String expected = 'SELECT name, id, amount, closedate, (currencyisocode, )?account\\.name, account\\.billingpostalcode(.*)FROM Opportunity WITH SYSTEM_MODE ORDER BY Name ASC NULLS FIRST '; Pattern soqlPattern = Pattern.compile(expected); Matcher soqlMatcher = soqlPattern.matcher(soql); System.assert(soqlMatcher.matches(),'Expected: ' + expected + ' Actual:' + soql); @@ -455,7 +455,7 @@ private with sharing class fflib_SObjectSelectorTest String soql = sel.createSelectAccountWithOpportunitiesSOQL(); - String expected = 'SELECT name, id, annualrevenue, accountnumber,(.*)\\(SELECT name, id, amount, closedate FROM Opportunities ORDER BY Name ASC NULLS FIRST \\) FROM Account WITH SYSTEM_MODE ORDER BY Name ASC NULLS FIRST '; + String expected = 'SELECT name, id, annualrevenue, accountnumber,(.*)\\(SELECT name, id, amount, closedate(.*)FROM Opportunities ORDER BY Name ASC NULLS FIRST \\) FROM Account WITH SYSTEM_MODE ORDER BY Name ASC NULLS FIRST '; Pattern soqlPattern = Pattern.compile(expected); Matcher soqlMatcher = soqlPattern.matcher(soql); System.assert(soqlMatcher.matches(),'Expected: ' + expected + ' Actual:' + soql); @@ -683,19 +683,64 @@ private with sharing class fflib_SObjectSelectorTest } @isTest - static void toSOQL_When_SystemModePolymorphicSelect_Expect_RelatedType() { - CampaignMemberSelector cmSelector = new CampaignMemberSelector(fflib_SObjectSelector.DataAccess.SYSTEM_MODE); + static void toSOQL_When_PolymorphicSelectInMulticurrency_Expect_RelatedType() { + //Given + + CampaignMemberSelector cmSelector = new CampaignMemberSelector(fflib_SObjectSelector.DataAccess.LEGACY); fflib_QueryFactory qf = cmSelector.newQueryFactory(); new Testfflib_LeadSelector().configureQueryFactoryFields(qf, 'Lead'); - new Testfflib_UserSelector().configureQueryFactoryFields(qf, 'Lead.Owner'); + new Testfflib_GroupSelector().configureQueryFactoryFields(qf, 'Lead.Owner'); - List expectedSelectFields = new List{ - 'id', 'status', 'lead.ownerid', 'lead.id', 'lead.owner.userroleid', 'lead.owner.id' + + Set expectedSelectFields = new Set{ + 'Id', 'Status', 'Lead.Id', 'Lead.OwnerId', 'Lead.Owner.Id' }; + Set unexpectedSelectFields = new Set(); if (UserInfo.isMultiCurrencyOrganization()) { expectedSelectFields.add('CurrencyIsoCode'); + expectedSelectFields.add('Lead.CurrencyIsoCode'); + + unexpectedSelectFields.add('Lead.Owner.CurrencyIsoCode'); // Because Group does NOT have CurrencyIsoCode } + //When + String soql = qf.toSOQL(); + System.debug(soql); + + //Then + Pattern soqlPattern = Pattern.compile('SELECT (.*) FROM CampaignMember ORDER BY CreatedDate ASC NULLS FIRST '); + Matcher soqlMatcher = soqlPattern.matcher(soql); + soqlMatcher.matches(); + + List actualSelectFields = soqlMatcher.group(1).deleteWhiteSpace().split(','); + Set actualSelectFieldsSet = new Set(actualSelectFields); + Assert.areEqual(expectedSelectFields, actualSelectFieldsSet); + if (unexpectedSelectFields.size() > 0) { + Assert.isFalse( + actualSelectFieldsSet.containsAll(unexpectedSelectFields), + String.format('The fields {0} were not expected on actualSelectFieldsSet {1}', new List>{unexpectedSelectFields, actualSelectFieldsSet}) + ); + } + } + + @isTest + static void toSOQL_When_SystemModePolymorphicSelect_Expect_RelatedType() { + CampaignMemberSelector cmSelector = new CampaignMemberSelector(fflib_SObjectSelector.DataAccess.SYSTEM_MODE); + fflib_QueryFactory qf = cmSelector.newQueryFactory(); + new Testfflib_LeadSelector().configureQueryFactoryFields(qf, 'Lead'); + new Testfflib_UserSelector().configureQueryFactoryFields(qf, 'Lead.Owner'); + + List expectedSelectFields = new List(); + expectedSelectFields.add('id'); + expectedSelectFields.add('status'); + if (UserInfo.isMultiCurrencyOrganization()) expectedSelectFields.add('currencyisocode'); + expectedSelectFields.add('lead.ownerid'); + expectedSelectFields.add('lead.id'); + if (UserInfo.isMultiCurrencyOrganization()) expectedSelectFields.add('lead.currencyisocode'); + expectedSelectFields.add('lead.owner.userroleid'); + expectedSelectFields.add('lead.owner.id'); + if (UserInfo.isMultiCurrencyOrganization()) expectedSelectFields.add('lead.owner.currencyisocode'); + String expectedSOQL = 'SELECT ' + String.join(expectedSelectFields,', ') + ' FROM CampaignMember WITH SYSTEM_MODE ORDER BY CreatedDate ASC NULLS FIRST '; //When @@ -705,7 +750,6 @@ private with sharing class fflib_SObjectSelectorTest System.assertEquals(expectedSOQL, actualSOQL); } - private class CampaignMemberSelector extends fflib_SObjectSelector { public CampaignMemberSelector(DataAccess access) { super(false, access); From 1c3b7623050e608e5f65b46ea4d516a4ae9fda26 Mon Sep 17 00:00:00 2001 From: Clay Chipps Date: Mon, 3 Apr 2023 15:14:21 -0400 Subject: [PATCH 03/27] chore: bump to api 57.0 --- sfdx-project.json | 2 +- .../apex-common/main/classes/fflib_Application.cls-meta.xml | 2 +- sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml | 2 +- .../main/classes/fflib_IDomainConstructor.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_IObjects.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml | 2 +- .../main/classes/fflib_ISObjectSelector.cls-meta.xml | 2 +- .../main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_ISObjects.cls-meta.xml | 2 +- sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_QueryFactory.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml | 2 +- .../main/classes/fflib_SObjectUnitOfWork.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SObjects.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_StringBuilder.cls-meta.xml | 2 +- .../apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml | 2 +- .../apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml | 2 +- .../test/classes/fflib_QueryFactoryTest.cls-meta.xml | 2 +- .../test/classes/fflib_SObjectDescribeTest.cls-meta.xml | 2 +- .../test/classes/fflib_SObjectDomainTest.cls-meta.xml | 2 +- .../test/classes/fflib_SObjectSelectorTest.cls-meta.xml | 2 +- .../test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml | 2 +- .../apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml | 2 +- .../test/classes/fflib_SecurityUtilsTest.cls-meta.xml | 2 +- .../test/classes/fflib_StringBuilderTest.cls-meta.xml | 2 +- .../test/classes/mocks/fflib_SObjectMocks.cls-meta.xml | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/sfdx-project.json b/sfdx-project.json index fc789c2d464..88c7589efa9 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -7,5 +7,5 @@ ], "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", - "sourceApiVersion": "55.0" + "sourceApiVersion": "57.0" } \ No newline at end of file diff --git a/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml index 3b90cb4bda0..cac127cd1a1 100644 --- a/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml @@ -1,4 +1,4 @@ - 55.0 + 57.0 diff --git a/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active diff --git a/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml b/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml index 4b0bc9f3879..754ecb15544 100644 --- a/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml @@ -1,5 +1,5 @@ - 55.0 + 57.0 Active From 214cb7a7547ae199270254e3162d989fea6517de Mon Sep 17 00:00:00 2001 From: Clay Chipps Date: Mon, 17 Apr 2023 10:09:26 -0400 Subject: [PATCH 04/27] chore: bump 51.0 to 57.0 --- .../apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml | 2 +- .../main/classes/fflib_ISelectorFactory.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml | 2 +- .../main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml index d75b0582fba..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml index d75b0582fba..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml index d75b0582fba..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 57.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml index d75b0582fba..754ecb15544 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 51.0 + 57.0 Active From fb9e5b8bf8305522917a1da445d33412f585075c Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 6 May 2023 19:49:28 +1000 Subject: [PATCH 05/27] Allow for either Name or CreatedDate as order by. Harcoded Order by name fails with encrypted name. --- .../apex-common/test/classes/fflib_SObjectSelectorTest.cls | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls index 11c464b2c9e..d999ff74384 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls @@ -167,7 +167,7 @@ private with sharing class fflib_SObjectSelectorTest { Testfflib_SObjectSelectorDefaultSorting selector = new Testfflib_SObjectSelectorDefaultSorting(false); String soql = selector.newQueryFactory().toSOQL(); - Pattern p = Pattern.compile('SELECT (.*) FROM Account ORDER BY Name ASC NULLS FIRST '); + Pattern p = Pattern.compile('SELECT (.*) FROM Account ORDER BY (?:Name|CreatedDate) ASC NULLS FIRST '); Matcher m = p.matcher(soql); System.assert(m.matches(), 'Generated SOQL does not match expected pattern. Here is the generated SOQL: ' + soql); System.assertEquals(1, m.groupCount(), 'Unexpected number of groups captured.'); @@ -455,7 +455,7 @@ private with sharing class fflib_SObjectSelectorTest String soql = sel.createSelectAccountWithOpportunitiesSOQL(); - String expected = 'SELECT name, id, annualrevenue, accountnumber,(.*)\\(SELECT name, id, amount, closedate FROM Opportunities ORDER BY Name ASC NULLS FIRST \\) FROM Account WITH SYSTEM_MODE ORDER BY Name ASC NULLS FIRST '; + String expected = 'SELECT name, id, annualrevenue, accountnumber,(.*)\\(SELECT name, id, amount, closedate FROM Opportunities ORDER BY Name ASC NULLS FIRST \\) FROM Account WITH SYSTEM_MODE ORDER BY (?:Name|CreatedDate) ASC NULLS FIRST '; Pattern soqlPattern = Pattern.compile(expected); Matcher soqlMatcher = soqlPattern.matcher(soql); System.assert(soqlMatcher.matches(),'Expected: ' + expected + ' Actual:' + soql); From be30693f16d6fce1772c83cd2c697ff41625e66d Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 7 May 2023 16:55:29 +1000 Subject: [PATCH 06/27] Verify correct sort field --- .../test/classes/fflib_SObjectSelectorTest.cls | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls index d999ff74384..23318415cb6 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls @@ -27,6 +27,10 @@ @IsTest private with sharing class fflib_SObjectSelectorTest { + //Get the correct sort field depending on sortable status of Name field + static String getDefaultSortField(DescribeSObjectResult sobjDesc) { + return sobjDesc.fields.getMap().get('name').getDescribe().isSortable() ? 'Name' : 'CreatedDate'; + } @TestSetup static void testSetup(){ fflib_SecurityUtilsTest.testSetup(); @@ -167,7 +171,8 @@ private with sharing class fflib_SObjectSelectorTest { Testfflib_SObjectSelectorDefaultSorting selector = new Testfflib_SObjectSelectorDefaultSorting(false); String soql = selector.newQueryFactory().toSOQL(); - Pattern p = Pattern.compile('SELECT (.*) FROM Account ORDER BY (?:Name|CreatedDate) ASC NULLS FIRST '); + Pattern p = Pattern.compile(String.format('SELECT (.*) FROM Account ORDER BY {0} ASC NULLS FIRST ', + new List{getDefaultSortField(SObjectType.Account)})); Matcher m = p.matcher(soql); System.assert(m.matches(), 'Generated SOQL does not match expected pattern. Here is the generated SOQL: ' + soql); System.assertEquals(1, m.groupCount(), 'Unexpected number of groups captured.'); @@ -443,7 +448,8 @@ private with sharing class fflib_SObjectSelectorTest String soql = sel.createSelectAllWithAccountSOQL(); - String expected = 'SELECT name, id, amount, closedate, account\\.name, account\\.billingpostalcode(.*)FROM Opportunity WITH SYSTEM_MODE ORDER BY Name ASC NULLS FIRST '; + String expected = String.format('SELECT name, id, amount, closedate, account\\.name, account\\.billingpostalcode(.*)FROM Opportunity WITH SYSTEM_MODE ORDER BY {0} ASC NULLS FIRST ', + new List{getDefaultSortField(SObjectType.Opportunity)}); Pattern soqlPattern = Pattern.compile(expected); Matcher soqlMatcher = soqlPattern.matcher(soql); System.assert(soqlMatcher.matches(),'Expected: ' + expected + ' Actual:' + soql); @@ -455,7 +461,8 @@ private with sharing class fflib_SObjectSelectorTest String soql = sel.createSelectAccountWithOpportunitiesSOQL(); - String expected = 'SELECT name, id, annualrevenue, accountnumber,(.*)\\(SELECT name, id, amount, closedate FROM Opportunities ORDER BY Name ASC NULLS FIRST \\) FROM Account WITH SYSTEM_MODE ORDER BY (?:Name|CreatedDate) ASC NULLS FIRST '; + String expected = String.format('SELECT name, id, annualrevenue, accountnumber,(.*)\\(SELECT name, id, amount, closedate FROM Opportunities ORDER BY {0} ASC NULLS FIRST \\) FROM Account WITH SYSTEM_MODE ORDER BY {1} ASC NULLS FIRST ', + new List{getDefaultSortField(SObjectType.Opportunity),getDefaultSortField(SObjectType.Account)}); Pattern soqlPattern = Pattern.compile(expected); Matcher soqlMatcher = soqlPattern.matcher(soql); System.assert(soqlMatcher.matches(),'Expected: ' + expected + ' Actual:' + soql); From 39452502c26d5aaf5ba47579246e27f32ee268f5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 8 May 2023 23:23:17 +1000 Subject: [PATCH 07/27] Resolves additional test issues due to encryption --- .../classes/fflib_SObjectSelectorTest.cls | 81 ++++++++++++++----- 1 file changed, 61 insertions(+), 20 deletions(-) diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls index 23318415cb6..bc892e3dfb2 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls @@ -44,12 +44,23 @@ private with sharing class fflib_SObjectSelectorTest } static testMethod void testSelectSObjectsById() - { - // Inserting in reverse order so that we can test the order by of select + { List accountList = new List { - new Account(Name='TestAccount2',AccountNumber='A2',AnnualRevenue=12345.67), - new Account(Name='TestAccount1',AccountNumber='A1',AnnualRevenue=76543.21) }; - insert accountList; + new Account(Name='TestAccount1',AccountNumber='A2',AnnualRevenue=null), + new Account(Name='TestAccount2',AccountNumber='A1',AnnualRevenue=76543.21), + new Account(Name='TestAccount3',AccountNumber='A3',AnnualRevenue=76543.21), + new Account(Name='TestAccount4',AccountNumber='A4',AnnualRevenue=12345.21) }; + insert accountList; + + final DateTime TODAYS_DATE = System.now(); + final DateTime YESTERDAYS_DATE = System.now().addDays(-1); + + //Set dates to allow sorting by created date as well as annualrevenue NULLS LAST + Test.setCreatedDate(accountList[0].Id,TODAYS_DATE); + Test.setCreatedDate(accountList[1].Id,TODAYS_DATE); + Test.setCreatedDate(accountList[2].Id,YESTERDAYS_DATE); + Test.setCreatedDate(accountList[3].Id,YESTERDAYS_DATE); + Set idSet = new Set(); for(Account item : accountList) idSet.add(item.Id); @@ -59,22 +70,40 @@ private with sharing class fflib_SObjectSelectorTest List result = (List) selector.selectSObjectsById(idSet); Test.stopTest(); - system.assertEquals(2,result.size()); + system.assertEquals(4,result.size()); system.assertEquals('TestAccount2',result[0].Name); - system.assertEquals('A2',result[0].AccountNumber); - system.assertEquals(12345.67,result[0].AnnualRevenue); + system.assertEquals('A1',result[0].AccountNumber); + system.assertEquals(76543.21,result[0].AnnualRevenue); system.assertEquals('TestAccount1',result[1].Name); - system.assertEquals('A1',result[1].AccountNumber); - system.assertEquals(76543.21,result[1].AnnualRevenue); + system.assertEquals('A2',result[1].AccountNumber); + system.assertEquals(null,result[1].AnnualRevenue); + system.assertEquals('TestAccount4',result[2].Name); + system.assertEquals('A4',result[2].AccountNumber); + system.assertEquals(12345.21,result[2].AnnualRevenue); + system.assertEquals('TestAccount3',result[3].Name); + system.assertEquals('A3',result[3].AccountNumber); + system.assertEquals(76543.21,result[3].AnnualRevenue); + } static testMethod void testQueryLocatorById() { - // Inserting in reverse order so that we can test the order by of select List accountList = new List { - new Account(Name='TestAccount2',AccountNumber='A2',AnnualRevenue=12345.67), - new Account(Name='TestAccount1',AccountNumber='A1',AnnualRevenue=76543.21) }; + new Account(Name='TestAccount1',AccountNumber='A2',AnnualRevenue=null), + new Account(Name='TestAccount2',AccountNumber='A1',AnnualRevenue=76543.21), + new Account(Name='TestAccount3',AccountNumber='A3',AnnualRevenue=76543.21), + new Account(Name='TestAccount4',AccountNumber='A4',AnnualRevenue=12345.21) }; insert accountList; + + final DateTime TODAYS_DATE = System.now(); + final DateTime YESTERDAYS_DATE = System.now().addDays(-1); + + //Set dates to allow sorting by created date as well as annualrevenue NULLS LAST + Test.setCreatedDate(accountList[0].Id,TODAYS_DATE); + Test.setCreatedDate(accountList[1].Id,TODAYS_DATE); + Test.setCreatedDate(accountList[2].Id,YESTERDAYS_DATE); + Test.setCreatedDate(accountList[3].Id,YESTERDAYS_DATE); + Set idSet = new Set(); for(Account item : accountList) idSet.add(item.Id); @@ -88,14 +117,26 @@ private with sharing class fflib_SObjectSelectorTest System.assert(true, iteratorResult.hasNext()); Account account = (Account) iteratorResult.next(); system.assertEquals('TestAccount2',account.Name); + system.assertEquals('A1',account.AccountNumber); + system.assertEquals(76543.21,account.AnnualRevenue); + System.assertEquals(true, iteratorResult.hasNext()); + account = (Account) iteratorResult.next(); + system.assertEquals('TestAccount1',account.Name); system.assertEquals('A2',account.AccountNumber); - system.assertEquals(12345.67,account.AnnualRevenue); + system.assertEquals(null,account.AnnualRevenue); + System.assertEquals(true, iteratorResult.hasNext()); + account = (Account) iteratorResult.next(); + system.assertEquals('TestAccount4',account.Name); + system.assertEquals('A4',account.AccountNumber); + system.assertEquals(12345.21,account.AnnualRevenue); System.assert(true, iteratorResult.hasNext()); account = (Account) iteratorResult.next(); - system.assertEquals('TestAccount1',account.Name); - system.assertEquals('A1',account.AccountNumber); + system.assertEquals('TestAccount3',account.Name); + system.assertEquals('A3',account.AccountNumber); system.assertEquals(76543.21,account.AnnualRevenue); System.assertEquals(false, iteratorResult.hasNext()); + + } static testMethod void testAssertIsAccessible() @@ -159,7 +200,7 @@ private with sharing class fflib_SObjectSelectorTest { Testfflib_SObjectSelector selector = new Testfflib_SObjectSelector(); String soql = selector.newQueryFactory().toSOQL(); - Pattern p = Pattern.compile('SELECT (.*) FROM Account ORDER BY Name DESC NULLS FIRST , AnnualRevenue ASC NULLS LAST '); + Pattern p = Pattern.compile('SELECT (.*) FROM Account ORDER BY CreatedDate DESC NULLS FIRST , AnnualRevenue ASC NULLS LAST '); Matcher m = p.matcher(soql); System.assert(m.matches(), 'Generated SOQL does not match expected pattern. Here is the generated SOQL: ' + soql); System.assertEquals(1, m.groupCount(), 'Unexpected number of groups captured.'); @@ -230,7 +271,7 @@ private with sharing class fflib_SObjectSelectorTest String soql = qf.toSOQL(); //Then - Pattern soqlPattern = Pattern.compile('SELECT (.*) FROM Account ORDER BY Name DESC NULLS FIRST , AnnualRevenue ASC NULLS LAST '); + Pattern soqlPattern = Pattern.compile('SELECT (.*) FROM Account ORDER BY CreatedDate DESC NULLS FIRST , AnnualRevenue ASC NULLS LAST '); Matcher soqlMatcher = soqlPattern.matcher(soql); soqlMatcher.matches(); @@ -257,7 +298,7 @@ private with sharing class fflib_SObjectSelectorTest String soql = qf.toSOQL(); // Assert that the - Pattern soqlPattern = Pattern.compile('SELECT (.*) FROM Account ORDER BY Name DESC NULLS FIRST , AnnualRevenue ASC NULLS LAST '); + Pattern soqlPattern = Pattern.compile('SELECT (.*) FROM Account ORDER BY CreatedDate DESC NULLS FIRST , AnnualRevenue ASC NULLS LAST '); Matcher soqlMatcher = soqlPattern.matcher(soql); system.assert(soqlMatcher.matches(), 'The SOQL should have that expected.'); } @@ -498,7 +539,7 @@ private with sharing class fflib_SObjectSelectorTest public override String getOrderBy() { - return 'Name DESC, AnnualRevenue ASC NULLS LAST'; + return 'CreatedDate DESC, AnnualRevenue ASC NULLS LAST'; } } From 7736d00485dcb55a0b8accfdc425be80dbe6b475 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 9 May 2023 19:22:58 +1000 Subject: [PATCH 08/27] Reduce test changes. Use AccountNumber in place of CreatedDate --- .../classes/fflib_SObjectSelectorTest.cls | 83 +++++-------------- 1 file changed, 21 insertions(+), 62 deletions(-) diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls index bc892e3dfb2..606d1c0d3df 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls @@ -44,23 +44,12 @@ private with sharing class fflib_SObjectSelectorTest } static testMethod void testSelectSObjectsById() - { + { + // Inserting in reverse order so that we can test the order by of select List accountList = new List { - new Account(Name='TestAccount1',AccountNumber='A2',AnnualRevenue=null), - new Account(Name='TestAccount2',AccountNumber='A1',AnnualRevenue=76543.21), - new Account(Name='TestAccount3',AccountNumber='A3',AnnualRevenue=76543.21), - new Account(Name='TestAccount4',AccountNumber='A4',AnnualRevenue=12345.21) }; - insert accountList; - - final DateTime TODAYS_DATE = System.now(); - final DateTime YESTERDAYS_DATE = System.now().addDays(-1); - - //Set dates to allow sorting by created date as well as annualrevenue NULLS LAST - Test.setCreatedDate(accountList[0].Id,TODAYS_DATE); - Test.setCreatedDate(accountList[1].Id,TODAYS_DATE); - Test.setCreatedDate(accountList[2].Id,YESTERDAYS_DATE); - Test.setCreatedDate(accountList[3].Id,YESTERDAYS_DATE); - + new Account(Name='TestAccount2',AccountNumber='A2',AnnualRevenue=12345.67), + new Account(Name='TestAccount1',AccountNumber='A1',AnnualRevenue=76543.21) }; + insert accountList; Set idSet = new Set(); for(Account item : accountList) idSet.add(item.Id); @@ -70,40 +59,22 @@ private with sharing class fflib_SObjectSelectorTest List result = (List) selector.selectSObjectsById(idSet); Test.stopTest(); - system.assertEquals(4,result.size()); + system.assertEquals(2,result.size()); system.assertEquals('TestAccount2',result[0].Name); - system.assertEquals('A1',result[0].AccountNumber); - system.assertEquals(76543.21,result[0].AnnualRevenue); + system.assertEquals('A2',result[0].AccountNumber); + system.assertEquals(12345.67,result[0].AnnualRevenue); system.assertEquals('TestAccount1',result[1].Name); - system.assertEquals('A2',result[1].AccountNumber); - system.assertEquals(null,result[1].AnnualRevenue); - system.assertEquals('TestAccount4',result[2].Name); - system.assertEquals('A4',result[2].AccountNumber); - system.assertEquals(12345.21,result[2].AnnualRevenue); - system.assertEquals('TestAccount3',result[3].Name); - system.assertEquals('A3',result[3].AccountNumber); - system.assertEquals(76543.21,result[3].AnnualRevenue); - + system.assertEquals('A1',result[1].AccountNumber); + system.assertEquals(76543.21,result[1].AnnualRevenue); } static testMethod void testQueryLocatorById() { + // Inserting in reverse order so that we can test the order by of select List accountList = new List { - new Account(Name='TestAccount1',AccountNumber='A2',AnnualRevenue=null), - new Account(Name='TestAccount2',AccountNumber='A1',AnnualRevenue=76543.21), - new Account(Name='TestAccount3',AccountNumber='A3',AnnualRevenue=76543.21), - new Account(Name='TestAccount4',AccountNumber='A4',AnnualRevenue=12345.21) }; + new Account(Name='TestAccount2',AccountNumber='A2',AnnualRevenue=12345.67), + new Account(Name='TestAccount1',AccountNumber='A1',AnnualRevenue=76543.21) }; insert accountList; - - final DateTime TODAYS_DATE = System.now(); - final DateTime YESTERDAYS_DATE = System.now().addDays(-1); - - //Set dates to allow sorting by created date as well as annualrevenue NULLS LAST - Test.setCreatedDate(accountList[0].Id,TODAYS_DATE); - Test.setCreatedDate(accountList[1].Id,TODAYS_DATE); - Test.setCreatedDate(accountList[2].Id,YESTERDAYS_DATE); - Test.setCreatedDate(accountList[3].Id,YESTERDAYS_DATE); - Set idSet = new Set(); for(Account item : accountList) idSet.add(item.Id); @@ -113,30 +84,18 @@ private with sharing class fflib_SObjectSelectorTest Database.QueryLocator result = selector.queryLocatorById(idSet); System.Iterator iteratorResult = result.iterator(); Test.stopTest(); - + System.assert(true, iteratorResult.hasNext()); Account account = (Account) iteratorResult.next(); system.assertEquals('TestAccount2',account.Name); - system.assertEquals('A1',account.AccountNumber); - system.assertEquals(76543.21,account.AnnualRevenue); - System.assertEquals(true, iteratorResult.hasNext()); - account = (Account) iteratorResult.next(); - system.assertEquals('TestAccount1',account.Name); system.assertEquals('A2',account.AccountNumber); - system.assertEquals(null,account.AnnualRevenue); - System.assertEquals(true, iteratorResult.hasNext()); - account = (Account) iteratorResult.next(); - system.assertEquals('TestAccount4',account.Name); - system.assertEquals('A4',account.AccountNumber); - system.assertEquals(12345.21,account.AnnualRevenue); + system.assertEquals(12345.67,account.AnnualRevenue); System.assert(true, iteratorResult.hasNext()); account = (Account) iteratorResult.next(); - system.assertEquals('TestAccount3',account.Name); - system.assertEquals('A3',account.AccountNumber); + system.assertEquals('TestAccount1',account.Name); + system.assertEquals('A1',account.AccountNumber); system.assertEquals(76543.21,account.AnnualRevenue); System.assertEquals(false, iteratorResult.hasNext()); - - } static testMethod void testAssertIsAccessible() @@ -200,7 +159,7 @@ private with sharing class fflib_SObjectSelectorTest { Testfflib_SObjectSelector selector = new Testfflib_SObjectSelector(); String soql = selector.newQueryFactory().toSOQL(); - Pattern p = Pattern.compile('SELECT (.*) FROM Account ORDER BY CreatedDate DESC NULLS FIRST , AnnualRevenue ASC NULLS LAST '); + Pattern p = Pattern.compile('SELECT (.*) FROM Account ORDER BY AccountNumber DESC NULLS FIRST , AnnualRevenue ASC NULLS LAST '); Matcher m = p.matcher(soql); System.assert(m.matches(), 'Generated SOQL does not match expected pattern. Here is the generated SOQL: ' + soql); System.assertEquals(1, m.groupCount(), 'Unexpected number of groups captured.'); @@ -271,7 +230,7 @@ private with sharing class fflib_SObjectSelectorTest String soql = qf.toSOQL(); //Then - Pattern soqlPattern = Pattern.compile('SELECT (.*) FROM Account ORDER BY CreatedDate DESC NULLS FIRST , AnnualRevenue ASC NULLS LAST '); + Pattern soqlPattern = Pattern.compile('SELECT (.*) FROM Account ORDER BY AccountNumber DESC NULLS FIRST , AnnualRevenue ASC NULLS LAST '); Matcher soqlMatcher = soqlPattern.matcher(soql); soqlMatcher.matches(); @@ -298,7 +257,7 @@ private with sharing class fflib_SObjectSelectorTest String soql = qf.toSOQL(); // Assert that the - Pattern soqlPattern = Pattern.compile('SELECT (.*) FROM Account ORDER BY CreatedDate DESC NULLS FIRST , AnnualRevenue ASC NULLS LAST '); + Pattern soqlPattern = Pattern.compile('SELECT (.*) FROM Account ORDER BY AccountNumber DESC NULLS FIRST , AnnualRevenue ASC NULLS LAST '); Matcher soqlMatcher = soqlPattern.matcher(soql); system.assert(soqlMatcher.matches(), 'The SOQL should have that expected.'); } @@ -539,7 +498,7 @@ private with sharing class fflib_SObjectSelectorTest public override String getOrderBy() { - return 'CreatedDate DESC, AnnualRevenue ASC NULLS LAST'; + return 'AccountNumber DESC, AnnualRevenue ASC NULLS LAST'; } } From e17b6c4fdd941ebeb4a0c60c97c6e2eaf073bce7 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 13 May 2023 20:58:33 +1000 Subject: [PATCH 09/27] Updates tests to rely on selector getOrderBy() --- .../classes/fflib_SObjectSelectorTest.cls | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls index 606d1c0d3df..92bfcfac36a 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls @@ -27,10 +27,6 @@ @IsTest private with sharing class fflib_SObjectSelectorTest { - //Get the correct sort field depending on sortable status of Name field - static String getDefaultSortField(DescribeSObjectResult sobjDesc) { - return sobjDesc.fields.getMap().get('name').getDescribe().isSortable() ? 'Name' : 'CreatedDate'; - } @TestSetup static void testSetup(){ fflib_SecurityUtilsTest.testSetup(); @@ -172,7 +168,7 @@ private with sharing class fflib_SObjectSelectorTest Testfflib_SObjectSelectorDefaultSorting selector = new Testfflib_SObjectSelectorDefaultSorting(false); String soql = selector.newQueryFactory().toSOQL(); Pattern p = Pattern.compile(String.format('SELECT (.*) FROM Account ORDER BY {0} ASC NULLS FIRST ', - new List{getDefaultSortField(SObjectType.Account)})); + new List{selector.getOrderBy()})); Matcher m = p.matcher(soql); System.assert(m.matches(), 'Generated SOQL does not match expected pattern. Here is the generated SOQL: ' + soql); System.assertEquals(1, m.groupCount(), 'Unexpected number of groups captured.'); @@ -304,7 +300,7 @@ private with sharing class fflib_SObjectSelectorTest //Then String soql = qf.toSOQL(); - Pattern soqlPattern = Pattern.compile('SELECT Id, \\(SELECT (.*) FROM Users ORDER BY Name ASC NULLS FIRST \\) +FROM Account'); + Pattern soqlPattern = Pattern.compile(String.format('SELECT Id, \\(SELECT (.*) FROM Users ORDER BY {0} ASC NULLS FIRST \\) +FROM Account',new List{selector.getOrderBy()})); Matcher soqlMatcher = soqlPattern.matcher(soql); System.assert(soqlMatcher.matches(), 'Generated SOQL does not match expected pattern. Here is the generated SOQL: ' + soql); @@ -329,7 +325,8 @@ private with sharing class fflib_SObjectSelectorTest //Then String soql = qf.toSOQL(); - Pattern soqlPattern = Pattern.compile('SELECT Id, \\(SELECT (.*) FROM Users ORDER BY Name ASC NULLS FIRST \\) +FROM Account'); + Pattern soqlPattern = Pattern.compile(String.format('SELECT Id, \\(SELECT (.*) FROM Users ORDER BY {0} ASC NULLS FIRST \\) +FROM Account', + new List{selector.getOrderBy()})); Matcher soqlMatcher = soqlPattern.matcher(soql); System.assert(soqlMatcher.matches(), 'Generated SOQL does not match expected pattern. Here is the generated SOQL: ' + soql); @@ -449,7 +446,7 @@ private with sharing class fflib_SObjectSelectorTest String soql = sel.createSelectAllWithAccountSOQL(); String expected = String.format('SELECT name, id, amount, closedate, account\\.name, account\\.billingpostalcode(.*)FROM Opportunity WITH SYSTEM_MODE ORDER BY {0} ASC NULLS FIRST ', - new List{getDefaultSortField(SObjectType.Opportunity)}); + new List{sel.getOrderBy()}); Pattern soqlPattern = Pattern.compile(expected); Matcher soqlMatcher = soqlPattern.matcher(soql); System.assert(soqlMatcher.matches(),'Expected: ' + expected + ' Actual:' + soql); @@ -461,8 +458,8 @@ private with sharing class fflib_SObjectSelectorTest String soql = sel.createSelectAccountWithOpportunitiesSOQL(); - String expected = String.format('SELECT name, id, annualrevenue, accountnumber,(.*)\\(SELECT name, id, amount, closedate FROM Opportunities ORDER BY {0} ASC NULLS FIRST \\) FROM Account WITH SYSTEM_MODE ORDER BY {1} ASC NULLS FIRST ', - new List{getDefaultSortField(SObjectType.Opportunity),getDefaultSortField(SObjectType.Account)}); + String expected = String.format('SELECT name, id, annualrevenue, accountnumber,(.*)\\(SELECT name, id, amount, closedate FROM Opportunities ORDER BY {0} ASC NULLS FIRST \\) FROM Account WITH SYSTEM_MODE ORDER BY {0} ASC NULLS FIRST ', + new List{sel.getOrderBy()}); Pattern soqlPattern = Pattern.compile(expected); Matcher soqlMatcher = soqlPattern.matcher(soql); System.assert(soqlMatcher.matches(),'Expected: ' + expected + ' Actual:' + soql); @@ -679,7 +676,8 @@ private with sharing class fflib_SObjectSelectorTest String soql = qf.toSOQL(); //Then - Pattern soqlPattern = Pattern.compile('SELECT (.*) FROM CampaignMember ORDER BY CreatedDate ASC NULLS FIRST '); + Pattern soqlPattern = Pattern.compile(String.format('SELECT (.*) FROM CampaignMember ORDER BY {0} ASC NULLS FIRST ', + new List{cmSelector.getOrderBy()})); Matcher soqlMatcher = soqlPattern.matcher(soql); soqlMatcher.matches(); @@ -701,7 +699,8 @@ private with sharing class fflib_SObjectSelectorTest expectedSelectFields.add('CurrencyIsoCode'); } - String expectedSOQL = 'SELECT ' + String.join(expectedSelectFields,', ') + ' FROM CampaignMember WITH SYSTEM_MODE ORDER BY CreatedDate ASC NULLS FIRST '; + String expectedSOQL = String.format('SELECT ' + String.join(expectedSelectFields,', ') + ' FROM CampaignMember WITH SYSTEM_MODE ORDER BY {0} ASC NULLS FIRST ', + new List{cmSelector.getOrderBy()}); //When String actualSOQL = qf.toSOQL(); From b912d7ba818d4eff479ca2d053f251d39678a15e Mon Sep 17 00:00:00 2001 From: John S Date: Sun, 9 Jul 2023 10:46:10 -0700 Subject: [PATCH 10/27] Conflict resolutions for merging with HEAD of master --- config/multicurrency-scratch-def.json | 15 +++++++++++++++ .../test/classes/fflib_SObjectSelectorTest.cls | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 config/multicurrency-scratch-def.json diff --git a/config/multicurrency-scratch-def.json b/config/multicurrency-scratch-def.json new file mode 100644 index 00000000000..13823162894 --- /dev/null +++ b/config/multicurrency-scratch-def.json @@ -0,0 +1,15 @@ +{ + "orgName": "apex-common", + "edition": "Developer", + "features": [ + "MultiCurrency" + ], + "settings": { + "currencySettings":{ + "enableMultiCurrency": true + }, + "lightningExperienceSettings": { + "enableS1DesktopEnabled": true + } + } +} diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls index 0303daa8aa2..3c100c280fd 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls @@ -445,7 +445,7 @@ private with sharing class fflib_SObjectSelectorTest String soql = sel.createSelectAllWithAccountSOQL(); - String expected = String.format('SELECT name, id, amount, closedate, (currencyisocode,)?account\\.name, account\\.billingpostalcode(.*)FROM Opportunity WITH SYSTEM_MODE ORDER BY {0} ASC NULLS FIRST ', + String expected = String.format('SELECT name, id, amount, closedate, (currencyisocode, )?account\\.name, account\\.billingpostalcode(.*)FROM Opportunity WITH SYSTEM_MODE ORDER BY {0} ASC NULLS FIRST ', new List{sel.getOrderBy()}); Pattern soqlPattern = Pattern.compile(expected); Matcher soqlMatcher = soqlPattern.matcher(soql); @@ -458,7 +458,7 @@ private with sharing class fflib_SObjectSelectorTest String soql = sel.createSelectAccountWithOpportunitiesSOQL(); - String expected = String.format('SELECT name, id, annualrevenue, accountnumber,(.*)\\(SELECT name, id, amount, closedate FROM Opportunities ORDER BY {0} ASC NULLS FIRST \\) FROM Account WITH SYSTEM_MODE ORDER BY {0} ASC NULLS FIRST ', + String expected = String.format('SELECT name, id, annualrevenue, accountnumber, (currencyisocode, )?\\(SELECT name, id, amount, closedate(, currencyisocode)? FROM Opportunities ORDER BY {0} ASC NULLS FIRST \\) FROM Account WITH SYSTEM_MODE ORDER BY {0} ASC NULLS FIRST ', new List{sel.getOrderBy()}); Pattern soqlPattern = Pattern.compile(expected); Matcher soqlMatcher = soqlPattern.matcher(soql); From dbda661a3a81fc350d14cb737016ca3bc49ec4ac Mon Sep 17 00:00:00 2001 From: John S Date: Sun, 9 Jul 2023 10:49:52 -0700 Subject: [PATCH 11/27] Consistently use "currencyisocode" in expected SOQL string. --- .../apex-common/test/classes/fflib_SObjectSelectorTest.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls index 3c100c280fd..1226cafbbe7 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls @@ -445,7 +445,7 @@ private with sharing class fflib_SObjectSelectorTest String soql = sel.createSelectAllWithAccountSOQL(); - String expected = String.format('SELECT name, id, amount, closedate, (currencyisocode, )?account\\.name, account\\.billingpostalcode(.*)FROM Opportunity WITH SYSTEM_MODE ORDER BY {0} ASC NULLS FIRST ', + String expected = String.format('SELECT name, id, amount, closedate, (currencyisocode, )?account\\.name, account\\.billingpostalcode(, currencyisocode)? FROM Opportunity WITH SYSTEM_MODE ORDER BY {0} ASC NULLS FIRST ', new List{sel.getOrderBy()}); Pattern soqlPattern = Pattern.compile(expected); Matcher soqlMatcher = soqlPattern.matcher(soql); From b377c8530f66942ff29bd496f6fb290d5681a46a Mon Sep 17 00:00:00 2001 From: Nathan Bruhn Date: Thu, 20 Jul 2023 13:24:55 -0400 Subject: [PATCH 12/27] skip unnecessary event publish --- .../apex-common/main/classes/fflib_SObjectUnitOfWork.cls | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls b/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls index 1c38f657b61..537bf3ed78f 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls @@ -109,6 +109,11 @@ public virtual class fflib_SObjectUnitOfWork } public virtual void eventPublish(List objList) { + if (objList.isEmpty()) + { + return; + } + EventBus.publish(objList); } public virtual void emptyRecycleBin(List objList) From 1c0ab182451548b61982a5c9e2b78fa966eb2cde Mon Sep 17 00:00:00 2001 From: John S Date: Sun, 23 Jul 2023 09:55:10 -0700 Subject: [PATCH 13/27] PR #438 feedback - Use brackets for if statements. - Removed "Testfflib" prefix from inner classes. --- .../classes/fflib_SObjectSelectorTest.cls | 48 +++++++++++-------- .../fflib_SObjectSelectorTest.cls-meta.xml | 2 +- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls index 1226cafbbe7..190393b31d2 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls @@ -209,7 +209,7 @@ private with sharing class fflib_SObjectSelectorTest } - @isTest + @IsTest static void testWithoutSorting() { //Given @@ -235,7 +235,7 @@ private with sharing class fflib_SObjectSelectorTest } // Test case of ordering with NULLS LAST option passed into the ordering method - @isTest + @IsTest static void testWithOrderingNullsLast() { // Build the selector to test with @@ -636,7 +636,7 @@ private with sharing class fflib_SObjectSelectorTest private static User createChatterExternalUser() { // Can only proceed with test if we have a suitable profile - Chatter External license has no access to Opportunity - List testProfiles = [Select Id From Profile where UserLicense.Name='Chatter External' limit 1]; + List testProfiles = [SELECT Id FROM Profile WHERE UserLicense.Name='Chatter External' LIMIT 1]; if(testProfiles.size()!=1) return null; @@ -655,14 +655,14 @@ private with sharing class fflib_SObjectSelectorTest return fflib_SecurityUtilsTest.setupTestUser('Read Only'); } - @isTest + @IsTest static void toSOQL_When_PolymorphicSelect_Expect_RelatedType() { //Given CampaignMemberSelector cmSelector = new CampaignMemberSelector(fflib_SObjectSelector.DataAccess.LEGACY); fflib_QueryFactory qf = cmSelector.newQueryFactory(); - new Testfflib_LeadSelector().configureQueryFactoryFields(qf, 'Lead'); - new Testfflib_UserSelector().configureQueryFactoryFields(qf, 'Lead.Owner'); + new LeadSelector().configureQueryFactoryFields(qf, 'Lead'); + new UserSelector().configureQueryFactoryFields(qf, 'Lead.Owner'); Set expectedSelectFields = new Set{ @@ -687,14 +687,14 @@ private with sharing class fflib_SObjectSelectorTest System.assertEquals(expectedSelectFields, new Set(actualSelectFields)); } - @isTest + @IsTest static void toSOQL_When_PolymorphicSelectInMulticurrency_Expect_RelatedType() { //Given CampaignMemberSelector cmSelector = new CampaignMemberSelector(fflib_SObjectSelector.DataAccess.LEGACY); fflib_QueryFactory qf = cmSelector.newQueryFactory(); - new Testfflib_LeadSelector().configureQueryFactoryFields(qf, 'Lead'); - new Testfflib_GroupSelector().configureQueryFactoryFields(qf, 'Lead.Owner'); + new LeadSelector().configureQueryFactoryFields(qf, 'Lead'); + new GroupSelector().configureQueryFactoryFields(qf, 'Lead.Owner'); Set expectedSelectFields = new Set{ @@ -728,23 +728,29 @@ private with sharing class fflib_SObjectSelectorTest } } - @isTest + @IsTest static void toSOQL_When_SystemModePolymorphicSelect_Expect_RelatedType() { CampaignMemberSelector cmSelector = new CampaignMemberSelector(fflib_SObjectSelector.DataAccess.SYSTEM_MODE); fflib_QueryFactory qf = cmSelector.newQueryFactory(); - new Testfflib_LeadSelector().configureQueryFactoryFields(qf, 'Lead'); - new Testfflib_UserSelector().configureQueryFactoryFields(qf, 'Lead.Owner'); + new LeadSelector().configureQueryFactoryFields(qf, 'Lead'); + new UserSelector().configureQueryFactoryFields(qf, 'Lead.Owner'); List expectedSelectFields = new List(); expectedSelectFields.add('id'); expectedSelectFields.add('status'); - if (UserInfo.isMultiCurrencyOrganization()) expectedSelectFields.add('currencyisocode'); + if (UserInfo.isMultiCurrencyOrganization()) { + expectedSelectFields.add('currencyisocode'); + } expectedSelectFields.add('lead.ownerid'); expectedSelectFields.add('lead.id'); - if (UserInfo.isMultiCurrencyOrganization()) expectedSelectFields.add('lead.currencyisocode'); + if (UserInfo.isMultiCurrencyOrganization()) { + expectedSelectFields.add('lead.currencyisocode'); + } expectedSelectFields.add('lead.owner.userroleid'); expectedSelectFields.add('lead.owner.id'); - if (UserInfo.isMultiCurrencyOrganization()) expectedSelectFields.add('lead.owner.currencyisocode'); + if (UserInfo.isMultiCurrencyOrganization()) { + expectedSelectFields.add('lead.owner.currencyisocode'); + } String expectedSOQL = String.format('SELECT ' + String.join(expectedSelectFields,', ') + ' FROM CampaignMember WITH SYSTEM_MODE ORDER BY {0} ASC NULLS FIRST ', new List{cmSelector.getOrderBy()}); @@ -773,8 +779,8 @@ private with sharing class fflib_SObjectSelectorTest } } - private class Testfflib_UserSelector extends fflib_SObjectSelector { - public Testfflib_UserSelector() { + private class UserSelector extends fflib_SObjectSelector { + public UserSelector() { super(); } @@ -790,8 +796,8 @@ private with sharing class fflib_SObjectSelectorTest } } - private class Testfflib_GroupSelector extends fflib_SObjectSelector { - public Testfflib_GroupSelector() { + private class GroupSelector extends fflib_SObjectSelector { + public GroupSelector() { super(); } @@ -806,8 +812,8 @@ private with sharing class fflib_SObjectSelectorTest } } - private class Testfflib_LeadSelector extends fflib_SObjectSelector { - public Testfflib_LeadSelector() { + private class LeadSelector extends fflib_SObjectSelector { + public LeadSelector() { super(); } diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active From a5323b1cdda5f66875acaa393b094a3647702486 Mon Sep 17 00:00:00 2001 From: "John M. Daniel" Date: Mon, 14 Aug 2023 09:47:25 -0400 Subject: [PATCH 14/27] devops chore: bump to v58.0 API --- .../apex-common/main/classes/fflib_Application.cls-meta.xml | 2 +- sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml | 2 +- .../main/classes/fflib_IDomainConstructor.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_IObjects.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml | 2 +- .../main/classes/fflib_ISObjectSelector.cls-meta.xml | 2 +- .../main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_ISObjects.cls-meta.xml | 2 +- .../main/classes/fflib_ISelectorFactory.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml | 2 +- .../main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml | 2 +- sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_QueryFactory.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml | 2 +- .../main/classes/fflib_SObjectUnitOfWork.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SObjects.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_StringBuilder.cls-meta.xml | 2 +- .../apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml | 2 +- .../apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml | 2 +- .../test/classes/fflib_QueryFactoryTest.cls-meta.xml | 2 +- .../test/classes/fflib_SObjectDescribeTest.cls-meta.xml | 2 +- .../test/classes/fflib_SObjectDomainTest.cls-meta.xml | 2 +- .../test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml | 2 +- .../apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml | 2 +- .../test/classes/fflib_SecurityUtilsTest.cls-meta.xml | 2 +- .../test/classes/fflib_StringBuilderTest.cls-meta.xml | 2 +- .../test/classes/mocks/fflib_SObjectMocks.cls-meta.xml | 2 +- 31 files changed, 31 insertions(+), 31 deletions(-) diff --git a/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml index cac127cd1a1..6fb1721ed2f 100644 --- a/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml @@ -1,4 +1,4 @@ - 57.0 + 58.0 diff --git a/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active diff --git a/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml b/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml index 754ecb15544..7a51829787a 100644 --- a/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml @@ -1,5 +1,5 @@ - 57.0 + 58.0 Active From 894731a23343063fdc60a592f8d3e127523c7e59 Mon Sep 17 00:00:00 2001 From: "John M. Daniel" Date: Mon, 14 Aug 2023 09:56:06 -0400 Subject: [PATCH 15/27] updated API of sfdx-project.json to v58.0 --- sfdx-project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfdx-project.json b/sfdx-project.json index 88c7589efa9..bd76b258653 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -7,5 +7,5 @@ ], "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", - "sourceApiVersion": "57.0" + "sourceApiVersion": "58.0" } \ No newline at end of file From 6fbe36932c29c1ce0dcd7ebb89cb17328e9abc71 Mon Sep 17 00:00:00 2001 From: "John M. Daniel" Date: Wed, 23 Aug 2023 22:07:05 -0400 Subject: [PATCH 16/27] fixed issue that would not resolve a person account based cross-object syntax --- .../main/classes/fflib_SObjectDescribe.cls | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls b/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls index ac1575a5e57..c0be3c45b92 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls @@ -100,12 +100,18 @@ public class fflib_SObjectDescribe { * e.g. getting the Account field on Contact would fail without being referenced as AccountId - both work here. **/ public Schema.SObjectField getField(String fieldName, Boolean implyNamespace){ - Schema.SObjectField result = wrappedFields.get( - (fieldName.endsWithIgnoreCase('__r') ? //resolve custom field cross-object (__r) syntax - (fieldName.removeEndIgnoreCase('__r')+'__c') : - fieldName), - implyNamespace - ); + String fieldNameAdjusted = fieldName; + + if ( fieldName.endsWithIgnoreCase('__r') ) //resolve custom field cross-object (__r) syntax + { + fieldNameAdjusted = fieldName.removeEndIgnoreCase('__r') + '__c'; + } + else if ( fieldName.endsWithIgnoreCase('__pr') ) //resolve custom field cross-object (__pr) syntax for person accounts + { + fieldNameAdjusted = fieldName.removeEndIgnoreCase('__pr') + '__c'; + } + + Schema.SObjectField result = wrappedFields.get( fieldNameAdjusted, implyNamespace ); if(result == null){ result = wrappedFields.get(fieldName+'Id', implyNamespace); //in case it's a standard lookup in cross-object format } From ee2ac7e6402a2294e2f3da47b92200c9734f740d Mon Sep 17 00:00:00 2001 From: "John M. Daniel" Date: Mon, 4 Sep 2023 23:08:38 -0400 Subject: [PATCH 17/27] fixes #463 ...again --- sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls b/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls index c0be3c45b92..0eac50185f0 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls @@ -108,7 +108,7 @@ public class fflib_SObjectDescribe { } else if ( fieldName.endsWithIgnoreCase('__pr') ) //resolve custom field cross-object (__pr) syntax for person accounts { - fieldNameAdjusted = fieldName.removeEndIgnoreCase('__pr') + '__c'; + fieldNameAdjusted = fieldName.removeEndIgnoreCase('__pr') + '__pc'; } Schema.SObjectField result = wrappedFields.get( fieldNameAdjusted, implyNamespace ); From d482301903515aa6a4a150acc71902df52c0c7be Mon Sep 17 00:00:00 2001 From: "John M. Daniel" Date: Mon, 2 Oct 2023 09:38:22 -0400 Subject: [PATCH 18/27] corrected inline comment --- .../apex-common/main/classes/fflib_SObjectSelector.cls | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls b/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls index 2d15652a29a..3abbdc4e380 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls @@ -438,7 +438,7 @@ public abstract with sharing class fflib_SObjectSelector } /** - * Adds a subselect QueryFactory based on this selector to the given QueryFactor, returns the parentQueryFactory + * Adds a subselect QueryFactory based on this selector to the given QueryFactor, returns the child QueryFactory **/ public fflib_QueryFactory addQueryFactorySubselect(fflib_QueryFactory parentQueryFactory) { @@ -461,7 +461,7 @@ public abstract with sharing class fflib_SObjectSelector } /** - * Adds a subselect QueryFactory based on this selector to the given QueryFactor, returns the parentQueryFactory + * Adds a subselect QueryFactory based on this selector to the given QueryFactor, returns the child QueryFactory **/ public fflib_QueryFactory addQueryFactorySubselect(fflib_QueryFactory parentQueryFactory, String relationshipName) { From eb4d06d6f0cc1b697baab6ee32cfbb6caa66a2ce Mon Sep 17 00:00:00 2001 From: "John M. Daniel" Date: Sat, 4 Nov 2023 22:26:41 -0400 Subject: [PATCH 19/27] Adjustments and updates to video and related links --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index b1328c3d571..65cadaa5040 100644 --- a/README.md +++ b/README.md @@ -32,14 +32,6 @@ Application Enterprise Patterns on Force.com Design patterns are an invaluable tool for developers and architects looking to build enterprise solutions. Here are presented some tried and tested enterprise application engineering patterns that have been used in other platforms and languages. We will discuss and illustrate how patterns such as Data Mapper, Service Layer, Unit of Work and of course Model View Controller can be applied to Force.com. Applying these patterns can help manage governed resources (such as DML) better, encourage better separation-of-concerns in your logic and enforce Force.com coding best practices. -Dreamforce Session and Slides ------------------------------ - -- View slides for the **Dreamforce 2013** session [here](https://docs.google.com/file/d/0B6brfGow3cD8RVVYc1dCX2s0S1E/edit) -- Video recording of the **Dreamforce 2013** session [here](http://www.youtube.com/watch?v=qlq46AEAlLI). -- Video recording of the **Advanced Apex Enterprise Dreamforce 2014** session [here](http://dreamforce.vidyard.com/watch/7QtP2628KmtXfmiwI-7B1w%20). -- View slides for the **Dreamforce 2015** session [here](http://www.slideshare.net/andyinthecloud/building-strong-foundations-apex-enterprise-patterns) - Documentation ------------- @@ -52,11 +44,19 @@ Documentation - [Apex Enterprise Patterns - Service Layer](http://wiki.developerforce.com/page/Apex_Enterprise_Patterns_-_Service_Layer) - [Apex Enterprise Patterns - Domain Layer](http://wiki.developerforce.com/page/Apex_Enterprise_Patterns_-_Domain_Layer) - [Apex Enterprise Patterns - Selector Layer](https://github.com/financialforcedev/df12-apex-enterprise-patterns#data-mapper-selector) +- View slides for the **Dreamforce 2013** session [here](https://docs.google.com/file/d/0B6brfGow3cD8RVVYc1dCX2s0S1E/edit) +- View slides for the **Dreamforce 2015** session [here](http://www.slideshare.net/andyinthecloud/building-strong-foundations-apex-enterprise-patterns) + +**Related Webinars** +- [Advanced Apex Enterprise Patterns](https://www.youtube.com/watch?v=BLXp0ZP0cF0) +- [Apex Hours (August 2020): Apex Enterprise Patterns](https://www.apexhours.com/apex-enterprise-patterns/) + +**Related Book** +- [Salesforce Platform Enterprise Architecture, 4th Edition, by Andrew Fawcett](https://www.amazon.com/Salesforce-Platform-Enterprise-Architecture-applications-ebook/dp/B0BD8TBT75/ref=pd_ci_mcx_mh_mcx_views_0) **Other Related Blogs** - [Preview of Advanced Apex Patterns Session (Application Factory and ApexMocks Features)](http://andyinthecloud.com/2014/08/26/preview-of-advanced-apex-enterprise-patterns-session/) - [Unit Testing with the Domain Layer](http://andyinthecloud.com/2014/03/23/unit-testing-with-the-domain-layer/) -- [MavensMate Templates](http://andyinthecloud.com/2014/05/23/mavensmate-templates-and-apex-enterprise-patterns/) - [FinancialForce Apex Common Updates](http://andyinthecloud.com/2014/06/28/financialforce-apex-common-updates/) From 125b0109d0593909532ade9d10668cc94980ea2b Mon Sep 17 00:00:00 2001 From: "John M. Daniel" Date: Sun, 5 Nov 2023 15:20:53 -0500 Subject: [PATCH 20/27] removed extranious items from link to book --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 65cadaa5040..f048e626413 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Documentation - [Apex Hours (August 2020): Apex Enterprise Patterns](https://www.apexhours.com/apex-enterprise-patterns/) **Related Book** -- [Salesforce Platform Enterprise Architecture, 4th Edition, by Andrew Fawcett](https://www.amazon.com/Salesforce-Platform-Enterprise-Architecture-applications-ebook/dp/B0BD8TBT75/ref=pd_ci_mcx_mh_mcx_views_0) +- [Salesforce Platform Enterprise Architecture, 4th Edition, by Andrew Fawcett](https://www.amazon.com/Salesforce-Platform-Enterprise-Architecture-applications-ebook/dp/B0BD8TBT75/) **Other Related Blogs** From c584d115e49bc291e180c9f3cff300118321f104 Mon Sep 17 00:00:00 2001 From: "John M. Daniel" Date: Sun, 5 Nov 2023 16:03:32 -0500 Subject: [PATCH 21/27] addition of the manage sf api version github action --- .github/workflows/manage.sf.api.versions.yml | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/manage.sf.api.versions.yml diff --git a/.github/workflows/manage.sf.api.versions.yml b/.github/workflows/manage.sf.api.versions.yml new file mode 100644 index 00000000000..6900179c01d --- /dev/null +++ b/.github/workflows/manage.sf.api.versions.yml @@ -0,0 +1,22 @@ +name: Manage SF API Versions +on: + workflow_dispatch: + inputs: + api-version: + description: 'api version in the format XX e.g 58' + required: true + type: string +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: apex-enterprise-patterns/manage-sf-api-version@v1.0.0 + with: + api-version: ${{inputs.api-version}} + - uses: peter-evans/create-pull-request@v5 + with: + title: 'Bump API Versions to ${{inputs.api-version}}.0' + body: 'Automatically bumped by GitHub Actions ' + branch: 'devops/bump-api-versions-v${{inputs.api-version}}.0' + commit-message: 'chore: bump api to v${{inputs.api-version}}.0' From c74146511fe37f101f2c873190477b65838fe4c1 Mon Sep 17 00:00:00 2001 From: ImJohnMDaniel Date: Mon, 6 Nov 2023 20:24:16 +0000 Subject: [PATCH 22/27] chore: bump api to v59.0 --- sfdx-project.json | 18 +++++++++--------- .../classes/fflib_Application.cls-meta.xml | 2 +- .../main/classes/fflib_IDomain.cls-meta.xml | 2 +- .../fflib_IDomainConstructor.cls-meta.xml | 2 +- .../classes/fflib_IDomainFactory.cls-meta.xml | 2 +- .../main/classes/fflib_IObjects.cls-meta.xml | 2 +- .../classes/fflib_ISObjectDomain.cls-meta.xml | 2 +- .../fflib_ISObjectSelector.cls-meta.xml | 2 +- .../fflib_ISObjectUnitOfWork.cls-meta.xml | 2 +- .../main/classes/fflib_ISObjects.cls-meta.xml | 2 +- .../fflib_ISelectorFactory.cls-meta.xml | 2 +- .../classes/fflib_IServiceFactory.cls-meta.xml | 2 +- .../fflib_IUnitOfWorkFactory.cls-meta.xml | 2 +- .../main/classes/fflib_Objects.cls-meta.xml | 2 +- .../classes/fflib_QueryFactory.cls-meta.xml | 2 +- .../classes/fflib_SObjectDescribe.cls-meta.xml | 2 +- .../classes/fflib_SObjectDomain.cls-meta.xml | 2 +- .../classes/fflib_SObjectSelector.cls-meta.xml | 2 +- .../fflib_SObjectUnitOfWork.cls-meta.xml | 2 +- .../main/classes/fflib_SObjects.cls-meta.xml | 2 +- .../classes/fflib_SecurityUtils.cls-meta.xml | 2 +- .../classes/fflib_StringBuilder.cls-meta.xml | 2 +- .../classes/fflib_ApplicationTest.cls-meta.xml | 2 +- .../classes/fflib_ObjectsTest.cls-meta.xml | 2 +- .../fflib_QueryFactoryTest.cls-meta.xml | 2 +- .../fflib_SObjectDescribeTest.cls-meta.xml | 2 +- .../fflib_SObjectDomainTest.cls-meta.xml | 2 +- .../fflib_SObjectSelectorTest.cls-meta.xml | 2 +- .../fflib_SObjectUnitOfWorkTest.cls-meta.xml | 2 +- .../classes/fflib_SObjectsTest.cls-meta.xml | 2 +- .../fflib_SecurityUtilsTest.cls-meta.xml | 2 +- .../fflib_StringBuilderTest.cls-meta.xml | 2 +- .../mocks/fflib_SObjectMocks.cls-meta.xml | 2 +- 33 files changed, 41 insertions(+), 41 deletions(-) diff --git a/sfdx-project.json b/sfdx-project.json index bd76b258653..bb1d3657196 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -1,11 +1,11 @@ { - "packageDirectories": [ - { - "path": "sfdx-source/apex-common", - "default": true - } - ], - "namespace": "", - "sfdcLoginUrl": "https://login.salesforce.com", - "sourceApiVersion": "58.0" + "packageDirectories": [ + { + "path": "sfdx-source/apex-common", + "default": true + } + ], + "namespace": "", + "sfdcLoginUrl": "https://login.salesforce.com", + "sourceApiVersion": "59.0" } \ No newline at end of file diff --git a/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml index 6fb1721ed2f..d12609be92e 100644 --- a/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml @@ -1,4 +1,4 @@ - 58.0 + 59.0 diff --git a/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active diff --git a/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml b/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml index 7a51829787a..b1a915c9c6d 100644 --- a/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml @@ -1,5 +1,5 @@ - 58.0 + 59.0 Active From 43c3d4dacb74c73a379418a2c9aaee30b10143b1 Mon Sep 17 00:00:00 2001 From: "John M. Daniel" Date: Mon, 18 Dec 2023 20:31:24 -0500 Subject: [PATCH 23/27] switched to `apex-enterprise-patterns/setup-sfdx@v2` --- .github/workflows/deploy.and.test.yml | 32 ++++++++++++++++----------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deploy.and.test.yml b/.github/workflows/deploy.and.test.yml index 9372c5f5a25..b747c8e8118 100644 --- a/.github/workflows/deploy.and.test.yml +++ b/.github/workflows/deploy.and.test.yml @@ -16,20 +16,26 @@ jobs: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - name: Install SFDX CLI and authorize DevHub - uses: apex-enterprise-patterns/setup-sfdx@v1 #We're using a fork of https://github.com/sfdx-actions/setup-sfdx for safety + uses: apex-enterprise-patterns/setup-sfdx@v2 #We're using a fork of https://github.com/sfdx-actions/setup-sfdx for safety with: sfdx-auth-url: ${{ secrets.DEVHUB_SFDXURL }} - - run: sfdx force:config:set defaultdevhubusername=SFDX-ENV -g #Even though the setup-sfdx action uses --setdefaultdevhubusername, it doesn't seem to stick since it uses --setdefaultusername so we brute force it here - - run: echo y | sfdx plugins:install shane-sfdx-plugins - - run: sfdx force:org:create -f config/project-scratch-def.json --setdefaultusername -d 1 - - run: sfdx shane:github:src:install -c -g apex-enterprise-patterns -r fflib-apex-mocks -p sfdx-source/apex-mocks - - run: sfdx force:source:push - - run: sfdx force:apex:test:run -w 5 - #Intentionally install the Sample Code after the core AEP Commons test pass succeeds so that we don't deploy anything in Sample Code - #that could mask a test failure. A much more involved solution would've been to do a workflow_dispatch to the samplecode project. - - run: sfdx shane:github:src:install -c -g apex-enterprise-patterns -r fflib-apex-common-samplecode -p sfdx-source/apex-common-samplecode - - run: sfdx force:apex:test:run -w 5 + # Install the required plugins + - run: echo y | sf plugins install shane-sfdx-plugins + # Setup the config parameters needed + - run: sf config set target-dev-hub SFDX-ENV --global #Even though the setup-sfdx action uses --setdefaultdevhubusername, it doesn't seem to stick since it uses --setdefaultusername so we brute force it here + # Create the scratch org + - run: sf org create scratch --definition-file config/project-scratch-def.json --set-default --duration-days 1 --no-track-source + # Install required dependency frameworks + - run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-mocks --path sfdx-source/apex-mocks + # Deploy/compile the codebase + - run: sf project deploy start + # Run the core framework tests + - run: sf apex run test --wait 5 + # Intentionally install the Sample Code after the core AEP Commons test pass succeeds so that we don't deploy anything in Sample Code + # that could mask a test failure. A much more involved solution would've been to do a workflow_dispatch to the samplecode project. + - run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-common-samplecode --path sfdx-source/apex-common-samplecode + # Run the core framework tests and the sample code project tests + - run: sf apex run test --wait 5 - name: Destroy scratch org - run: sfdx force:org:delete -p + run: sf org delete scratch --no-prompt if: always() - From 3f1d3c56e25c1fddf1d4ec89db0fdb0e41c1e1cd Mon Sep 17 00:00:00 2001 From: "John M. Daniel" Date: Mon, 18 Dec 2023 23:17:37 -0500 Subject: [PATCH 24/27] small name fix --- .github/workflows/deploy.and.test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.and.test.yml b/.github/workflows/deploy.and.test.yml index b747c8e8118..d21d5da4306 100644 --- a/.github/workflows/deploy.and.test.yml +++ b/.github/workflows/deploy.and.test.yml @@ -15,7 +15,7 @@ jobs: with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - name: Install SFDX CLI and authorize DevHub + - name: Install SF CLI and authorize DevHub uses: apex-enterprise-patterns/setup-sfdx@v2 #We're using a fork of https://github.com/sfdx-actions/setup-sfdx for safety with: sfdx-auth-url: ${{ secrets.DEVHUB_SFDXURL }} From cda8c1083ef31ba42da3f811487763e6c85e410b Mon Sep 17 00:00:00 2001 From: "John M. Daniel" Date: Tue, 19 Dec 2023 16:04:27 -0500 Subject: [PATCH 25/27] adjustments based on feedback --- .github/workflows/deploy.and.test.yml | 31 ++++++++++++++------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/deploy.and.test.yml b/.github/workflows/deploy.and.test.yml index d21d5da4306..ca7ee3c2602 100644 --- a/.github/workflows/deploy.and.test.yml +++ b/.github/workflows/deploy.and.test.yml @@ -19,23 +19,24 @@ jobs: uses: apex-enterprise-patterns/setup-sfdx@v2 #We're using a fork of https://github.com/sfdx-actions/setup-sfdx for safety with: sfdx-auth-url: ${{ secrets.DEVHUB_SFDXURL }} - # Install the required plugins - - run: echo y | sf plugins install shane-sfdx-plugins - # Setup the config parameters needed - - run: sf config set target-dev-hub SFDX-ENV --global #Even though the setup-sfdx action uses --setdefaultdevhubusername, it doesn't seem to stick since it uses --setdefaultusername so we brute force it here - # Create the scratch org - - run: sf org create scratch --definition-file config/project-scratch-def.json --set-default --duration-days 1 --no-track-source - # Install required dependency frameworks - - run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-mocks --path sfdx-source/apex-mocks - # Deploy/compile the codebase - - run: sf project deploy start - # Run the core framework tests - - run: sf apex run test --wait 5 + - name: Install the required plugins + run: echo y | sf plugins install shane-sfdx-plugins + - name: Setup the config parameters needed + run: sf config set target-dev-hub SFDX-ENV --global #Even though the setup-sfdx action uses --setdefaultdevhubusername, it doesn't seem to stick since it uses --setdefaultusername so we brute force it here + - name: Create the scratch org + run: sf org create scratch --definition-file config/project-scratch-def.json --set-default --duration-days 1 --no-track-source + - name: Install required dependency frameworks + run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-mocks --path sfdx-source/apex-mocks + - name: Deploy and compile the codebase + run: sf project deploy start + - name: Run the core framework tests + run: sf apex run test --wait 5 # Intentionally install the Sample Code after the core AEP Commons test pass succeeds so that we don't deploy anything in Sample Code # that could mask a test failure. A much more involved solution would've been to do a workflow_dispatch to the samplecode project. - - run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-common-samplecode --path sfdx-source/apex-common-samplecode - # Run the core framework tests and the sample code project tests - - run: sf apex run test --wait 5 + - name: Install sample code project to verify with + run: sf shane github src install --convert --githubuser apex-enterprise-patterns --repo fflib-apex-common-samplecode --path sfdx-source/apex-common-samplecode + - name: Run the core framework tests and the sample code project tests + run: sf apex run test --wait 5 - name: Destroy scratch org run: sf org delete scratch --no-prompt if: always() From 06870ec324b2deb0517d648dc48d524aa5f67414 Mon Sep 17 00:00:00 2001 From: ImJohnMDaniel Date: Mon, 12 Feb 2024 03:00:01 +0000 Subject: [PATCH 26/27] chore: bump api to v60.0 --- sfdx-project.json | 2 +- .../apex-common/main/classes/fflib_Application.cls-meta.xml | 2 +- sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml | 2 +- .../main/classes/fflib_IDomainConstructor.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_IObjects.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml | 2 +- .../main/classes/fflib_ISObjectSelector.cls-meta.xml | 2 +- .../main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_ISObjects.cls-meta.xml | 2 +- .../main/classes/fflib_ISelectorFactory.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml | 2 +- .../main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml | 2 +- sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_QueryFactory.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml | 2 +- .../main/classes/fflib_SObjectUnitOfWork.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SObjects.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml | 2 +- .../apex-common/main/classes/fflib_StringBuilder.cls-meta.xml | 2 +- .../apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml | 2 +- .../apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml | 2 +- .../test/classes/fflib_QueryFactoryTest.cls-meta.xml | 2 +- .../test/classes/fflib_SObjectDescribeTest.cls-meta.xml | 2 +- .../test/classes/fflib_SObjectDomainTest.cls-meta.xml | 2 +- .../test/classes/fflib_SObjectSelectorTest.cls-meta.xml | 2 +- .../test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml | 2 +- .../apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml | 2 +- .../test/classes/fflib_SecurityUtilsTest.cls-meta.xml | 2 +- .../test/classes/fflib_StringBuilderTest.cls-meta.xml | 2 +- .../test/classes/mocks/fflib_SObjectMocks.cls-meta.xml | 2 +- 33 files changed, 33 insertions(+), 33 deletions(-) diff --git a/sfdx-project.json b/sfdx-project.json index bb1d3657196..88ba4540e14 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -7,5 +7,5 @@ ], "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", - "sourceApiVersion": "59.0" + "sourceApiVersion": "60.0" } \ No newline at end of file diff --git a/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_Application.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IDomainConstructor.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IDomainFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IObjects.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjectDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjectSelector.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjectUnitOfWork.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISObjects.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_ISelectorFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IServiceFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_IUnitOfWorkFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_Objects.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectDescribe.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectDomain.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectSelector.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SObjects.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_SecurityUtils.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml b/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml +++ b/sfdx-source/apex-common/main/classes/fflib_StringBuilder.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml index d12609be92e..c7804fa6d37 100644 --- a/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_ApplicationTest.cls-meta.xml @@ -1,4 +1,4 @@ - 59.0 + 60.0 diff --git a/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_ObjectsTest.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_QueryFactoryTest.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectDescribeTest.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectDomainTest.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectUnitOfWorkTest.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectsTest.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml b/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/fflib_StringBuilderTest.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active diff --git a/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml b/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml index b1a915c9c6d..f5e18fd16c7 100644 --- a/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml +++ b/sfdx-source/apex-common/test/classes/mocks/fflib_SObjectMocks.cls-meta.xml @@ -1,5 +1,5 @@ - 59.0 + 60.0 Active From 01d3a16a4076fb939c46e87aba3797043ceff52b Mon Sep 17 00:00:00 2001 From: David Esposito Date: Thu, 22 Feb 2024 15:53:04 -0500 Subject: [PATCH 27/27] Fixes #440 - changes the few tests that are exercising CRUD/FLS enforcement to prefer the 'Minimum Access - Salesforce' profile since that is a more reliable Profile in most modern orgs --- .../classes/fflib_SObjectSelectorTest.cls | 12 ++++----- .../test/classes/fflib_SecurityUtilsTest.cls | 26 +++++++++---------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls index 190393b31d2..c89b19e7fb0 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SObjectSelectorTest.cls @@ -378,7 +378,7 @@ private with sharing class fflib_SObjectSelectorTest static void toSOQL_When_UserModeAndUserCannnotReadObject_Expect_QueryException(){ AccessLevelOpportunitySelector sel = new AccessLevelOpportunitySelector(); - User u = getLimitedReadOnlyUser(); + User u = getMinimumAccessUser(); System.runAs(u){ try{ System.debug(sel.newQueryFactory().toSOQL()); @@ -399,7 +399,7 @@ private with sharing class fflib_SObjectSelectorTest static void toSOQL_When_SystemModeAndUserCannnotReadObject_Expect_Success(){ AccessLevelOpportunitySelector sel = new AccessLevelOpportunitySelector(fflib_SObjectSelector.DataAccess.SYSTEM_MODE); - User u = getLimitedReadOnlyUser(); + User u = getMinimumAccessUser(); System.runAs(u){ sel.selectSObjectsById(new Set{fflib_IDGenerator.generate(Opportunity.SObjectType)}); } @@ -410,7 +410,7 @@ private with sharing class fflib_SObjectSelectorTest AccessLevelAccountSelector sel = new AccessLevelAccountSelector(); //Account has Read access by the limited read only user but no FLS access - User u = getLimitedReadOnlyUser(); + User u = getMinimumAccessUser(); System.runAs(u){ try{ System.debug(sel.newQueryFactory().toSOQL()); @@ -433,7 +433,7 @@ private with sharing class fflib_SObjectSelectorTest AccessLevelAccountSelector sel = new AccessLevelAccountSelector(fflib_SObjectSelector.DataAccess.SYSTEM_MODE); //Account has Read access by the limited read only user but no FLS access - User u = getLimitedReadOnlyUser(); + User u = getMinimumAccessUser(); System.runAs(u){ sel.selectSObjectsById(new Set{fflib_IDGenerator.generate(Account.SObjectType)}); } @@ -651,8 +651,8 @@ private with sharing class fflib_SObjectSelectorTest return testUser; } - private static User getLimitedReadOnlyUser(){ - return fflib_SecurityUtilsTest.setupTestUser('Read Only'); + private static User getMinimumAccessUser(){ + return fflib_SecurityUtilsTest.setupTestUser(true); } @IsTest diff --git a/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls b/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls index 3e7e4c93a15..5b30aab02ec 100644 --- a/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls +++ b/sfdx-source/apex-common/test/classes/fflib_SecurityUtilsTest.cls @@ -79,22 +79,20 @@ private class fflib_SecurityUtilsTest { } @TestVisible - static User setupTestUser(String profileName){ + static User setupTestUser(Boolean limitedAccess){ Profile p; - Boolean applyReadOnlyPermissionSet = false; - if (profileName == 'Read Only') { - applyReadOnlyPermissionSet = true; + + if (limitedAccess) { try { - p = getProfile(profileName); + p = getProfile('Minimum Access - Salesforce'); } catch (QueryException ex) { if (ex.getMessage().contains('List has no rows for assignment to SObject')) { - // #315 If the "Read Only" Profile is absent, then assume it's a Spring '21 org and see if there's a - // "Minimum Access - Salesforce" Profile we can use instead. - p = getProfile('Minimum Access - Salesforce'); + //#440 - not ideal, but we'll fall back to the rather liberally permissioned 'Read Only' profile that exists in very old orgs + p = getProfile('Read Only'); } } } else { - p = getProfile(profileName); + p = getProfile('System Administrator'); } //username global uniqueness is still enforced in tests @@ -118,7 +116,7 @@ private class fflib_SecurityUtilsTest { ); insert usr; - if (applyReadOnlyPermissionSet) { + if (limitedAccess) { // #315 We need to assign the Perm Set to grant Account "Read" access PermissionSet accountReadPS = [SELECT Id FROM PermissionSet WHERE Name = 'ReadOnlyPermissionSet']; PermissionSetAssignment psa = new PermissionSetAssignment(AssigneeId = usr.Id, PermissionSetId = accountReadPS.Id); @@ -129,7 +127,7 @@ private class fflib_SecurityUtilsTest { @isTest static void readonly_field_access() { - User testUser = setupTestUser('Read Only'); + User testUser = setupTestUser(true); System.runAs(testUser){ { fflib_SecurityUtils.SecurityException ex; @@ -172,7 +170,7 @@ private class fflib_SecurityUtilsTest { @isTest static void readonly_object_access() { - User testUser = setupTestUser('Read Only'); + User testUser = setupTestUser(true); System.runAs(testUser){ { fflib_SecurityUtils.SecurityException ex; @@ -226,7 +224,7 @@ private class fflib_SecurityUtilsTest { @isTest static void readonly_objectAndField_access() { - User testUser = setupTestUser('Read Only'); + User testUser = setupTestUser(true); System.runAs(testUser){ { fflib_SecurityUtils.SecurityException ex; @@ -311,7 +309,7 @@ private class fflib_SecurityUtilsTest { @isTest static void sysadmin_objectAndField_access() { - User testUser = setupTestUser('System Administrator'); + User testUser = setupTestUser(false); System.runAs(testUser){ fflib_SecurityUtils.checkInsert( Account.SObjectType,