From cd4bb0a2e40abb6ea338b62da3257eeba98ff57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Mon, 13 Jan 2025 14:14:30 +0100 Subject: [PATCH 01/16] Byttet custom metadata type --- .../CustomMetadataDAOTest.cls | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/platform-utility/CustomMetadataDAO/CustomMetadataDAOTest.cls b/src/platform-utility/CustomMetadataDAO/CustomMetadataDAOTest.cls index ce44f27..fcda535 100644 --- a/src/platform-utility/CustomMetadataDAO/CustomMetadataDAOTest.cls +++ b/src/platform-utility/CustomMetadataDAO/CustomMetadataDAOTest.cls @@ -36,18 +36,18 @@ public class CustomMetadataDAOTest { */ @IsTest static void testGetMetadata() { - // List customMetadataRecords; - // System.Test.startTest(); - // customMetadataRecords = new CustomMetadataDAO() - // .getCustomMetadataRecords( - // 'SELECT MasterLabel FROM API_Base_Configuration__mdt' - // ); - // System.Test.stopTest(); - // System.assertEquals( - // [SELECT MasterLabel FROM API_Base_Configuration__mdt].size(), - // customMetadataRecords.size(), - // 'Size should match' - // ); + List customMetadataRecords; + System.Test.startTest(); + customMetadataRecords = new CustomMetadataDAO() + .getCustomMetadataRecords( + 'SELECT MasterLabel FROM Custom_Meta_DAO_test__mdt' + ); + System.Test.stopTest(); + System.assertEquals( + [SELECT MasterLabel FROM Custom_Meta_DAO_test__mdt].size(), + customMetadataRecords.size(), + 'Size should match' + ); } /** From e580005f153036ce25a4ce2a1bb83e121b7503fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Mon, 13 Jan 2025 14:15:19 +0100 Subject: [PATCH 02/16] Custom metadata type for test --- ...ustom Meta DAO test Layout.layout-meta.xml | 61 +++++++++++++++++++ .../Custom_Meta_DAO_test__mdt.object-meta.xml | 7 +++ 2 files changed, 68 insertions(+) create mode 100644 src/platform-utility/CustomMetadataDAO/layouts/Custom_Meta_DAO_test__mdt-Custom Meta DAO test Layout.layout-meta.xml create mode 100644 src/platform-utility/CustomMetadataDAO/objects/Custom_Meta_DAO_test__mdt/Custom_Meta_DAO_test__mdt.object-meta.xml diff --git a/src/platform-utility/CustomMetadataDAO/layouts/Custom_Meta_DAO_test__mdt-Custom Meta DAO test Layout.layout-meta.xml b/src/platform-utility/CustomMetadataDAO/layouts/Custom_Meta_DAO_test__mdt-Custom Meta DAO test Layout.layout-meta.xml new file mode 100644 index 0000000..4c7284c --- /dev/null +++ b/src/platform-utility/CustomMetadataDAO/layouts/Custom_Meta_DAO_test__mdt-Custom Meta DAO test Layout.layout-meta.xml @@ -0,0 +1,61 @@ + + + + false + false + true + + + + Required + MasterLabel + + + Required + DeveloperName + + + + + Edit + IsProtected + + + Required + NamespacePrefix + + + + + + false + false + true + + + + Readonly + CreatedById + + + + + Readonly + LastModifiedById + + + + + + false + false + false + + + + false + false + false + false + false + diff --git a/src/platform-utility/CustomMetadataDAO/objects/Custom_Meta_DAO_test__mdt/Custom_Meta_DAO_test__mdt.object-meta.xml b/src/platform-utility/CustomMetadataDAO/objects/Custom_Meta_DAO_test__mdt/Custom_Meta_DAO_test__mdt.object-meta.xml new file mode 100644 index 0000000..a0c92e6 --- /dev/null +++ b/src/platform-utility/CustomMetadataDAO/objects/Custom_Meta_DAO_test__mdt/Custom_Meta_DAO_test__mdt.object-meta.xml @@ -0,0 +1,7 @@ + + + Dummy custom metadata type in order to test Custom Meta DAO + + Custom Meta DAO tests + Public + From c497cfe3bf68ab4635fb9ec9d81c3d3c047965b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Mon, 13 Jan 2025 14:17:59 +0100 Subject: [PATCH 03/16] Oppdaterte pakke navn --- sfdx-project.json | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/sfdx-project.json b/sfdx-project.json index d5981d7..6168957 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -14,17 +14,13 @@ { "path": "src/platform-admin", "package": "platform-admin", - "versionNumber": "0.0.0.NEXT", - "definitionFile": "config/project-scratch-def.json" + "versionNumber": "0.0.0.NEXT" }, { - "path": "src/platform-utility", - "package": "platform-utility", - "versionName": "ver 0.1", - "versionNumber": "0.1.0.NEXT", - "default": false, - "versionDescription": "Package containing the core platform utilities.", - "definitionFile": "config/project-scratch-def.json" + "path": "src/platform-utility/CustomMetadataDAO", + "package": "custom-metadata-dao", + "versionNumber": "0.0.0.NEXT", + "default": false } ], "packageAliases": { From 51de51043e3ec0aa17a8c706159a42a675460362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Mon, 13 Jan 2025 14:18:50 +0100 Subject: [PATCH 04/16] Flyttet filene til classes --- .../CustomMetadataDAO/{ => classes}/CustomMetadataDAO.cls | 0 .../{ => classes}/CustomMetadataDAO.cls-meta.xml | 0 .../CustomMetadataDAO/{ => classes}/CustomMetadataDAOTest.cls | 0 .../{ => classes}/CustomMetadataDAOTest.cls-meta.xml | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename src/platform-utility/CustomMetadataDAO/{ => classes}/CustomMetadataDAO.cls (100%) rename src/platform-utility/CustomMetadataDAO/{ => classes}/CustomMetadataDAO.cls-meta.xml (100%) rename src/platform-utility/CustomMetadataDAO/{ => classes}/CustomMetadataDAOTest.cls (100%) rename src/platform-utility/CustomMetadataDAO/{ => classes}/CustomMetadataDAOTest.cls-meta.xml (100%) diff --git a/src/platform-utility/CustomMetadataDAO/CustomMetadataDAO.cls b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls similarity index 100% rename from src/platform-utility/CustomMetadataDAO/CustomMetadataDAO.cls rename to src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls diff --git a/src/platform-utility/CustomMetadataDAO/CustomMetadataDAO.cls-meta.xml b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls-meta.xml similarity index 100% rename from src/platform-utility/CustomMetadataDAO/CustomMetadataDAO.cls-meta.xml rename to src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls-meta.xml diff --git a/src/platform-utility/CustomMetadataDAO/CustomMetadataDAOTest.cls b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls similarity index 100% rename from src/platform-utility/CustomMetadataDAO/CustomMetadataDAOTest.cls rename to src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls diff --git a/src/platform-utility/CustomMetadataDAO/CustomMetadataDAOTest.cls-meta.xml b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls-meta.xml similarity index 100% rename from src/platform-utility/CustomMetadataDAO/CustomMetadataDAOTest.cls-meta.xml rename to src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls-meta.xml From 917d098f118e84b5b0c28401e1041d93d209145a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Mon, 13 Jan 2025 14:33:26 +0100 Subject: [PATCH 05/16] Fjernet filter som ikke fungerte --- .github/workflows/buildAndPublish.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/buildAndPublish.yml b/.github/workflows/buildAndPublish.yml index 4aacd99..280f9d3 100644 --- a/.github/workflows/buildAndPublish.yml +++ b/.github/workflows/buildAndPublish.yml @@ -20,15 +20,7 @@ jobs: github.event_name == 'workflow_dispatch' || ( github.event_name == 'workflow_run' && - github.event.workflow_run.conclusion == 'success' && - ( - contains(github.event.workflow_run.head_commit.modified, 'src/') || - contains(github.event.workflow_run.head_commit.added, 'src/') - ) && - !( - github.event.workflow_run.head_commit.modified == '["*.md"]' || - github.event.workflow_run.head_commit.added == '["*.md"]' - ) + github.event.workflow_run.conclusion == 'success' ) }} From 41ff1885ed2581cef98bdeb0d8ce883f63513fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Tue, 14 Jan 2025 12:56:04 +0100 Subject: [PATCH 06/16] Fjernet avhengighet i testen til en faktisk custom metadata type --- .../classes/CustomMetadataDAOTest.cls | 20 ++++-- ...ustom Meta DAO test Layout.layout-meta.xml | 61 ------------------- .../Custom_Meta_DAO_test__mdt.object-meta.xml | 7 --- 3 files changed, 16 insertions(+), 72 deletions(-) delete mode 100644 src/platform-utility/CustomMetadataDAO/layouts/Custom_Meta_DAO_test__mdt-Custom Meta DAO test Layout.layout-meta.xml delete mode 100644 src/platform-utility/CustomMetadataDAO/objects/Custom_Meta_DAO_test__mdt/Custom_Meta_DAO_test__mdt.object-meta.xml diff --git a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls index fcda535..0540ae2 100644 --- a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls +++ b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls @@ -37,14 +37,26 @@ public class CustomMetadataDAOTest { @IsTest static void testGetMetadata() { List customMetadataRecords; + String query = + 'SELECT MasterLabel ' + + 'FROM CustomMetadata__mdt ' + + 'WHERE DeveloperName = \'Name\''; + + // We set the type to Account in order to not be dependent on any Custom Metadata types + CustomMetadataDAOTest.setMetadata( + query, + (List) JSON.deserialize( + '[{"attributes": {"type": "Account"},"MasterLabel":"Label"}]', + List.class + ) + ); + System.Test.startTest(); customMetadataRecords = new CustomMetadataDAO() - .getCustomMetadataRecords( - 'SELECT MasterLabel FROM Custom_Meta_DAO_test__mdt' - ); + .getCustomMetadataRecords(query); System.Test.stopTest(); System.assertEquals( - [SELECT MasterLabel FROM Custom_Meta_DAO_test__mdt].size(), + 1, customMetadataRecords.size(), 'Size should match' ); diff --git a/src/platform-utility/CustomMetadataDAO/layouts/Custom_Meta_DAO_test__mdt-Custom Meta DAO test Layout.layout-meta.xml b/src/platform-utility/CustomMetadataDAO/layouts/Custom_Meta_DAO_test__mdt-Custom Meta DAO test Layout.layout-meta.xml deleted file mode 100644 index 4c7284c..0000000 --- a/src/platform-utility/CustomMetadataDAO/layouts/Custom_Meta_DAO_test__mdt-Custom Meta DAO test Layout.layout-meta.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - false - false - true - - - - Required - MasterLabel - - - Required - DeveloperName - - - - - Edit - IsProtected - - - Required - NamespacePrefix - - - - - - false - false - true - - - - Readonly - CreatedById - - - - - Readonly - LastModifiedById - - - - - - false - false - false - - - - false - false - false - false - false - diff --git a/src/platform-utility/CustomMetadataDAO/objects/Custom_Meta_DAO_test__mdt/Custom_Meta_DAO_test__mdt.object-meta.xml b/src/platform-utility/CustomMetadataDAO/objects/Custom_Meta_DAO_test__mdt/Custom_Meta_DAO_test__mdt.object-meta.xml deleted file mode 100644 index a0c92e6..0000000 --- a/src/platform-utility/CustomMetadataDAO/objects/Custom_Meta_DAO_test__mdt/Custom_Meta_DAO_test__mdt.object-meta.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - Dummy custom metadata type in order to test Custom Meta DAO - - Custom Meta DAO tests - Public - From 23be4d95665cc77c1d0c372fd8fbe06d5b4120f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Tue, 14 Jan 2025 13:29:51 +0100 Subject: [PATCH 07/16] La til since --- .../CustomMetadataDAO/classes/CustomMetadataDAOTest.cls | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls index 0540ae2..8acb472 100644 --- a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls +++ b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls @@ -6,6 +6,10 @@ * * @author Kenneth Soerensen (kenneth.sorensen@nav.com), NAV * @since 0.1.0, August 2024 + * + * @author Tor HÃ¥kon Sigurdsen, Nav + * @since 2025-01-14 - Made tests independent from Custom Metadata types in the orgs + * * @group Custom Metadata DAO * @see CustomMetadataDAO * @see [Get 100% Code Coverage for Salesforce Custom Metadata Based Decisions](https://www.avenga.com/magazine/salesforce-custom-metadata/) From d161e50c18a7856b56e65455f6f7c76674cd77fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Tue, 14 Jan 2025 14:33:13 +0100 Subject: [PATCH 08/16] justering av kommentarer --- .../classes/CustomMetadataDAOTest.cls | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls index 8acb472..062f24a 100644 --- a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls +++ b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls @@ -15,18 +15,20 @@ * @see [Get 100% Code Coverage for Salesforce Custom Metadata Based Decisions](https://www.avenga.com/magazine/salesforce-custom-metadata/) * @example * CustomMetadataDAOTest.setMetadata( - * 'SELECT MasterLable, CustomField__c ' + - * 'FROM CustomMetadata__mdt ' + - * 'WHERE DeveloperName = \'Name\'', - * (List) JSON.deserialize('[{"CustomField__c":"Value"}]', List.class) + * 'SELECT MasterLabel ' + + * 'FROM CustomMetadata__mdt ' + + * 'WHERE DeveloperName = \'Name\'', + * (List) JSON.deserialize( + * '[{"attributes": {"type": "CustomMetadata__mdt"},"MasterLabel":"Value"}]', + * List.class) * ); * * List nameCMList = (List) new CustomMetadataDAO() - * .getCustomMetadataRecords( - * 'SELECT MasterLable, CustomField__c ' + - * 'FROM CustomMetadata__mdt ' + - * 'WHERE DeveloperName = \'Name\'' - * ); + * .getCustomMetadataRecords( + * 'SELECT MasterLable, CustomField__c ' + + * 'FROM CustomMetadata__mdt ' + + * 'WHERE DeveloperName = \'Name\'' + * ); * * CustomMetadata__mdt name; * if (nameCMList.size() > 0) { @@ -75,18 +77,20 @@ public class CustomMetadataDAOTest { * @param records Set Custom Metadata Records for the tests. * @example * CustomMetadataDAOTest.setMetadata( - * 'SELECT MasterLable, CustomField__c ' + - * 'FROM CustomMetadata__mdt ' + - * 'WHERE DeveloperName = \'Name\'', - * (List) JSON.deserialize('[{"CustomField__c":"Value"}]', List.class) + * 'SELECT MasterLabel ' + + * 'FROM CustomMetadata__mdt ' + + * 'WHERE DeveloperName = \'Name\'', + * (List) JSON.deserialize( + * '[{"attributes": {"type": "CustomMetadata__mdt"},"MasterLabel":"Value"}]', + * List.class) * ); * * List nameCMList = (List) new CustomMetadataDAO() - * .getCustomMetadataRecords( - * 'SELECT MasterLable, CustomField__c ' + - * 'FROM CustomMetadata__mdt ' + - * 'WHERE DeveloperName = \'Name\'' - * ); + * .getCustomMetadataRecords( + * 'SELECT MasterLabel ' + + * 'FROM CustomMetadata__mdt ' + + * 'WHERE DeveloperName = \'Name\'' + * ); * * CustomMetadata__mdt name; * if (nameCMList.size() > 0) { From 250f86d440ee67eb8d747131e8d1503f03a5c47d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:04:34 +0100 Subject: [PATCH 09/16] La til with inherited sharing --- .../CustomMetadataDAO/classes/CustomMetadataDAO.cls | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls index a1c713c..a1f344a 100644 --- a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls +++ b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls @@ -25,8 +25,7 @@ * name = nameCMList[0]; * } */ -@SuppressWarnings('PMD.ApexSharingViolations') -public class CustomMetadataDAO { +public inherited sharing class CustomMetadataDAO { /** * @description Is used to set the Custom Metadata Records in Unit Tests. * @@ -62,9 +61,11 @@ public class CustomMetadataDAO { LoggingLevel.DEBUG, 'customMetadataRecordsMap: ' + customMetadataRecordsMap ); + if (!customMetadataRecordsMap.containsKey(query)) { customMetadataRecordsMap.put(query, Database.query(query)); } + return customMetadataRecordsMap.get(query); } } From 2b0c2117a8580e78687ef95783343a7ed7f15e19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Tue, 14 Jan 2025 22:01:56 +0100 Subject: [PATCH 10/16] Fikse mindre skrivefeil --- .../CustomMetadataDAO/classes/CustomMetadataDAO.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls index a1f344a..e6bdd78 100644 --- a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls +++ b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls @@ -15,7 +15,7 @@ * @example * List nameCMList = (List) new CustomMetadataDAO() * .getCustomMetadataRecords( - * 'SELECT MasterLable, CustomField__c ' + + * 'SELECT MasterLabel, CustomField__c ' + * 'FROM CustomMetadata__mdt ' + * 'WHERE DeveloperName = \'Name\'' * ); From a5eec57c0af3da6c38a086ed0d38731acad548f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Tue, 14 Jan 2025 22:12:29 +0100 Subject: [PATCH 11/16] sette test metode til private --- .../CustomMetadataDAO/classes/CustomMetadataDAOTest.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls index 062f24a..3997e2e 100644 --- a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls +++ b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls @@ -41,7 +41,7 @@ public class CustomMetadataDAOTest { * @description Simple test for the getMetadata method. */ @IsTest - static void testGetMetadata() { + private static void testGetMetadata() { List customMetadataRecords; String query = 'SELECT MasterLabel ' + From f22cbc29d249402604c57e42d13f42225c5edcc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Tue, 14 Jan 2025 22:45:31 +0100 Subject: [PATCH 12/16] Endret til ny equals type --- .../CustomMetadataDAO/classes/CustomMetadataDAOTest.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls index 3997e2e..e96ed86 100644 --- a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls +++ b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls @@ -61,7 +61,7 @@ public class CustomMetadataDAOTest { customMetadataRecords = new CustomMetadataDAO() .getCustomMetadataRecords(query); System.Test.stopTest(); - System.assertEquals( + System.Assert.areEqual( 1, customMetadataRecords.size(), 'Size should match' From a201faffd22054f4892eaf30ab265bc050131f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Thu, 16 Jan 2025 10:50:41 +0100 Subject: [PATCH 13/16] Fikset javadoc token Fjernet debug statement --- .../CustomMetadataDAO/classes/CustomMetadataDAO.cls | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls index e6bdd78..032924c 100644 --- a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls +++ b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls @@ -41,7 +41,7 @@ public inherited sharing class CustomMetadataDAO { * @author Kenneth Soerensen (kenneth.sorensen@nav.com), NAV * @since 0.1.0, August 2024 * @param query The SOQL query string to fetch the Custom Metadata Records. - * @returns Return a list of Custom Metadata Records as `List` + * @return Return a list of Custom Metadata Records as `List` * @example * List nameCMList = (List) new CustomMetadataDAO() * .getCustomMetadataRecords( @@ -56,12 +56,6 @@ public inherited sharing class CustomMetadataDAO { * } */ public List getCustomMetadataRecords(String query) { - System.debug(LoggingLevel.DEBUG, 'query: ' + query); - System.debug( - LoggingLevel.DEBUG, - 'customMetadataRecordsMap: ' + customMetadataRecordsMap - ); - if (!customMetadataRecordsMap.containsKey(query)) { customMetadataRecordsMap.put(query, Database.query(query)); } From 566d4d70ec14c07c580c47f6e746e7b58b449802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Thu, 16 Jan 2025 11:33:01 +0100 Subject: [PATCH 14/16] =?UTF-8?q?Legge=20til=20paralell=20kj=C3=B8riung=20?= =?UTF-8?q?av=20tester?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomMetadataDAO/classes/CustomMetadataDAOTest.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls index e96ed86..16b396d 100644 --- a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls +++ b/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls @@ -35,7 +35,7 @@ * name = nameCMList[0]; * } */ -@IsTest +@IsTest(IsParallel=true) public class CustomMetadataDAOTest { /** * @description Simple test for the getMetadata method. From 7429ab9b9b8c549c55fe1174ef36ec8fd34a7ef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Thu, 16 Jan 2025 14:57:51 +0100 Subject: [PATCH 15/16] justere pakke struktur --- .../CustomMetadataDAO/{ => main}/classes/CustomMetadataDAO.cls | 0 .../{ => main}/classes/CustomMetadataDAO.cls-meta.xml | 0 .../{ => test}/classes/CustomMetadataDAOTest.cls | 0 .../{ => test}/classes/CustomMetadataDAOTest.cls-meta.xml | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename src/platform-utility/CustomMetadataDAO/{ => main}/classes/CustomMetadataDAO.cls (100%) rename src/platform-utility/CustomMetadataDAO/{ => main}/classes/CustomMetadataDAO.cls-meta.xml (100%) rename src/platform-utility/CustomMetadataDAO/{ => test}/classes/CustomMetadataDAOTest.cls (100%) rename src/platform-utility/CustomMetadataDAO/{ => test}/classes/CustomMetadataDAOTest.cls-meta.xml (100%) diff --git a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls b/src/platform-utility/CustomMetadataDAO/main/classes/CustomMetadataDAO.cls similarity index 100% rename from src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls rename to src/platform-utility/CustomMetadataDAO/main/classes/CustomMetadataDAO.cls diff --git a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls-meta.xml b/src/platform-utility/CustomMetadataDAO/main/classes/CustomMetadataDAO.cls-meta.xml similarity index 100% rename from src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAO.cls-meta.xml rename to src/platform-utility/CustomMetadataDAO/main/classes/CustomMetadataDAO.cls-meta.xml diff --git a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls b/src/platform-utility/CustomMetadataDAO/test/classes/CustomMetadataDAOTest.cls similarity index 100% rename from src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls rename to src/platform-utility/CustomMetadataDAO/test/classes/CustomMetadataDAOTest.cls diff --git a/src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls-meta.xml b/src/platform-utility/CustomMetadataDAO/test/classes/CustomMetadataDAOTest.cls-meta.xml similarity index 100% rename from src/platform-utility/CustomMetadataDAO/classes/CustomMetadataDAOTest.cls-meta.xml rename to src/platform-utility/CustomMetadataDAO/test/classes/CustomMetadataDAOTest.cls-meta.xml From 41aff2edb67004f345ff6e82cc11b759c1ce1477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20H=C3=A5kon?= <55088511+torhakon@users.noreply.github.com> Date: Fri, 17 Jan 2025 12:07:40 +0100 Subject: [PATCH 16/16] Oppdatert sfdx-project.json fil --- sfdx-project.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sfdx-project.json b/sfdx-project.json index 6168957..0c55dc3 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -17,13 +17,16 @@ "versionNumber": "0.0.0.NEXT" }, { + "versionName": "ver 0.1", + "versionNumber": "0.1.0.NEXT", "path": "src/platform-utility/CustomMetadataDAO", + "default": false, "package": "custom-metadata-dao", - "versionNumber": "0.0.0.NEXT", - "default": false + "versionDescription": "Custom Metadata Data Access Object class used to get access to Custom Metadata objects, and at the same time make it easier to test the various paths the code can take based on the values in the Custom Metadata." } ], "packageAliases": { - "platform-data-model": "0HoKB00000000010AA" + "platform-data-model": "0HoKB00000000010AA", + "custom-metadata-dao": "0HoKB000000000B0AQ" } }