From fa516ef58fdef0bc684e8ad2fe0a24bacd2b2a34 Mon Sep 17 00:00:00 2001 From: Vedant Mehra Date: Wed, 12 Feb 2025 14:52:44 +0530 Subject: [PATCH 01/10] [MNT-23926] Added Seven Pass algorithm for deletion --- .../alfresco-global.properties | 2 +- .../content-context.xml | 3 + .../cleanser/ContentCleanserSevenPass.java | 64 +++++++++++++ .../ContentCleanserSevenPassUnitTest.java | 94 +++++++++++++++++++ 4 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java create mode 100644 amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties index 13f938dc27..baad5692e9 100644 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties +++ b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties @@ -93,7 +93,7 @@ rm.record.contributors.group.name=RECORD_CONTRIBUTORS # Content cleansing # rm.content.cleansing.enabled=false -rm.content.cleaner=contentCleanser.522022M +rm.content.cleaner=contentCleanser.SevenPass # Indicates whether mandatory properties are checked before completing a record # diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/content-context.xml b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/content-context.xml index d8e94ea0ba..b390f04432 100644 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/content-context.xml +++ b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/content-context.xml @@ -33,5 +33,8 @@ + + + diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java new file mode 100644 index 0000000000..24ad41286e --- /dev/null +++ b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java @@ -0,0 +1,64 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2025 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ + +package org.alfresco.module.org_alfresco_module_rm.content.cleanser; + +import java.io.File; + +import org.alfresco.service.cmr.repository.ContentIOException; + +/** + * DoD 5220-22M Seven Pass data cleansing implementation. + * + */ +public class ContentCleanserSevenPass extends ContentCleanser +{ + /** + * @see org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser#cleanse(java.io.File) + */ + @Override + public void cleanse(File file) + { + // Double check + if (!file.exists() || !file.canWrite()) + { + throw new ContentIOException("Unable to write to file: " + file); + } + + // Overwite file + overwrite(file, overwriteOnes); + overwrite(file, overwriteZeros); + overwrite(file, overwriteRandom); + overwrite(file, overwriteZeros); + overwrite(file, overwriteZeros); + overwrite(file, overwriteOnes); + overwrite(file, overwriteRandom); + + + + } +} \ No newline at end of file diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java new file mode 100644 index 0000000000..46a0c650c4 --- /dev/null +++ b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java @@ -0,0 +1,94 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2025 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ + +package org.alfresco.module.org_alfresco_module_rm.content.cleanser; + +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.File; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.ContentIOException; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; + +/** + * Eager content store cleaner unit test. + * + */ +public class ContentCleanserSevenPassUnitTest extends BaseUnitTest { + @InjectMocks + @Spy + private ContentCleanserSevenPass contentCleanserSevenPass = new ContentCleanserSevenPass() { + /** dummy implementations */ + protected void overwrite(File file, OverwriteOperation overwriteOperation) { + } + }; + + @Mock + private File mockedFile; + + /** + * Given that a file exists When I cleanse it Then the content is overwritten + */ + @Test + public void cleanseFile() { + when(mockedFile.exists()).thenReturn(true); + when(mockedFile.canWrite()).thenReturn(true); + contentCleanserSevenPass.cleanse(mockedFile); + verify(contentCleanserSevenPass, times(2)).overwrite(mockedFile, contentCleanserSevenPass.overwriteOnes); + verify(contentCleanserSevenPass, times(3)).overwrite(mockedFile, contentCleanserSevenPass.overwriteZeros); + verify(contentCleanserSevenPass, times(2)).overwrite(mockedFile, contentCleanserSevenPass.overwriteRandom); + + } + + /** + * Given that the file does not exist When I cleanse it Then an exception is + * thrown + */ + @Test(expected = ContentIOException.class) + public void fileDoesNotExist() { + when(mockedFile.exists()).thenReturn(false); + when(mockedFile.canWrite()).thenReturn(true); + contentCleanserSevenPass.cleanse(mockedFile); + } + + /** + * Given that I can not write to the file When I cleanse it Then an exception is + * thrown + */ + @Test(expected = ContentIOException.class) + public void cantWriteToFile() { + when(mockedFile.exists()).thenReturn(true); + when(mockedFile.canWrite()).thenReturn(false); + contentCleanserSevenPass.cleanse(mockedFile); + } +} \ No newline at end of file From 70135ab7711476b1847ed43333f7a2afe7ea05ad Mon Sep 17 00:00:00 2001 From: Vedant Mehra Date: Thu, 13 Feb 2025 11:02:07 +0530 Subject: [PATCH 02/10] fixed pre commit issues --- .../rm-community-repo/.factorypath | 304 +++++++++++++++++ .../cleanser/ContentCleanserSevenPass.java | 2 +- .../ContentCleanserSevenPassUnitTest.java | 3 +- amps/share-services/.factorypath | 300 +++++++++++++++++ core/.factorypath | 42 +++ data-model/.factorypath | 146 +++++++++ mmt/.factorypath | 305 ++++++++++++++++++ packaging/tests/tas-cmis/.factorypath | 135 ++++++++ packaging/tests/tas-restapi/.factorypath | 175 ++++++++++ packaging/war/.factorypath | 305 ++++++++++++++++++ remote-api/.factorypath | 301 +++++++++++++++++ repository/.factorypath | 300 +++++++++++++++++ 12 files changed, 2315 insertions(+), 3 deletions(-) create mode 100644 amps/ags/rm-community/rm-community-repo/.factorypath create mode 100644 amps/share-services/.factorypath create mode 100644 core/.factorypath create mode 100644 data-model/.factorypath create mode 100644 mmt/.factorypath create mode 100644 packaging/tests/tas-cmis/.factorypath create mode 100644 packaging/tests/tas-restapi/.factorypath create mode 100644 packaging/war/.factorypath create mode 100644 remote-api/.factorypath create mode 100644 repository/.factorypath diff --git a/amps/ags/rm-community/rm-community-repo/.factorypath b/amps/ags/rm-community/rm-community-repo/.factorypath new file mode 100644 index 0000000000..5f0df56518 --- /dev/null +++ b/amps/ags/rm-community/rm-community-repo/.factorypath @@ -0,0 +1,304 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java index 24ad41286e..d9d28188fe 100644 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java +++ b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java @@ -49,7 +49,7 @@ public class ContentCleanserSevenPass extends ContentCleanser throw new ContentIOException("Unable to write to file: " + file); } - // Overwite file + //Overwite file overwrite(file, overwriteOnes); overwrite(file, overwriteZeros); overwrite(file, overwriteRandom); diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java index 46a0c650c4..886d686b2a 100644 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java +++ b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java @@ -24,7 +24,6 @@ * along with Alfresco. If not, see . * #L% */ - package org.alfresco.module.org_alfresco_module_rm.content.cleanser; import static org.mockito.Mockito.times; @@ -61,7 +60,7 @@ public class ContentCleanserSevenPassUnitTest extends BaseUnitTest { */ @Test public void cleanseFile() { - when(mockedFile.exists()).thenReturn(true); + when(mockedFile.exists()).thenReturn(true) ; when(mockedFile.canWrite()).thenReturn(true); contentCleanserSevenPass.cleanse(mockedFile); verify(contentCleanserSevenPass, times(2)).overwrite(mockedFile, contentCleanserSevenPass.overwriteOnes); diff --git a/amps/share-services/.factorypath b/amps/share-services/.factorypath new file mode 100644 index 0000000000..80b1174cd2 --- /dev/null +++ b/amps/share-services/.factorypath @@ -0,0 +1,300 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/.factorypath b/core/.factorypath new file mode 100644 index 0000000000..66201ef68e --- /dev/null +++ b/core/.factorypath @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data-model/.factorypath b/data-model/.factorypath new file mode 100644 index 0000000000..7c13bf68aa --- /dev/null +++ b/data-model/.factorypath @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mmt/.factorypath b/mmt/.factorypath new file mode 100644 index 0000000000..977ff39027 --- /dev/null +++ b/mmt/.factorypath @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/tests/tas-cmis/.factorypath b/packaging/tests/tas-cmis/.factorypath new file mode 100644 index 0000000000..6f5d6103d3 --- /dev/null +++ b/packaging/tests/tas-cmis/.factorypath @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/tests/tas-restapi/.factorypath b/packaging/tests/tas-restapi/.factorypath new file mode 100644 index 0000000000..388e74df99 --- /dev/null +++ b/packaging/tests/tas-restapi/.factorypath @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/war/.factorypath b/packaging/war/.factorypath new file mode 100644 index 0000000000..2bd9a9b9dc --- /dev/null +++ b/packaging/war/.factorypath @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/remote-api/.factorypath b/remote-api/.factorypath new file mode 100644 index 0000000000..cc911df20e --- /dev/null +++ b/remote-api/.factorypath @@ -0,0 +1,301 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/repository/.factorypath b/repository/.factorypath new file mode 100644 index 0000000000..82dc6a9fd6 --- /dev/null +++ b/repository/.factorypath @@ -0,0 +1,300 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 127912aca9791541d48ff6a2f7aa96ff856e5217 Mon Sep 17 00:00:00 2001 From: Vedant Mehra Date: Thu, 13 Feb 2025 12:26:52 +0530 Subject: [PATCH 03/10] Removed unwanted files from commit --- .../rm-community-repo/.factorypath | 304 ----------------- amps/share-services/.factorypath | 300 ----------------- core/.factorypath | 42 --- data-model/.factorypath | 146 --------- mmt/.factorypath | 305 ------------------ packaging/tests/tas-cmis/.factorypath | 135 -------- packaging/tests/tas-restapi/.factorypath | 175 ---------- packaging/war/.factorypath | 305 ------------------ remote-api/.factorypath | 301 ----------------- repository/.factorypath | 300 ----------------- 10 files changed, 2313 deletions(-) delete mode 100644 amps/ags/rm-community/rm-community-repo/.factorypath delete mode 100644 amps/share-services/.factorypath delete mode 100644 core/.factorypath delete mode 100644 data-model/.factorypath delete mode 100644 mmt/.factorypath delete mode 100644 packaging/tests/tas-cmis/.factorypath delete mode 100644 packaging/tests/tas-restapi/.factorypath delete mode 100644 packaging/war/.factorypath delete mode 100644 remote-api/.factorypath delete mode 100644 repository/.factorypath diff --git a/amps/ags/rm-community/rm-community-repo/.factorypath b/amps/ags/rm-community/rm-community-repo/.factorypath deleted file mode 100644 index 5f0df56518..0000000000 --- a/amps/ags/rm-community/rm-community-repo/.factorypath +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/amps/share-services/.factorypath b/amps/share-services/.factorypath deleted file mode 100644 index 80b1174cd2..0000000000 --- a/amps/share-services/.factorypath +++ /dev/null @@ -1,300 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/core/.factorypath b/core/.factorypath deleted file mode 100644 index 66201ef68e..0000000000 --- a/core/.factorypath +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data-model/.factorypath b/data-model/.factorypath deleted file mode 100644 index 7c13bf68aa..0000000000 --- a/data-model/.factorypath +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mmt/.factorypath b/mmt/.factorypath deleted file mode 100644 index 977ff39027..0000000000 --- a/mmt/.factorypath +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/tests/tas-cmis/.factorypath b/packaging/tests/tas-cmis/.factorypath deleted file mode 100644 index 6f5d6103d3..0000000000 --- a/packaging/tests/tas-cmis/.factorypath +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/tests/tas-restapi/.factorypath b/packaging/tests/tas-restapi/.factorypath deleted file mode 100644 index 388e74df99..0000000000 --- a/packaging/tests/tas-restapi/.factorypath +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/war/.factorypath b/packaging/war/.factorypath deleted file mode 100644 index 2bd9a9b9dc..0000000000 --- a/packaging/war/.factorypath +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/remote-api/.factorypath b/remote-api/.factorypath deleted file mode 100644 index cc911df20e..0000000000 --- a/remote-api/.factorypath +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/repository/.factorypath b/repository/.factorypath deleted file mode 100644 index 82dc6a9fd6..0000000000 --- a/repository/.factorypath +++ /dev/null @@ -1,300 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 85703f42847492a02c7c5388295591101eb280c0 Mon Sep 17 00:00:00 2001 From: Vedant Mehra Date: Thu, 13 Feb 2025 14:41:43 +0530 Subject: [PATCH 04/10] changes for pmd --- .../cleanser/ContentCleanserSevenPass.java | 12 +-- .../ContentCleanserSevenPassUnitTest.java | 93 ++++++++++--------- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java index d9d28188fe..29e48e9d09 100644 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java +++ b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java @@ -38,7 +38,7 @@ import org.alfresco.service.cmr.repository.ContentIOException; public class ContentCleanserSevenPass extends ContentCleanser { /** - * @see org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser#cleanse(java.io.File) + * @ see org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser#cleanse(java.io.File) */ @Override public void cleanse(File file) @@ -48,8 +48,8 @@ public class ContentCleanserSevenPass extends ContentCleanser { throw new ContentIOException("Unable to write to file: " + file); } - - //Overwite file + + // Overwite file overwrite(file, overwriteOnes); overwrite(file, overwriteZeros); overwrite(file, overwriteRandom); @@ -57,8 +57,6 @@ public class ContentCleanserSevenPass extends ContentCleanser overwrite(file, overwriteZeros); overwrite(file, overwriteOnes); overwrite(file, overwriteRandom); - - - + } -} \ No newline at end of file +} diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java index 886d686b2a..826d71506e 100644 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java +++ b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java @@ -32,62 +32,65 @@ import static org.mockito.Mockito.when; import java.io.File; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.ContentIOException; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.ContentIOException; + /** * Eager content store cleaner unit test. * */ -public class ContentCleanserSevenPassUnitTest extends BaseUnitTest { - @InjectMocks - @Spy - private ContentCleanserSevenPass contentCleanserSevenPass = new ContentCleanserSevenPass() { - /** dummy implementations */ - protected void overwrite(File file, OverwriteOperation overwriteOperation) { - } - }; +public class ContentCleanserSevenPassUnitTest extends BaseUnitTest +{ + @InjectMocks + @Spy + private ContentCleanserSevenPass contentCleanserSevenPass = new ContentCleanserSevenPass() { + /** dummy implementations */ + protected void overwrite(File file, OverwriteOperation overwriteOperation) + {} + }; - @Mock - private File mockedFile; + @Mock + private File mockedFile; - /** - * Given that a file exists When I cleanse it Then the content is overwritten - */ - @Test - public void cleanseFile() { - when(mockedFile.exists()).thenReturn(true) ; - when(mockedFile.canWrite()).thenReturn(true); - contentCleanserSevenPass.cleanse(mockedFile); - verify(contentCleanserSevenPass, times(2)).overwrite(mockedFile, contentCleanserSevenPass.overwriteOnes); - verify(contentCleanserSevenPass, times(3)).overwrite(mockedFile, contentCleanserSevenPass.overwriteZeros); - verify(contentCleanserSevenPass, times(2)).overwrite(mockedFile, contentCleanserSevenPass.overwriteRandom); + /** + * Given that a file exists When I cleanse it Then the content is overwritten + */ + @Test + public void cleanseFile() + { + when(mockedFile.exists()).thenReturn(true); + when(mockedFile.canWrite()).thenReturn(true); + contentCleanserSevenPass.cleanse(mockedFile); + verify(contentCleanserSevenPass, times(2)).overwrite(mockedFile, contentCleanserSevenPass.overwriteOnes); + verify(contentCleanserSevenPass, times(3)).overwrite(mockedFile, contentCleanserSevenPass.overwriteZeros); + verify(contentCleanserSevenPass, times(2)).overwrite(mockedFile, contentCleanserSevenPass.overwriteRandom); - } + } - /** - * Given that the file does not exist When I cleanse it Then an exception is - * thrown - */ - @Test(expected = ContentIOException.class) - public void fileDoesNotExist() { - when(mockedFile.exists()).thenReturn(false); - when(mockedFile.canWrite()).thenReturn(true); - contentCleanserSevenPass.cleanse(mockedFile); - } + /** + * Given that the file does not exist When I cleanse it Then an exception is thrown + */ + @Test(expected = ContentIOException.class) + public void fileDoesNotExist() + { + when(mockedFile.exists()).thenReturn(false); + when(mockedFile.canWrite()).thenReturn(true); + contentCleanserSevenPass.cleanse(mockedFile); + } - /** - * Given that I can not write to the file When I cleanse it Then an exception is - * thrown - */ - @Test(expected = ContentIOException.class) - public void cantWriteToFile() { - when(mockedFile.exists()).thenReturn(true); - when(mockedFile.canWrite()).thenReturn(false); - contentCleanserSevenPass.cleanse(mockedFile); - } -} \ No newline at end of file + /** + * Given that I can not write to the file When I cleanse it Then an exception is thrown + */ + @Test(expected = ContentIOException.class) + public void cantWriteToFile() + { + when(mockedFile.exists()).thenReturn(true); + when(mockedFile.canWrite()).thenReturn(false); + contentCleanserSevenPass.cleanse(mockedFile); + } +} From 4a33ad8c3b272aa4efc667d9c8e4153e42c577e3 Mon Sep 17 00:00:00 2001 From: Vedant Mehra Date: Thu, 13 Feb 2025 16:25:47 +0530 Subject: [PATCH 05/10] changes for pmd --- .../content/cleanser/ContentCleanserSevenPassUnitTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java index 826d71506e..c1a9a0f9ef 100644 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java +++ b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java @@ -37,6 +37,7 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; +import org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser.OverwriteOperation; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; import org.alfresco.service.cmr.repository.ContentIOException; @@ -50,6 +51,7 @@ public class ContentCleanserSevenPassUnitTest extends BaseUnitTest @Spy private ContentCleanserSevenPass contentCleanserSevenPass = new ContentCleanserSevenPass() { /** dummy implementations */ + @Override protected void overwrite(File file, OverwriteOperation overwriteOperation) {} }; From 0f5653e2504eb7d70ed1609d0d91ba7338142ffe Mon Sep 17 00:00:00 2001 From: Vedant Mehra Date: Thu, 13 Feb 2025 18:03:54 +0530 Subject: [PATCH 06/10] changes for pmd --- .../content/cleanser/ContentCleanserSevenPass.java | 2 +- .../content/cleanser/ContentCleanserSevenPassUnitTest.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java index 29e48e9d09..1474efbb94 100644 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java +++ b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java @@ -38,7 +38,7 @@ import org.alfresco.service.cmr.repository.ContentIOException; public class ContentCleanserSevenPass extends ContentCleanser { /** - * @ see org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser#cleanse(java.io.File) + * @see org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser#cleanse(java.io.File) */ @Override public void cleanse(File file) diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java index c1a9a0f9ef..3c431414b7 100644 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java +++ b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java @@ -37,7 +37,6 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; -import org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser.OverwriteOperation; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; import org.alfresco.service.cmr.repository.ContentIOException; @@ -51,9 +50,10 @@ public class ContentCleanserSevenPassUnitTest extends BaseUnitTest @Spy private ContentCleanserSevenPass contentCleanserSevenPass = new ContentCleanserSevenPass() { /** dummy implementations */ - @Override protected void overwrite(File file, OverwriteOperation overwriteOperation) - {} + { + // Intentionally left empty + } }; @Mock From 1cb3931f21ec9caad6a603fef8d8e1a0e25d716a Mon Sep 17 00:00:00 2001 From: Vedant Mehra Date: Thu, 13 Feb 2025 19:20:39 +0530 Subject: [PATCH 07/10] changes for pmd --- .../content/cleanser/ContentCleanserSevenPassUnitTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java index 3c431414b7..f5af074bf6 100644 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java +++ b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java @@ -50,6 +50,7 @@ public class ContentCleanserSevenPassUnitTest extends BaseUnitTest @Spy private ContentCleanserSevenPass contentCleanserSevenPass = new ContentCleanserSevenPass() { /** dummy implementations */ + @Override protected void overwrite(File file, OverwriteOperation overwriteOperation) { // Intentionally left empty From a2735539ea29899b3b52385a0f8456a5a832170f Mon Sep 17 00:00:00 2001 From: Vedant Mehra Date: Wed, 19 Feb 2025 15:25:43 +0530 Subject: [PATCH 08/10] changes for review comments --- .../cleanser/ContentCleanserSevenPass.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java index 1474efbb94..728d9f6a5d 100644 --- a/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java +++ b/amps/ags/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPass.java @@ -29,13 +29,11 @@ package org.alfresco.module.org_alfresco_module_rm.content.cleanser; import java.io.File; -import org.alfresco.service.cmr.repository.ContentIOException; - /** * DoD 5220-22M Seven Pass data cleansing implementation. * */ -public class ContentCleanserSevenPass extends ContentCleanser +public class ContentCleanserSevenPass extends ContentCleanser522022M { /** * @see org.alfresco.module.org_alfresco_module_rm.content.cleanser.ContentCleanser#cleanse(java.io.File) @@ -43,16 +41,7 @@ public class ContentCleanserSevenPass extends ContentCleanser @Override public void cleanse(File file) { - // Double check - if (!file.exists() || !file.canWrite()) - { - throw new ContentIOException("Unable to write to file: " + file); - } - - // Overwite file - overwrite(file, overwriteOnes); - overwrite(file, overwriteZeros); - overwrite(file, overwriteRandom); + super.cleanse(file); overwrite(file, overwriteZeros); overwrite(file, overwriteZeros); overwrite(file, overwriteOnes); From 13a83d9e22ee03f1ed00aec3b92ffec9415c4a49 Mon Sep 17 00:00:00 2001 From: Vedant Mehra Date: Wed, 19 Feb 2025 15:29:43 +0530 Subject: [PATCH 09/10] reverting properties file change --- .../module/org_alfresco_module_rm/alfresco-global.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties index baad5692e9..13f938dc27 100644 --- a/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties +++ b/amps/ags/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties @@ -93,7 +93,7 @@ rm.record.contributors.group.name=RECORD_CONTRIBUTORS # Content cleansing # rm.content.cleansing.enabled=false -rm.content.cleaner=contentCleanser.SevenPass +rm.content.cleaner=contentCleanser.522022M # Indicates whether mandatory properties are checked before completing a record # From 157430c0d618d3e25a82de7d0907469443f832cb Mon Sep 17 00:00:00 2001 From: vedantmehra9 Date: Mon, 17 Mar 2025 13:25:29 +0530 Subject: [PATCH 10/10] formatting issue --- .../content/cleanser/ContentCleanserSevenPassUnitTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java index f5af074bf6..8bcd7ca1bc 100644 --- a/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java +++ b/amps/ags/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/content/cleanser/ContentCleanserSevenPassUnitTest.java @@ -48,7 +48,8 @@ public class ContentCleanserSevenPassUnitTest extends BaseUnitTest { @InjectMocks @Spy - private ContentCleanserSevenPass contentCleanserSevenPass = new ContentCleanserSevenPass() { + private ContentCleanserSevenPass contentCleanserSevenPass = new ContentCleanserSevenPass() + { /** dummy implementations */ @Override protected void overwrite(File file, OverwriteOperation overwriteOperation)