From a6f0b3407428bf87c291c5200172e780afb4fcea Mon Sep 17 00:00:00 2001 From: Andrea Ligios <11974750+andrea-ligios@users.noreply.github.com> Date: Fri, 12 Feb 2021 18:59:56 +0100 Subject: [PATCH 1/7] Sdk 4.2 (#611) * SDK 4.2 - Final adjustments Co-authored-by: gfertuso --- .../working-with-enterprise/README.md | 26 +++++++++++++++++-- pom.xml | 2 ++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/advanced-topics/working-with-enterprise/README.md b/docs/advanced-topics/working-with-enterprise/README.md index 1a3646a7..59f62456 100644 --- a/docs/advanced-topics/working-with-enterprise/README.md +++ b/docs/advanced-topics/working-with-enterprise/README.md @@ -35,10 +35,32 @@ You'll need to update the following settings in the `pom.xml` file: acs-packaging ``` -* Change the Docker ACS image name: +* Change the Docker ACS image name (by also prepending the Enterprise Docker Registry, Quay.io): ``` -alfresco/alfresco-content-repository +quay.io/alfresco/alfresco-content-repository +``` + +In case the desired Platform version is 6.x, you'll also need to deal with the Keystore settings, by either: + +* Removing the keystore settings: + +``` + +``` + +or + +* Adding the Keystore creation to the existing Dockerfile: + +``` +#Add Keystore +ARG CERT_DNAME="CN=Alfresco Repository, OU=Unknown, O=Alfresco Software Ltd., L=Maidenhead, ST=UK, C=GB" +ARG CERT_VALIDITY=36525 +ARG KEYSTORE_PASSWORD=mp6yc0UD9e +ARG KEYSTORE_METADATA_PASSWORD=oKIWzVdEdA +RUN mkdir -p $TOMCAT_DIR/shared/classes/alfresco/extension/keystore +RUN keytool -genseckey -dname "$CERT_DNAME" -validity ${CERT_VALIDITY} -alias metadata -keypass ${KEYSTORE_METADATA_PASSWORD} -keyalg AES -keysize 256 -keystore ${TOMCAT_DIR}/shared/classes/alfresco/extension/keystore/keystore -storetype JCEKS -storepass ${KEYSTORE_PASSWORD} ``` Changing these parameters instructs the project to use the proper maven dependencies and Docker images. diff --git a/pom.xml b/pom.xml index b607f72b..f9b93421 100644 --- a/pom.xml +++ b/pom.xml @@ -327,6 +327,8 @@ + + enterprise-70-tests From ce9160283ea8893648790f636e5dca43af8e3a8d Mon Sep 17 00:00:00 2001 From: Luca Stancapiano Date: Sun, 21 Feb 2021 16:26:22 +0100 Subject: [PATCH 2/7] alfresco-tests integration --- docs/working-with-generated-projects/structure-aio.md | 2 ++ docs/working-with-generated-projects/structure-platform.md | 2 ++ modules/alfresco-rad/pom.xml | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/docs/working-with-generated-projects/structure-aio.md b/docs/working-with-generated-projects/structure-aio.md index 724f661a..4cb82e50 100644 --- a/docs/working-with-generated-projects/structure-aio.md +++ b/docs/working-with-generated-projects/structure-aio.md @@ -60,6 +60,7 @@ my-all-in-one-project │ │ │ └── com │ │ │ └── example │ │ │ └── platformsample +│ │ │ ├── BackupAction.java │ │ │ ├── DemoComponent.java │ │ │ ├── Demo.java │ │ │ └── HelloWorldWebScript.java @@ -98,6 +99,7 @@ my-all-in-one-project │ └── com │ └── example │ └── platformsample +│ ├── SimpleMockTest.java │ └── HelloWorldWebScriptControllerTest.java ├── my-all-in-one-project-share-docker | ├── pom.xml diff --git a/docs/working-with-generated-projects/structure-platform.md b/docs/working-with-generated-projects/structure-platform.md index 1c404b2d..806783fa 100644 --- a/docs/working-with-generated-projects/structure-platform.md +++ b/docs/working-with-generated-projects/structure-platform.md @@ -39,6 +39,7 @@ my-platform-jar-project │   │   └── com │   │   └── example │   │   └── platformsample + │   │   ├── BackupAction.java │   │   ├── Demo.java │   │   ├── DemoComponent.java │   │   └── HelloWorldWebScript.java @@ -78,6 +79,7 @@ my-platform-jar-project └── com └── example └── platformsample + ├── SimpleMockTest.java ├── CustomContentModelIT.java ├── DemoComponentIT.java ├── HelloWorldWebScriptControllerTest.java diff --git a/modules/alfresco-rad/pom.xml b/modules/alfresco-rad/pom.xml index 49dcdf9a..42aa283c 100644 --- a/modules/alfresco-rad/pom.xml +++ b/modules/alfresco-rad/pom.xml @@ -41,6 +41,12 @@ 3.2.17.RELEASE + + it.vige + alfresco-tests + ${alfresco.platform.version}.0 + + junit From 5d5750d71ae6193704d3fd5512a30fe4eaef2683 Mon Sep 17 00:00:00 2001 From: Luca Stancapiano Date: Sun, 21 Feb 2021 16:26:48 +0100 Subject: [PATCH 3/7] alfresco-tests integration --- .../java/platformsample/BackupAction.java | 66 +++++++++++++ .../java/platformsample/SimpleMockTest.java | 98 +++++++++++++++++++ .../java/platformsample/BackupAction.java | 59 +++++++++++ .../java/platformsample/SimpleMockTest.java | 92 +++++++++++++++++ 4 files changed, 315 insertions(+) create mode 100644 archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/main/java/platformsample/BackupAction.java create mode 100644 archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/test/java/platformsample/SimpleMockTest.java create mode 100644 archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/java/platformsample/BackupAction.java create mode 100644 archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/java/platformsample/SimpleMockTest.java diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/main/java/platformsample/BackupAction.java b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/main/java/platformsample/BackupAction.java new file mode 100644 index 00000000..8c2c305f --- /dev/null +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/main/java/platformsample/BackupAction.java @@ -0,0 +1,66 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/** + * Copyright (C) 2017 Alfresco Software Limited. + *

+ * This file is part of the Alfresco SDK project. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ${package}.platformsample; + +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * A basic component that will create a backup of a content. + * Only choose the extension for the backup in your + * alfresco-global.properties + * + * @author Luca Stancapiano + */ +public class BackupAction extends ActionExecuterAbstractBase { + + public static String DOCUMENT_NAME = "documentName"; + + @Autowired + private FileFolderService fileFolderService; + + private String extension; + + @Override + public void executeImpl(Action action, NodeRef actionedUponNodeRef) { + String documentName = (String) action.getParameterValue(DOCUMENT_NAME); + fileFolderService.create(actionedUponNodeRef, documentName + "." + extension, ContentModel.TYPE_CONTENT); + + } + + @Override + protected void addParameterDefinitions(List paramList) { + // TODO Auto-generated method stub + + } + + public void setExtension(String extension) { + this.extension = extension; + } + +} diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/test/java/platformsample/SimpleMockTest.java b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/test/java/platformsample/SimpleMockTest.java new file mode 100644 index 00000000..4d942422 --- /dev/null +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/test/java/platformsample/SimpleMockTest.java @@ -0,0 +1,98 @@ +#set($symbol_pound='#') +#set($symbol_dollar='$') +#set($symbol_escape='\' ) +/** + * Copyright (C) 2017 Alfresco Software Limited. + *

+ * This file is part of the Alfresco SDK project. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ${package}.platformsample; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.mock.test.AbstractForm; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.action.ActionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.namespace.QName; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.tradeshift.test.remote.Remote; +import com.tradeshift.test.remote.RemoteTestRunner; + +import ${package}.platformsample.BackupAction; + +/** + * Unit testing the mock system + * through the backup action + * + * @author Luca Stancapiano + */ +@RunWith(RemoteTestRunner.class) +@Remote(runnerClass = SpringJUnit4ClassRunner.class) +@ContextConfiguration("classpath:test-module-context.xml") +public class SimpleMockTest extends AbstractForm { + + @Autowired + private BackupAction myAction; + + private String documentName = "VALID.pdf"; + + @Before + public void init() { + super.init(); + + // insert a document + Map properties = new HashMap(); + properties.put(ContentModel.PROP_NAME, documentName); + properties.put(ContentModel.PROP_DESCRIPTION, documentName); + String content = new String(com.adobe.xmp.impl.Base64.encode(documentName)); + insertDocument(workspace, documentName, content, properties); + + // verify the document is created + ResultSet docs = serviceRegistry.getSearchService().query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, + SearchService.LANGUAGE_FTS_ALFRESCO, "PATH:\"/" + documentName + "\""); + Assert.assertEquals("A document is created", 1, docs.length()); + Assert.assertTrue("VALID.pdf is created", docs.getNodeRefs().get(0).getId().equals(documentName)); + } + + @Test + public void execute() { + + // execute the injected action + Map parameterValues = new HashMap(); + parameterValues.put(BackupAction.DOCUMENT_NAME, documentName); + Action action = new ActionImpl(null, null, null, parameterValues); + myAction.executeImpl(action, workspace); + + // verify the document is created + ResultSet docs = serviceRegistry.getSearchService().query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, + SearchService.LANGUAGE_FTS_ALFRESCO, "PATH:\"/" + documentName + ".bak\""); + Assert.assertEquals("A backup document is created", 1, docs.length()); + Assert.assertTrue("VALID.pdf.bak is created", docs.getNodeRefs().get(0).getId().equals(documentName + ".bak")); + + } +} diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/java/platformsample/BackupAction.java b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/java/platformsample/BackupAction.java new file mode 100644 index 00000000..c29cab4c --- /dev/null +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/java/platformsample/BackupAction.java @@ -0,0 +1,59 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/** + * Copyright (C) 2017 Alfresco Software Limited. + *

+ * This file is part of the Alfresco SDK project. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ${package}.platformsample; + +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.model.FileFolderService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.beans.factory.annotation.Autowired; + +public class BackupAction extends ActionExecuterAbstractBase { + + public static String DOCUMENT_NAME = "documentName"; + + @Autowired + private FileFolderService fileFolderService; + + private String extension; + + @Override + public void executeImpl(Action action, NodeRef actionedUponNodeRef) { + String documentName = (String) action.getParameterValue(DOCUMENT_NAME); + fileFolderService.create(actionedUponNodeRef, documentName + "." + extension, ContentModel.TYPE_CONTENT); + + } + + @Override + protected void addParameterDefinitions(List paramList) { + // TODO Auto-generated method stub + + } + + public void setExtension(String extension) { + this.extension = extension; + } + +} diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/java/platformsample/SimpleMockTest.java b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/java/platformsample/SimpleMockTest.java new file mode 100644 index 00000000..99a00ded --- /dev/null +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/java/platformsample/SimpleMockTest.java @@ -0,0 +1,92 @@ +#set($symbol_pound='#') +#set($symbol_dollar='$') +#set($symbol_escape='\' ) +/** + * Copyright (C) 2017 Alfresco Software Limited. + *

+ * This file is part of the Alfresco SDK project. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ${package}.platformsample; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.mock.test.AbstractForm; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.action.ActionImpl; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.search.SearchService; +import org.alfresco.service.namespace.QName; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.tradeshift.test.remote.Remote; +import com.tradeshift.test.remote.RemoteTestRunner; + +import ${package}.platformsample.BackupAction; + +@RunWith(RemoteTestRunner.class) +@Remote(runnerClass = SpringJUnit4ClassRunner.class) +@ContextConfiguration("classpath:test-module-context.xml") +public class SimpleMockTest extends AbstractForm { + + @Autowired + private BackupAction myAction; + + private String documentName = "VALID.pdf"; + + @Before + public void init() { + super.init(); + + // insert a document + Map properties = new HashMap(); + properties.put(ContentModel.PROP_NAME, documentName); + properties.put(ContentModel.PROP_DESCRIPTION, documentName); + String content = new String(com.adobe.xmp.impl.Base64.encode(documentName)); + insertDocument(workspace, documentName, content, properties); + + // verify the document is created + ResultSet docs = serviceRegistry.getSearchService().getSearchService().query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, + SearchService.LANGUAGE_FTS_ALFRESCO, "PATH:\"/" + documentName + "\""); + Assert.assertEquals("A document is created", 1, docs.length()); + Assert.assertTrue("VALID.pdf is created", docs.getNodeRefs().get(0).getId().equals(documentName)); + } + + @Test + public void execute() { + + // execute the injected action + Map parameterValues = new HashMap(); + parameterValues.put(BackupAction.DOCUMENT_NAME, documentName); + Action action = new ActionImpl(null, null, null, parameterValues); + myAction.executeImpl(action, workspace); + + // verify the document is created + ResultSet docs = serviceRegistry.getSearchService().getSearchService().query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, + SearchService.LANGUAGE_FTS_ALFRESCO, "PATH:\"/" + documentName + ".bak\""); + Assert.assertEquals("A backup document is created", 1, docs.length()); + Assert.assertTrue("VALID.pdf.bak is created", docs.getNodeRefs().get(0).getId().equals(documentName + ".bak")); + + } +} From 89434daa88c05d447385685c1aa3fb2a07fadf06 Mon Sep 17 00:00:00 2001 From: Luca Stancapiano Date: Mon, 22 Feb 2021 16:25:29 +0100 Subject: [PATCH 4/7] alfresco-tests --- .../src/test/resources/test-module-context.xml | 7 +++++++ .../src/test/resources/test-module-context.xml | 7 +++++++ .../src/test/resources/test-module-context.xml | 7 +++++++ 3 files changed, 21 insertions(+) create mode 100644 archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-integration-tests/src/test/resources/test-module-context.xml create mode 100644 archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/test/resources/test-module-context.xml create mode 100644 archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/resources/test-module-context.xml diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-integration-tests/src/test/resources/test-module-context.xml b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-integration-tests/src/test/resources/test-module-context.xml new file mode 100644 index 00000000..f91da734 --- /dev/null +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-integration-tests/src/test/resources/test-module-context.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/test/resources/test-module-context.xml b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/test/resources/test-module-context.xml new file mode 100644 index 00000000..f91da734 --- /dev/null +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/test/resources/test-module-context.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/resources/test-module-context.xml b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/resources/test-module-context.xml new file mode 100644 index 00000000..f91da734 --- /dev/null +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/resources/test-module-context.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file From c94af25b0ebf56721a7cf91ff97bc2dd751efad1 Mon Sep 17 00:00:00 2001 From: Luca Stancapiano Date: Mon, 22 Feb 2021 16:37:43 +0100 Subject: [PATCH 5/7] alfresco-tests --- .../structure-aio.md | 14 ++++++++------ .../structure-platform.md | 18 ++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/docs/working-with-generated-projects/structure-aio.md b/docs/working-with-generated-projects/structure-aio.md index 4cb82e50..333e9967 100644 --- a/docs/working-with-generated-projects/structure-aio.md +++ b/docs/working-with-generated-projects/structure-aio.md @@ -95,12 +95,14 @@ my-all-in-one-project │ │ └── resources │ │ └── test.html │ └── test -│ └── java -│ └── com -│ └── example -│ └── platformsample -│ ├── SimpleMockTest.java -│ └── HelloWorldWebScriptControllerTest.java +│ ├── java +│ │ └── com +│ │ └── example +│ │ └── platformsample +│ │ ├── SimpleMockTest.java +│ │ └── HelloWorldWebScriptControllerTest.java +│ └── resources +│ └── test-module-context.xml ├── my-all-in-one-project-share-docker | ├── pom.xml │ └── src diff --git a/docs/working-with-generated-projects/structure-platform.md b/docs/working-with-generated-projects/structure-platform.md index 806783fa..12366bfc 100644 --- a/docs/working-with-generated-projects/structure-platform.md +++ b/docs/working-with-generated-projects/structure-platform.md @@ -76,14 +76,16 @@ my-platform-jar-project │   └── sample-process.bpmn20.xml └── test └── java - └── com - └── example - └── platformsample - ├── SimpleMockTest.java - ├── CustomContentModelIT.java - ├── DemoComponentIT.java - ├── HelloWorldWebScriptControllerTest.java - └── HelloWorldWebScriptIT.java + ├── com + │ └── example + │ └── platformsample + │ ├── SimpleMockTest.java + │ ├── CustomContentModelIT.java + │ ├── DemoComponentIT.java + │ ├── HelloWorldWebScriptControllerTest.java + │ └── HelloWorldWebScriptIT.java + └── resources + └── test-module-context.xml ``` From a high level standpoint, we can describe the content of the project as follows: From 1c6ee2bfde8611301b95cd7274a518c5b94c2a7d Mon Sep 17 00:00:00 2001 From: Luca Stancapiano Date: Tue, 23 Feb 2021 17:54:39 +0100 Subject: [PATCH 6/7] alfresco-tests integration --- .../META-INF/maven/archetype-metadata.xml | 6 ++++++ .../__rootArtifactId__-platform/pom.xml | 9 +++++++++ .../__artifactId__/alfresco-global.properties | 1 + .../context/service-context.xml | 7 +++++++ .../java/platformsample/SimpleMockTest.java | 13 ++++++------ .../META-INF/maven/archetype-metadata.xml | 6 ++++++ .../__artifactId__/alfresco-global.properties | 1 + .../context/service-context.xml | 7 +++++++ .../java/platformsample/SimpleMockTest.java | 20 +++++++++++-------- modules/alfresco-rad/pom.xml | 6 ------ 10 files changed, 56 insertions(+), 20 deletions(-) diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetypes/alfresco-allinone-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml index d76717bd..528e3aed 100644 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -47,6 +47,12 @@ **/*-context.xml + + src/test/resources + + **/*-context.xml + + diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/pom.xml b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/pom.xml index ae7b530e..9cf458fc 100644 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/pom.xml +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/pom.xml @@ -17,6 +17,15 @@ + + org.springframework + spring-test + + + it.vige + alfresco-tests + ${alfresco.platform.version}.0 + diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/main/resources/alfresco/module/__artifactId__/alfresco-global.properties b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/main/resources/alfresco/module/__artifactId__/alfresco-global.properties index f566f222..04f01486 100644 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/main/resources/alfresco/module/__artifactId__/alfresco-global.properties +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/main/resources/alfresco/module/__artifactId__/alfresco-global.properties @@ -3,3 +3,4 @@ ## System Administrators can override these values in environment specific configurations in ## alfresco/tomcat/shared/classes/alfresco-global.properties. ## +backup.extension=bak diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/main/resources/alfresco/module/__artifactId__/context/service-context.xml b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/main/resources/alfresco/module/__artifactId__/context/service-context.xml index a3c12c4d..5e72b5d8 100644 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/main/resources/alfresco/module/__artifactId__/context/service-context.xml +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/main/resources/alfresco/module/__artifactId__/context/service-context.xml @@ -40,5 +40,12 @@ + + + ${backup.extension} + + + diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/test/java/platformsample/SimpleMockTest.java b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/test/java/platformsample/SimpleMockTest.java index 4d942422..da91f5ca 100644 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/test/java/platformsample/SimpleMockTest.java +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/src/test/java/platformsample/SimpleMockTest.java @@ -43,11 +43,8 @@ import com.tradeshift.test.remote.Remote; import com.tradeshift.test.remote.RemoteTestRunner; -import ${package}.platformsample.BackupAction; - /** - * Unit testing the mock system - * through the backup action + * Unit testing the mock system through the backup action * * @author Luca Stancapiano */ @@ -76,7 +73,9 @@ public void init() { ResultSet docs = serviceRegistry.getSearchService().query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, "PATH:\"/" + documentName + "\""); Assert.assertEquals("A document is created", 1, docs.length()); - Assert.assertTrue("VALID.pdf is created", docs.getNodeRefs().get(0).getId().equals(documentName)); + String name = (String) serviceRegistry.getNodeService().getProperty(docs.getNodeRefs().get(0), + ContentModel.PROP_NAME); + Assert.assertTrue("VALID.pdf is created", name.equals(documentName)); } @Test @@ -92,7 +91,9 @@ public void execute() { ResultSet docs = serviceRegistry.getSearchService().query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, "PATH:\"/" + documentName + ".bak\""); Assert.assertEquals("A backup document is created", 1, docs.length()); - Assert.assertTrue("VALID.pdf.bak is created", docs.getNodeRefs().get(0).getId().equals(documentName + ".bak")); + String name = (String) serviceRegistry.getNodeService().getProperty(docs.getNodeRefs().get(0), + ContentModel.PROP_NAME); + Assert.assertTrue("VALID.pdf.bak is created", name.equals(documentName + ".bak")); } } diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/archetypes/alfresco-platform-jar-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml index e4f4ad8b..d7184695 100644 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -72,6 +72,12 @@ **/*-context.xml + + src/test/resources + + **/*-context.xml + + diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/resources/alfresco/module/__artifactId__/alfresco-global.properties b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/resources/alfresco/module/__artifactId__/alfresco-global.properties index f566f222..04f01486 100644 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/resources/alfresco/module/__artifactId__/alfresco-global.properties +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/resources/alfresco/module/__artifactId__/alfresco-global.properties @@ -3,3 +3,4 @@ ## System Administrators can override these values in environment specific configurations in ## alfresco/tomcat/shared/classes/alfresco-global.properties. ## +backup.extension=bak diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/resources/alfresco/module/__artifactId__/context/service-context.xml b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/resources/alfresco/module/__artifactId__/context/service-context.xml index a3c12c4d..5e72b5d8 100644 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/resources/alfresco/module/__artifactId__/context/service-context.xml +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/resources/alfresco/module/__artifactId__/context/service-context.xml @@ -40,5 +40,12 @@ + + + ${backup.extension} + + + diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/java/platformsample/SimpleMockTest.java b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/java/platformsample/SimpleMockTest.java index 99a00ded..2f9db42d 100644 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/java/platformsample/SimpleMockTest.java +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/java/platformsample/SimpleMockTest.java @@ -43,8 +43,6 @@ import com.tradeshift.test.remote.Remote; import com.tradeshift.test.remote.RemoteTestRunner; -import ${package}.platformsample.BackupAction; - @RunWith(RemoteTestRunner.class) @Remote(runnerClass = SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:test-module-context.xml") @@ -67,10 +65,13 @@ public void init() { insertDocument(workspace, documentName, content, properties); // verify the document is created - ResultSet docs = serviceRegistry.getSearchService().getSearchService().query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, - SearchService.LANGUAGE_FTS_ALFRESCO, "PATH:\"/" + documentName + "\""); + ResultSet docs = serviceRegistry.getSearchService().getSearchService().query( + StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, + "PATH:\"/" + documentName + "\""); Assert.assertEquals("A document is created", 1, docs.length()); - Assert.assertTrue("VALID.pdf is created", docs.getNodeRefs().get(0).getId().equals(documentName)); + String name = (String) serviceRegistry.getNodeService().getProperty(docs.getNodeRefs().get(0), + ContentModel.PROP_NAME); + Assert.assertTrue("VALID.pdf is created", name.equals(documentName)); } @Test @@ -83,10 +84,13 @@ public void execute() { myAction.executeImpl(action, workspace); // verify the document is created - ResultSet docs = serviceRegistry.getSearchService().getSearchService().query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, - SearchService.LANGUAGE_FTS_ALFRESCO, "PATH:\"/" + documentName + ".bak\""); + ResultSet docs = serviceRegistry.getSearchService().getSearchService().query( + StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, + "PATH:\"/" + documentName + ".bak\""); Assert.assertEquals("A backup document is created", 1, docs.length()); - Assert.assertTrue("VALID.pdf.bak is created", docs.getNodeRefs().get(0).getId().equals(documentName + ".bak")); + String name = (String) serviceRegistry.getNodeService().getProperty(docs.getNodeRefs().get(0), + ContentModel.PROP_NAME); + Assert.assertTrue("VALID.pdf.bak is created", name.equals(documentName + ".bak")); } } diff --git a/modules/alfresco-rad/pom.xml b/modules/alfresco-rad/pom.xml index 42aa283c..49dcdf9a 100644 --- a/modules/alfresco-rad/pom.xml +++ b/modules/alfresco-rad/pom.xml @@ -41,12 +41,6 @@ 3.2.17.RELEASE - - it.vige - alfresco-tests - ${alfresco.platform.version}.0 - - junit From ecba8b606ce81e81098373a695f2cc7fa3db4570 Mon Sep 17 00:00:00 2001 From: Luca Stancapiano Date: Mon, 22 Nov 2021 15:40:19 +0100 Subject: [PATCH 7/7] versin upgrade --- .../archetype-resources/__rootArtifactId__-platform/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/pom.xml b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/pom.xml index 9cf458fc..d4085a26 100644 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/pom.xml +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/__rootArtifactId__-platform/pom.xml @@ -24,7 +24,7 @@ it.vige alfresco-tests - ${alfresco.platform.version}.0 + ${alfresco.platform.version}.8