diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.bat b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.bat index 5ee7f710..83244366 100644 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.bat +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.bat @@ -4,7 +4,7 @@ SET COMPOSE_FILE_PATH=%CD%\target\classes\docker\docker-compose.yml IF [%1]==[] ( - echo "Usage: %0 {build_start|stop|purge|tail|reload_share|reload_acs|build_test|test}" + echo "Usage: %0 {build_start|start|stop|purge|tail|reload_share|reload_acs|build_test|test}" GOTO END ) @@ -57,7 +57,7 @@ IF %1==test ( CALL :test GOTO END ) -echo "Usage: %0 {build_start|stop|purge|tail|reload_share|reload_acs|build_test|test}" +echo "Usage: %0 {build_start|start|stop|purge|tail|reload_share|reload_acs|build_test|test}" :END EXIT /B %ERRORLEVEL% diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.sh b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.sh index e2fa1b3e..c8888bc0 100755 --- a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.sh +++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/run.sh @@ -98,5 +98,5 @@ case "${symbol_dollar}1" in test ;; *) - echo "Usage: ${symbol_dollar}0 {build_start|stop|purge|tail|reload_share|reload_acs|build_test|test}" + echo "Usage: ${symbol_dollar}0 {build_start|start|stop|purge|tail|reload_share|reload_acs|build_test|test}" esac \ No newline at end of file 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 208bbe40..b5bf1590 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 @@ -11,12 +11,46 @@ + + docker + + ** + + src/main/assembly ** + + src/main/docker/license + + ** + + + + src/main/docker + + license/** + Dockerfile + disable-webscript-caching-context.xml + + + **/*.properties + + + + src/main/docker + + **/*.properties + + + license/** + Dockerfile + disable-webscript-caching-context.xml + + src/main/java @@ -45,37 +79,8 @@ - src/test/resources - - **/dev-log4j.properties - - - - src/test/resources - - ** - - - **/dev-log4j.properties - - - - src/test/properties - - **/*.properties - - - - src/test/license - - ** - - - - debug.sh - debug.bat run.sh run.bat README.md diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/debug.bat b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/debug.bat deleted file mode 100644 index 70f01448..00000000 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/debug.bat +++ /dev/null @@ -1,9 +0,0 @@ -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: Dev environment startup script for Alfresco Community :: -:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -@echo off - -set MAVEN_OPTS=-Xms256m -Xmx2G - -mvnDebug clean install alfresco:run - diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/debug.sh b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/debug.sh deleted file mode 100755 index c8f887ea..00000000 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/debug.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -MAVEN_OPTS="-Xms256m -Xmx2G" mvnDebug clean install alfresco:run diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/docker/docker-compose.yml b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/docker/docker-compose.yml new file mode 100644 index 00000000..99f9c264 --- /dev/null +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/docker/docker-compose.yml @@ -0,0 +1,54 @@ +#set( $symbol_dollar = '$' ) +version: '3.4' +services: + ${rootArtifactId}-share: + image: ${symbol_dollar}{docker.share.image}:${symbol_dollar}{alfresco.share.version} + environment: + REPO_HOST: ${rootArtifactId}-acs + REPO_PORT: 8080 + ports: + - "${symbol_dollar}{share.port}:8080" + ${rootArtifactId}-acs: + image: alfresco-content-services-${rootArtifactId}:development + build: + dockerfile: ./Dockerfile + context: ../../../target + environment: + CATALINA_OPTS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8888" + ports: + - "${symbol_dollar}{acs.port}:8080" + - "${symbol_dollar}{acs.debug.port}:8888" + volumes: + - alf-acs-volume:/usr/local/tomcat/alf_data + depends_on: + - ${rootArtifactId}-postgres + ${rootArtifactId}-postgres: + image: postgres:9.6 + environment: + POSTGRES_DB: alfresco + POSTGRES_USER: alfresco + POSTGRES_PASSWORD: alfresco + ports: + - "${symbol_dollar}{postgres.port}:5432" + volumes: + - alf-db-volume:/var/lib/postgresql/data + ${rootArtifactId}-ass: + image: alfresco/alfresco-search-services:1.2.0 + environment: + SOLR_ALFRESCO_HOST: ${rootArtifactId}-acs + SOLR_ALFRESCO_PORT: 8080 + SOLR_SOLR_HOST: ${rootArtifactId}-ass + SOLR_SOLR_PORT: 8983 + SOLR_CREATE_ALFRESCO_DEFAULTS: alfresco,archive + ports: + - "8983:8983" + volumes: + - alf-ass-volume:/opt/alfresco-search-services/contentstore + - alf-ass-volume:/opt/alfresco-search-services/data +volumes: + alf-acs-volume: + external: true + alf-db-volume: + external: true + alf-ass-volume: + external: true \ No newline at end of file diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/pom.xml b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/pom.xml index 188d5941..e8d00f36 100644 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/pom.xml +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/pom.xml @@ -5,8 +5,8 @@ ${groupId} ${artifactId} ${version} - ${artifactId} Platform Jar Module - SDK 4.0 - Platform JAR Module (to be included in the alfresco.war) - SDK 4.0 + ${artifactId} Platform/Repository JAR Module + Platform/Repo JAR Module (to be included in the alfresco.war) jar @@ -15,49 +15,91 @@ UTF-8 - - ${session.executionRootDirectory}/alf_data_dev - - org.alfresco - + acs-community-packaging - - 6.0.7-ga - 6.0.c + + + + - + + + alfresco/alfresco-content-repository-community + alfresco/alfresco-share + + + 1.1.6 - - local + + 1.8 + 1.8 + + + 8180 + 9898 + ${artifactId}-acs + 8080 + 8888 + 5555 + + - - 1.7 - 1.7 - + + + + + junit + junit + 4.12 + test + + + org.mockito + mockito-all + 1.9.5 + test + + + org.apache.httpcomponents + httpclient + 4.5.2 + test + + + + + ${alfresco.groupId} + alfresco-remote-api + provided + + + + + org.alfresco.maven + alfresco-rad + ${alfresco.sdk.version} + test + + + + ${alfresco.groupId} ${alfresco.bomDependencyArtifactId} @@ -68,100 +110,218 @@ - - - - ${alfresco.groupId} - alfresco-remote-api - - - - - org.alfresco.maven - alfresco-rad - ${alfresco.sdk.version} - test - - - - - org.springframework - spring-context - test - - - - - org.apache.httpcomponents - httpclient - 4.5.2 - test - - - - - + - org.alfresco.maven.plugin - alfresco-maven-plugin - ${alfresco.sdk.version} + org.apache.maven.plugins + maven-resources-plugin + 3.0.1 + + UTF-8 + + ftl + acp + svg + pdf + doc + docx + xls + xlsx + ppt + pptx + bin + lic + swf + zip + msg + jar + ttf + eot + woff + woff2 + css + ico + psd + js + + - start-alfresco + copy-and-filter-docker-compose-resources + validate - it + copy-resources - pre-integration-test + + ${project.build.outputDirectory}/docker + + + docker + true + + + + + + copy-and-filter-docker-resources + validate + + copy-resources + + + ${project.build.directory} + + + src/main/docker + true + + **/*.jar + **/*.so + + + + + + + copy-and-filter-docker-resources-non-filtered + validate + + copy-resources + + + ${project.build.directory} + + + src/main/docker + false + + **/*.jar + **/*.so + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.0.2 + + + + copy-repo-extension + pre-integration-test + + copy + + + + + ${groupId} + ${artifactId} + ${version} + false + ${project.build.directory}/extensions + + + + + org.alfresco.maven + alfresco-rad + ${alfresco.sdk.version} + false + ${project.build.directory}/extensions + + + junit + junit + 4.12 + false + ${project.build.directory}/extensions + + + org.mockito + mockito-all + 1.9.5 + false + ${project.build.directory}/extensions + + + org.apache.httpcomponents + httpclient + 4.5.2 + false + ${project.build.directory}/extensions + + + + + + + copy-third-party-dependencies + pre-integration-test + + copy-dependencies + + + ${project.build.directory}/extensions + runtime + + + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.19.1 - - true - - false - - true - - - - - - - ${alfresco.groupId} - alfresco-share-services - ${alfresco.share.version} - amp - - - - - ${project.groupId} - ${project.artifactId} - ${project.version} - - + + ${test.acs.endpoint.path} + + + + integration-test + integration-test + + integration-test + + + + verify-test + verify + + verify + + + + + + org.apache.maven.surefire + surefire-junit47 + 2.19.1 + + + Build an AMP if 3rd party libs are needed by the extensions + JARs are the default artifact produced in your modules, if you want to build an amp for each module + you have to enable this plugin and inspect the src/main/assembly.xml file if you want to customize + the layout of your AMP. The end result is that Maven will produce both a JAR file and an AMP with your + module. + --> + ${project.build.outputDirectory} + ${project.build.testOutputDirectory} @@ -224,73 +382,6 @@ true - - - org.apache.maven.plugins - maven-resources-plugin - 3.0.1 - - UTF-8 - - ftl - acp - svg - pdf - doc - docx - xls - xlsx - ppt - pptx - bin - lic - swf - zip - msg - jar - ttf - eot - woff - woff2 - css - ico - psd - js - - - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.19.1 - - - integration-test - integration-test - - integration-test - - - - verify-test - verify - - verify - - - - - - org.apache.maven.surefire - surefire-junit47 - 2.19.1 - - - @@ -307,10 +398,6 @@ true - - - - - + diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/resources/alfresco/module/__artifactId__/module-context.xml b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/resources/alfresco/module/__artifactId__/module-context.xml index f0e3a351..ef2fa267 100644 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/resources/alfresco/module/__artifactId__/module-context.xml +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/main/resources/alfresco/module/__artifactId__/module-context.xml @@ -20,7 +20,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - + + diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/java/platformsample/HelloWorldWebScriptControllerTest.java b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/java/platformsample/HelloWorldWebScriptControllerTest.java new file mode 100644 index 00000000..d0813fe4 --- /dev/null +++ b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/java/platformsample/HelloWorldWebScriptControllerTest.java @@ -0,0 +1,56 @@ +#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 org.junit.Test; +import org.mockito.Mockito; +import org.springframework.extensions.webscripts.*; + +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +/** + * Unit testing the Web Script Java Controller + * + * @author martin.bergljung@alfresco.com + * @version 1.0 + * @since 3.0 + */ +public class HelloWorldWebScriptControllerTest { + + @Test + public void testController() { + WebScriptRequest req = Mockito.mock(WebScriptRequest.class); + Status status = Mockito.mock(Status.class); + Cache cache = Mockito.mock(Cache.class); + + String helloPropName = "fromJava"; + String helloPropExpectedValue = "HelloFromJava"; + HelloWorldWebScript ws = new HelloWorldWebScript(); + Map model = ws.executeImpl(req, status, cache); + + assertNotNull("Response from Web Script Java Controller is null", model); + assertEquals("Incorrect Web Script Java Controller Response", + helloPropExpectedValue, model.get(helloPropName)); + } +} \ No newline at end of file diff --git a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/license/README.md b/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/license/README.md deleted file mode 100644 index 8cefbed8..00000000 --- a/archetypes/alfresco-platform-jar-archetype/src/main/resources/archetype-resources/src/test/license/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Enterprise License location - -Put the Alfresco Enterprise license file in this directory. -It will then be copied into the Platform WAR in the -WEB-INF/classes/alfresco/extension/license directory. - -And then not be part of any other classpaths. - - -