Merge branch 'sdk-3.0' into sdk-3.0

This commit is contained in:
Ole Hejlskov 2017-03-23 16:23:05 +01:00 committed by GitHub
commit e302055caf
80 changed files with 4434 additions and 1726 deletions

View File

@ -24,7 +24,7 @@
<activiti.admin.war.artifactId>activiti-admin</activiti.admin.war.artifactId> <!-- This contains the Alfresco Activiti Administrator webapp. You use this to administer and monitor your Alfresco Activiti engines.-->
<!-- The version of the Alfresco Activiti Enterprise Workflow Engine that the customization will run in -->
<activiti.version>1.5.1</activiti.version>
<activiti.version>1.5.3</activiti.version>
<!-- JRebel Hot reloading of classpath stuff and web resource stuff -->
<jrebel.version>1.1.6</jrebel.version>
@ -54,7 +54,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<version>4.12</version>
<scope>test</scope>
</dependency>

View File

@ -1 +1 @@
verify
verify -Dmaven.test.skip=true

View File

@ -1 +1 @@
verify alfresco:run -Dmaven.tomcat.fork=true
install

View File

@ -96,6 +96,44 @@
</fileSet>
</fileSets>
</module>
<module id="integration-tests" name="integration-tests" dir="integration-tests">
<fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/test/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="true">
<directory>src/test/resources</directory>
<includes>
<include>**/dev-log4j.properties</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<directory>src/test/resources</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/dev-log4j.properties</exclude>
</excludes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<directory>src/test/properties</directory>
<includes>
<include>**/*.properties</include>
</includes>
</fileSet>
</fileSets>
</module>
</modules>
<fileSets>
@ -105,6 +143,12 @@
<include>**/dev-log4j.properties</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="true">
<directory>src/test/resources</directory>
<includes>
<include>*hotswap-agent.properties</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<directory>src/test/resources</directory>
<includes>
@ -112,6 +156,7 @@
</includes>
<excludes>
<exclude>**/dev-log4j.properties</exclude>
<exclude>*hotswap-agent.properties</exclude>
</excludes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">

View File

@ -17,13 +17,6 @@
</properties>
<dependencies>
<!-- The main Alfresco Repo dependency for compiling Java code in src/main/java -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-repository</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -3,6 +3,19 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<!--
Note that the Module dependency specified in the configuration section for the Alfresco Maven Plugin
needs to be set to amp if any 3rd party libs should be applied by MMT:
`
<platformModules>
<moduleDependency>
<groupId>${project.groupId}</groupId>
<artifactId>some-platform-jar</artifactId>
<version>${project.version}</version>
<type>amp</type>
</moduleDependency>
-->
<id>build-amp-file</id>
<formats>
@ -25,14 +38,6 @@
</files>
<fileSets>
<!-- Anything in the assembly/lib directory will end up in the /lib directory in the AMP -->
<fileSet>
<directory>src/main/assembly/lib</directory>
<outputDirectory>lib</outputDirectory>
<excludes>
<exclude>README.md</exclude>
</excludes>
</fileSet>
<!-- Anything in the assembly/web directory will end up in the /web directory in the AMP -->
<fileSet>
<directory>src/main/assembly/web</directory>
@ -44,7 +49,9 @@
</fileSet>
</fileSets>
<!-- Include the project artifact (JAR) in the /lib directory in the AMP -->
<!-- Include the project artifact (JAR) in the /lib directory in the AMP, and any 3rd party libraries (JARs)
used by the customization.
-->
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>

View File

@ -1,21 +0,0 @@
# 3rd party libraries (JARs) that should be included in WAR
Put here any 3rd party libraries (JARs) that are needed by customizations,
but that are not part of the out-of-the-box libraries in the *alfresco/WEB-INF/lib*
directory.
**Note**. Module dependency needs to be set to amp for the libs to be applied by MMT:
`
<moduleDependency>
<groupId>${project.groupId}</groupId>
<artifactId>some-platform-jar</artifactId>
<version>${project.version}</version>
<type>amp</type>
</moduleDependency>
`
**Important**. If you need to use a library that is available out-of-the-box, then
include it as a *provided* dependency in the module.

View File

@ -1,6 +1,23 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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;
/**

View File

@ -1,22 +1,23 @@
#set($symbol_pound='#')
#set($symbol_dollar='$')
#set($symbol_escape='\' )
/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
*/
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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.alfresco.repo.module.AbstractModuleComponent;
@ -56,7 +57,7 @@ public class DemoComponent extends AbstractModuleComponent {
protected void executeInternal() throws Throwable {
System.out.println("DemoComponent has been executed");
logger.debug("Test debug logging. Congratulation your JAR Module is working");
logger.info("This is only for information purposed. Better remove me from the log in Production");
logger.info("This is only for information purposes. Better remove me from the log in Production");
}
/**

View File

@ -1,22 +1,23 @@
#set($symbol_pound='#')
#set($symbol_dollar='$')
#set($symbol_escape='\' )
/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
*/
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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.springframework.extensions.webscripts.Cache;

View File

@ -24,15 +24,15 @@
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- A simple class that is initialized by Spring -->
<bean id="${package}.exampleBean" class="${package}.platformsample.Demo" init-method="init" />
<bean id="${package}.Demo" class="${package}.platformsample.Demo" init-method="init" />
<!-- A simple module component that will be executed once.
Note. this module component will only be executed once, and then there will be an entry for it in the Repo DB.
So doing for example $ mvn clean install alfresco:run twice will only execute this component the first time.
You need to remove /alf_data_dev for it to be executed again. -->
<bean id="${package}.exampleComponent" class="${package}.platformsample.DemoComponent" parent="module.baseComponent" >
<bean id="${package}.DemoComponent" class="${package}.platformsample.DemoComponent" parent="module.baseComponent" >
<property name="moduleId" value="${artifactId}" /> <!-- See module.properties -->
<property name="name" value="exampleComponent" />
<property name="name" value="DemoComponent" />
<property name="description" value="A demonstration component" />
<property name="sinceVersion" value="1.0" />
<property name="appliesFromVersion" value="0.99" /> <!-- 1.0 would not work here when using SNAPSHOT version in project -->

View File

@ -73,7 +73,6 @@
<atomic>true</atomic>
<stored>false</stored>
<tokenised>false</tokenised>
<facetable>true</facetable>
</index>
<constraints>
<constraint ref="acme:securityClassificationOptions"/>

View File

@ -0,0 +1,56 @@
#set($symbol_pound='#')
#set($symbol_dollar='$')
#set($symbol_escape='\' )
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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<String, Object> 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));
}
}

View File

@ -3,6 +3,19 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<!--
Note that the Module dependency specified in the configuration section for the Alfresco Maven Plugin
needs to be set to amp if any 3rd party libs should be applied by MMT:
`
<shareModules>
<moduleDependency>
<groupId>${project.groupId}</groupId>
<artifactId>some-share-jar</artifactId>
<version>${project.version}</version>
<type>amp</type>
</moduleDependency>
-->
<id>build-amp-file</id>
<formats>
@ -25,14 +38,6 @@
</files>
<fileSets>
<!-- Anything in the assembly/lib directory will end up in the /lib directory in the AMP -->
<fileSet>
<directory>src/main/assembly/lib</directory>
<outputDirectory>lib</outputDirectory>
<excludes>
<exclude>README.md</exclude>
</excludes>
</fileSet>
<!-- Anything in the assembly/web directory will end up in the /web directory in the AMP -->
<fileSet>
<directory>src/main/assembly/web</directory>
@ -44,7 +49,9 @@
</fileSet>
</fileSets>
<!-- Include the project artifact (JAR) in the /lib directory in the AMP -->
<!-- Include the project artifact (JAR) in the /lib directory in the AMP, and any 3rd party libraries (JARs)
used by the customization.
-->
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>

View File

@ -1,19 +0,0 @@
# 3rd party libraries (JARs) that should be included in WAR
Put here any 3rd party libraries (JARs) that are needed by customizations,
but that are not part of the out-of-the-box libraries in the *share/WEB-INF/lib*
directory.
**Note**. Module dependency needs to be set to amp for the libs to be applied by MMT:
`
<moduleDependency>
<groupId>${project.groupId}</groupId>
<artifactId>some-share-jar</artifactId>
<version>${project.version}</version>
<type>amp</type>
</moduleDependency>
`
**Important**. If you need to use a library that is available out-of-the-box, then
include it as a *provided* dependency in the module.

View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>${artifactId}</artifactId>
<name>Integration Tests Module</name>
<description>Integration Tests module for in-container integration testing - part of AIO - SDK 3</description>
<packaging>jar</packaging> <!-- Note. this just runs Integration Tests, but it needs to be a JAR otherwise
nothing is compiled (i.e. you cannot set it to pom) -->
<parent>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}</artifactId>
<version>${version}</version>
</parent>
<properties>
</properties>
<dependencies>
<!-- Bring in any custom module that should be tested, by default we bring in the Platform JAR module
that is generated for the AIO project -->
<dependency>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}-platform-jar</artifactId>
<version>${version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>jrebel-maven-plugin</artifactId>
<version>${jrebel.version}</version>
<configuration>
<rebelXmlDirectory>${project.build.testOutputDirectory}</rebelXmlDirectory>
</configuration>
</plugin>
<!-- Make sure we attach the tests so we can include them when running -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Runs the integration tests, any class that follows naming convention
"**/IT*.java", "**/*IT.java", and "**/*ITCase.java" will be considered an integration test -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify-test</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.19.1</version>
</dependency>
</dependencies>
</plugin>
<!-- Run Alfresco Tomcat embedded -->
<plugin>
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>alfresco-maven-plugin</artifactId>
<version>${alfresco.sdk.version}</version>
<executions>
<execution>
<id>start-alfresco</id>
<goals>
<goal>it</goal>
</goals>
<phase>pre-integration-test</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,191 @@
#set($symbol_pound='#')
#set($symbol_dollar='$')
#set($symbol_escape='\' )
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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.alfresco.model.ContentModel;
import org.alfresco.rad.test.AbstractAlfrescoIT;
import org.alfresco.rad.test.AlfrescoTestRunner;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.nodelocator.CompanyHomeNodeLocator;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* Integration Test sample for a custom content model.
* See {@link DemoComponentIT} for more info.
*
* @author martin.bergljung@alfresco.com
* @since 3.0
*/
@RunWith(value = AlfrescoTestRunner.class)
public class CustomContentModelIT extends AbstractAlfrescoIT {
private static final String ACME_MODEL_NS = "{http://www.acme.org/model/content/1.0}";
private static final String ACME_MODEL_LOCALNAME = "contentModel";
private static final String ACME_DOCUMENT_TYPE = "document";
private static final String ACME_SECURITY_CLASSIFIED_ASPECT = "securityClassified";
private static final String ACME_DOCUMENT_ID_PROPNAME = "documentId";
@Test
public void testCustomContentModelPresence() {
Collection<QName> allContentModels = getServiceRegistry().getDictionaryService().getAllModels();
QName customContentModelQName = createQName(ACME_MODEL_LOCALNAME);
assertTrue("Custom content model " + customContentModelQName.toString() +
" is not present", allContentModels.contains(customContentModelQName));
}
@Test
public void testCreateAcmeDocument() {
// Create the ACME Doc file
QName type = createQName(ACME_DOCUMENT_TYPE);
String textContent = "Hello World!";
String documentId = "DOC001";
Map<QName, Serializable> nodeProperties = new HashMap<>();
nodeProperties.put(createQName(ACME_DOCUMENT_ID_PROPNAME), documentId);
nodeProperties.put(createQName("securityClassification"), "Company Confidential");
NodeRef nodeRef = createNode("AcmeFile.txt", type, nodeProperties);
addFileContent(nodeRef, textContent);
// Add an Aspect to the file (could be a custom aspect...)
Map<QName, Serializable> aspectProperties = new HashMap<>();
aspectProperties.put(ContentModel.PROP_TITLE, "Some Doc Title");
aspectProperties.put(ContentModel.PROP_DESCRIPTION, "Some Doc Description");
getServiceRegistry().getNodeService().addAspect(nodeRef, ContentModel.ASPECT_TITLED, aspectProperties);
// Assert that the file is created correctly
assertEquals("Invalid type", type, getServiceRegistry().getNodeService().getType(nodeRef));
assertTrue("Missing security aspect",
getServiceRegistry().getNodeService().hasAspect(nodeRef, createQName(ACME_SECURITY_CLASSIFIED_ASPECT)));
assertTrue("Missing titled aspect",
getServiceRegistry().getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_TITLED));
assertEquals("Invalid property value", documentId,
getServiceRegistry().getNodeService().getProperty(nodeRef, createQName(ACME_DOCUMENT_ID_PROPNAME)));
readTextContent(nodeRef).equals(textContent);
// Clean up node
if (nodeRef != null) {
getServiceRegistry().getNodeService().deleteNode(nodeRef);
}
}
/**
* ==================== Helper Methods ============================================================================
*/
/**
* Create a QName for the ACME content model
*
* @param localname the local content model name without namespace specified
* @return the full ACME QName including namespace
*/
private QName createQName(String localname) {
return QName.createQName(ACME_MODEL_NS + localname);
}
/**
* Create a new node, such as a file or a folder, with passed in type and properties
*
* @param name the name of the file or folder
* @param type the content model type
* @param properties the properties from the content model
* @return the Node Reference for the newly created node
*/
private NodeRef createNode(String name, QName type, Map<QName, Serializable> properties) {
NodeRef parentFolderNodeRef = getCompanyHomeNodeRef();
QName associationType = ContentModel.ASSOC_CONTAINS;
QName associationQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
QName.createValidLocalName(name));
properties.put(ContentModel.PROP_NAME, name);
ChildAssociationRef parentChildAssocRef = getServiceRegistry().getNodeService().createNode(
parentFolderNodeRef, associationType, associationQName, type, properties);
return parentChildAssocRef.getChildRef();
}
/**
* Add some text content to a file node
*
* @param nodeRef the node reference for the file that should have some text content added to it
* @param fileContent the text content
*/
private void addFileContent(NodeRef nodeRef, String fileContent) {
boolean updateContentPropertyAutomatically = true;
ContentWriter writer = getServiceRegistry().getContentService().getWriter(nodeRef, ContentModel.PROP_CONTENT,
updateContentPropertyAutomatically);
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.setEncoding("UTF-8");
writer.putContent(fileContent);
}
/**
* Read text content for passed in file Node Reference
*
* @param nodeRef the node reference for a file containing text
* @return the text content
*/
private String readTextContent(NodeRef nodeRef) {
ContentReader reader = getServiceRegistry().getContentService().getReader(nodeRef, ContentModel.PROP_CONTENT);
if (reader == null) {
return ""; // Maybe it was a folder after all
}
InputStream is = reader.getContentInputStream();
try {
return IOUtils.toString(is, "UTF-8");
} catch (IOException ioe) {
throw new RuntimeException(ioe);
} finally {
if (is != null) {
try {
is.close();
} catch (Throwable e) {
e.printStackTrace();
}
}
}
}
/**
* Get the node reference for the /Company Home top folder in Alfresco.
* Use the standard node locator service.
*
* @return the node reference for /Company Home
*/
private NodeRef getCompanyHomeNodeRef() {
return getServiceRegistry().getNodeLocatorService().getNode(CompanyHomeNodeLocator.NAME, null, null);
}
}

View File

@ -0,0 +1,73 @@
#set($symbol_pound='#')
#set($symbol_dollar='$')
#set($symbol_escape='\' )
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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.alfresco.rad.test.AbstractAlfrescoIT;
import org.alfresco.rad.test.AlfrescoTestRunner;
import org.alfresco.rad.test.Remote;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* Integration Test of the DemoComponent using the Alfresco Test Runner.
* The Alfresco Test Runner (i.e. AlfrescoTestRunner.class) will check if it is running in an Alfresco instance,
* if so it will execute normally locally. On the other hand, if it detects no
* Alfresco Spring context, then it will make a call to a custom Web Script that
* will execute this test in the running container remotely. The remote location is
* determined by the @Remote config.
*
* @author martin.bergljung@alfresco.com
* @since 3.0
*/
@RunWith(value = AlfrescoTestRunner.class)
// Specifying the remote endpoint is not required, it
// will default to http://localhost:8080/alfresco if
// not provided. This shows the syntax but simply
// sets the value back to the default value.
@Remote(endpoint = "http://localhost:8080/alfresco")
public class DemoComponentIT extends AbstractAlfrescoIT {
@Test
public void testGetCompanyHome() {
DemoComponent demoComponent = (DemoComponent) getApplicationContext().getBean("${package}.DemoComponent");
NodeRef companyHome = demoComponent.getCompanyHome();
assertNotNull(companyHome);
String companyHomeName = (String) getServiceRegistry().getNodeService().getProperty(
companyHome, ContentModel.PROP_NAME);
assertNotNull(companyHomeName);
assertEquals("Company Home", companyHomeName);
}
@Test
public void testChildNodesCount() {
DemoComponent demoComponent = (DemoComponent) getApplicationContext().getBean("${package}.DemoComponent");
NodeRef companyHome = demoComponent.getCompanyHome();
int childNodeCount = demoComponent.childNodesCount(companyHome);
assertNotNull(childNodeCount);
// There are 7 folders by default under Company Home
assertEquals(7, childNodeCount);
}
}

View File

@ -0,0 +1,75 @@
#set($symbol_pound='#')
#set($symbol_dollar='$')
#set($symbol_escape='\' )
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* Integration Test (IT) for Hello World web script.
*
* @author martin.bergljung@alfresco.com
* @version 1.0
* @since 3.0
*/
public class HelloWorldWebScriptIT {
@Test
public void testWebScriptCall() throws Exception {
String webscriptURL = "http://localhost:8080/alfresco/service/sample/helloworld";
String expectedResponse = "Message: 'Hello from JS!' 'HelloFromJava'";
// Login credentials for Alfresco Repo
CredentialsProvider provider = new BasicCredentialsProvider();
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("admin", "admin");
provider.setCredentials(AuthScope.ANY, credentials);
// Create HTTP Client with credentials
CloseableHttpClient httpclient = HttpClientBuilder.create()
.setDefaultCredentialsProvider(provider)
.build();
// Execute Web Script call
try {
HttpGet httpget = new HttpGet(webscriptURL);
HttpResponse httpResponse = httpclient.execute(httpget);
assertEquals("Incorrect HTTP Response Status",
HttpStatus.SC_OK, httpResponse.getStatusLine().getStatusCode());
HttpEntity entity = httpResponse.getEntity();
assertNotNull("Response from Web Script is null", entity);
assertEquals("Incorrect Web Script Response", expectedResponse, EntityUtils.toString(entity));
} finally {
httpclient.close();
}
}
}

View File

@ -0,0 +1,72 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
# RUN TIME PROPERTIES
# -------------------
########################################################################################################################
# Alfresco configuration for running locally with Enterprise Database, such as SQL Server, Oracle etc
#
# Configuration when running Tomcat embedded from Maven.
# Property values from the POM but it can also be edited here.
########################################################################################################################
dir.root=${alfresco.data.location}
# Alfresco Repo Webapp (alfresco.war) context, ports etc
alfresco.context=alfresco
alfresco.host=localhost
alfresco.port=8080
alfresco.protocol=http
# Alfresco Share Webapp (share.war) context, ports etc
share.context=share
share.host=localhost
share.port=8080
share.protocol=http
index.subsystem.name=solr4
solr.host=localhost
solr.port=8080
solr.secureComms=none
# Don't try and recover any index
index.recovery.mode=NONE
# As we run embedded, we set Lucene
# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon
#index.subsystem.name=buildonly
# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date
# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597
# If you want to enable them (and so full WQS functionality), please also set index.subsystem.name=lucene
wcmqs.dynamicCollectionProcessor.schedule=0 30 2 * * ? 2060
wcmqs.feedbackProcessor.schedule=0 40 2 * * ? 2060
wcmqs.publishQueueProcessor.schedule=0 50 2 * * ? 2060
# Fail or not when there are node integrity checker errors
integrity.failOnError=true
# Alfresco Repository Enterprise Database Configuration, such as SQL Server, Oracle etc
# The Enterprise Driver is brought in via the tomcat7-maven-plugin as a dependency.
db.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
db.url=jdbc:sqlserver://localhost:1433;databaseName=alfrescoaio
db.username=alfresco
db.password=alfresco
db.pool.initial=10
db.pool.max=100
# File servers related properties
# For local runs we disable CIFS and FTP
cifs.enabled=false
ftp.enabled=false

View File

@ -0,0 +1,76 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
# RUN TIME PROPERTIES
# -------------------
########################################################################################################################
# Alfresco configuration for running locally with H2 Database
#
# Configuration when running Tomcat embedded from Maven.
# Property values from the POM but it can also be edited here.
########################################################################################################################
dir.root=${alfresco.data.location}
# Alfresco Repo Webapp (alfresco.war) context, ports etc
alfresco.context=alfresco
alfresco.host=localhost
alfresco.port=8080
alfresco.protocol=http
# Alfresco Share Webapp (share.war) context, ports etc
share.context=share
share.host=localhost
share.port=8080
share.protocol=http
index.subsystem.name=solr4
solr.host=localhost
solr.port=8080
solr.secureComms=none
# Don't try and recover any index
index.recovery.mode=NONE
# As we run embedded, we set Lucene
# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon
#index.subsystem.name=buildonly
# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date
# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597
# If you want to enable them (and so full WQS functionality), please also set index.subsystem.name=lucene
wcmqs.dynamicCollectionProcessor.schedule=0 30 2 * * ? 2060
wcmqs.feedbackProcessor.schedule=0 40 2 * * ? 2060
wcmqs.publishQueueProcessor.schedule=0 50 2 * * ? 2060
# Fail or not when there are node integrity checker errors
integrity.failOnError=true
# Alfresco Repository H2 Database configuration.
# The H2 database implementation and Driver is brought in via the tomcat7-maven-plugin as a dependency.
# The data files for the H2 database will be created in a relative path, such as alf_data_dev/h2_data/alf_dev,
# see alfresco.db.url below.
# For more information about the db parameters see:http://www.h2database.com/html/features.html
db.driver=org.h2.jdbcx.JdbcDataSource
db.url=jdbc:h2:${alfresco.data.location}/h2_data/alf_dev;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;MVCC=FALSE;LOCK_MODE=0
db.username=alfresco
db.password=alfresco
db.pool.initial=10
db.pool.max=100
hibernate.dialect=org.hibernate.dialect.H2Dialect
# File servers related properties
# For local runs we disable CIFS and FTP
cifs.enabled=false
ftp.enabled=false

View File

@ -0,0 +1,72 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
# RUN TIME PROPERTIES
# -------------------
########################################################################################################################
# Alfresco configuration for running locally with MySQL Database
#
# Configuration when running Tomcat embedded from Maven.
# Property values from the POM but it can also be edited here.
########################################################################################################################
dir.root=${alfresco.data.location}
# Alfresco Repo Webapp (alfresco.war) context, ports etc
alfresco.context=alfresco
alfresco.host=localhost
alfresco.port=8080
alfresco.protocol=http
# Alfresco Share Webapp (share.war) context, ports etc
share.context=share
share.host=localhost
share.port=8080
share.protocol=http
index.subsystem.name=solr4
solr.host=localhost
solr.port=8080
solr.secureComms=none
# Don't try and recover any index
index.recovery.mode=NONE
# As we run embedded, we set Lucene
# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon
#index.subsystem.name=buildonly
# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date
# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597
# If you want to enable them (and so full WQS functionality), please also set index.subsystem.name=lucene
wcmqs.dynamicCollectionProcessor.schedule=0 30 2 * * ? 2060
wcmqs.feedbackProcessor.schedule=0 40 2 * * ? 2060
wcmqs.publishQueueProcessor.schedule=0 50 2 * * ? 2060
# Fail or not when there are node integrity checker errors
integrity.failOnError=true
# Alfresco Repository MySQL Database configuration.
# The MySQL Driver is brought in via the tomcat7-maven-plugin as a dependency.
db.driver=org.gjt.mm.mysql.Driver
db.url=jdbc:mysql://localhost:3306/alfrescoaio?useUnicode=yes&characterEncoding=UTF-8
db.username=alfresco
db.password=alfresco
db.pool.initial=10
db.pool.max=100
# File servers related properties
# For local runs we disable CIFS and FTP
cifs.enabled=false
ftp.enabled=false

View File

@ -0,0 +1,72 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
# RUN TIME PROPERTIES
# -------------------
########################################################################################################################
# Alfresco configuration for running locally with PostgreSQL Database
#
# Configuration when running Tomcat embedded from Maven.
# Property values from the POM but it can also be edited here.
########################################################################################################################
dir.root=${alfresco.data.location}
# Alfresco Repo Webapp (alfresco.war) context, ports etc
alfresco.context=alfresco
alfresco.host=localhost
alfresco.port=8080
alfresco.protocol=http
# Alfresco Share Webapp (share.war) context, ports etc
share.context=share
share.host=localhost
share.port=8080
share.protocol=http
index.subsystem.name=solr4
solr.host=localhost
solr.port=8080
solr.secureComms=none
# Don't try and recover any index
index.recovery.mode=NONE
# As we run embedded, we set Lucene
# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon
#index.subsystem.name=buildonly
# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date
# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597
# If you want to enable them (and so full WQS functionality), please also set index.subsystem.name=lucene
wcmqs.dynamicCollectionProcessor.schedule=0 30 2 * * ? 2060
wcmqs.feedbackProcessor.schedule=0 40 2 * * ? 2060
wcmqs.publishQueueProcessor.schedule=0 50 2 * * ? 2060
# Fail or not when there are node integrity checker errors
integrity.failOnError=true
# Alfresco Repository PostgreSQL Database configuration.
# The PostgreSQL Driver is brought in via the tomcat7-maven-plugin as a dependency.
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost:5432/alfrescoaio
db.username=alfresco
db.password=alfresco
db.pool.initial=10
db.pool.max=100
# File servers related properties
# For local runs we disable CIFS and FTP
cifs.enabled=false
ftp.enabled=false

View File

@ -0,0 +1,263 @@
# Set root logger level to error
log4j.rootLogger=error, Console, File
# All outputs currently set to be a ConsoleAppender.
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
# use log4j NDC to replace %x with tenant domain / username
log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n
#log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File.File=alfresco.log
log4j.appender.File.Append=true
log4j.appender.File.DatePattern='.'yyyy-MM-dd
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=%d{yyyy-MM-dd} %d{ABSOLUTE} %-5p [%c] [%t] %m%n
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
# Commented-in loggers will be exposed as JMX MBeans (refer to org.alfresco.repo.admin.Log4JHierarchyInit)
# Hence, generally useful loggers should be listed with at least ERROR level to allow simple runtime
# control of the level via a suitable JMX Console. Also, any other loggers can be added transiently via
# Log4j addLoggerMBean as long as the logger exists and has been loaded.
# Hibernate
log4j.logger.org.hibernate=error
log4j.logger.org.hibernate.util.JDBCExceptionReporter=fatal
log4j.logger.org.hibernate.event.def.AbstractFlushingEventListener=fatal
log4j.logger.org.hibernate.type=warn
log4j.logger.org.hibernate.cfg.SettingsFactory=warn
# Spring
log4j.logger.org.springframework=warn
# Turn off Spring remoting warnings that should really be info or debug.
log4j.logger.org.springframework.remoting.support=error
log4j.logger.org.springframework.util=error
# Axis/WSS4J
log4j.logger.org.apache.axis=info
log4j.logger.org.apache.ws=info
# CXF
log4j.logger.org.apache.cxf=error
# MyFaces
log4j.logger.org.apache.myfaces.util.DebugUtils=info
log4j.logger.org.apache.myfaces.el.VariableResolverImpl=error
log4j.logger.org.apache.myfaces.application.jsp.JspViewHandlerImpl=error
log4j.logger.org.apache.myfaces.taglib=error
# OpenOfficeConnection
log4j.logger.net.sf.jooreports.openoffice.connection=fatal
# log prepared statement cache activity log4j.logger.org.hibernate.ps.PreparedStatementCache=info
# Alfresco
log4j.logger.org.alfresco=error
log4j.logger.org.alfresco.repo.admin=info
log4j.logger.org.alfresco.repo.transaction=warn
log4j.logger.org.alfresco.repo.cache.TransactionalCache=warn
log4j.logger.org.alfresco.repo.model.filefolder=warn
log4j.logger.org.alfresco.repo.tenant=info
log4j.logger.org.alfresco.config=warn
log4j.logger.org.alfresco.config.JndiObjectFactoryBean=warn
log4j.logger.org.alfresco.config.JBossEnabledWebApplicationContext=warn
log4j.logger.org.alfresco.repo.management.subsystems=warn
log4j.logger.org.alfresco.repo.management.subsystems.ChildApplicationContextFactory=info
log4j.logger.org.alfresco.repo.management.subsystems.ChildApplicationContextFactory$ChildApplicationContext=warn
log4j.logger.org.alfresco.repo.security.sync=info
log4j.logger.org.alfresco.repo.security.person=info
log4j.logger.org.alfresco.sample=info
log4j.logger.org.alfresco.web=info
#log4j.logger.org.alfresco.web.app.AlfrescoNavigationHandler=debug
#log4j.logger.org.alfresco.web.ui.repo.component.UIActions=debug
#log4j.logger.org.alfresco.web.ui.repo.tag.PageTag=debug
#log4j.logger.org.alfresco.web.bean.clipboard=debug
log4j.logger.org.alfresco.service.descriptor.DescriptorService=info
#log4j.logger.org.alfresco.web.page=debug
log4j.logger.org.alfresco.repo.importer.ImporterBootstrap=error
#log4j.logger.org.alfresco.repo.importer.ImporterBootstrap=info
log4j.logger.org.alfresco.repo.admin.patch.PatchExecuter=info
log4j.logger.org.alfresco.repo.domain.patch.ibatis.PatchDAOImpl=info
# Specific patches
log4j.logger.org.alfresco.repo.admin.patch.impl.DeploymentMigrationPatch=info
log4j.logger.org.alfresco.repo.version.VersionMigrator=info
log4j.logger.org.alfresco.repo.module.ModuleServiceImpl=info
log4j.logger.org.alfresco.repo.domain.schema.SchemaBootstrap=info
log4j.logger.org.alfresco.repo.admin.ConfigurationChecker=info
log4j.logger.org.alfresco.repo.node.index.AbstractReindexComponent=warn
log4j.logger.org.alfresco.repo.node.index.IndexTransactionTracker=warn
log4j.logger.org.alfresco.repo.node.index.FullIndexRecoveryComponent=info
log4j.logger.org.alfresco.util.OpenOfficeConnectionTester=info
log4j.logger.org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl=warn
log4j.logger.org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor=warn
log4j.logger.org.alfresco.repo.transaction.RetryingTransactionHelper=warn
log4j.logger.org.alfresco.util.transaction.SpringAwareUserTransaction.trace=warn
log4j.logger.org.alfresco.util.AbstractTriggerBean=warn
log4j.logger.org.alfresco.enterprise.repo.cluster=info
log4j.logger.org.alfresco.repo.version.Version2ServiceImpl=warn
#log4j.logger.org.alfresco.web.app.DebugPhaseListener=debug
log4j.logger.org.alfresco.repo.node.db.NodeStringLengthWorker=info
log4j.logger.org.alfresco.repo.workflow=info
# CIFS server debugging
log4j.logger.org.alfresco.smb.protocol=error
#log4j.logger.org.alfresco.smb.protocol.auth=debug
#log4j.logger.org.alfresco.acegi=debug
# FTP server debugging
log4j.logger.org.alfresco.ftp.protocol=error
#log4j.logger.org.alfresco.ftp.server=debug
# WebDAV debugging
#log4j.logger.org.alfresco.webdav.protocol=debug
log4j.logger.org.alfresco.webdav.protocol=info
# NTLM servlet filters
#log4j.logger.org.alfresco.web.app.servlet.NTLMAuthenticationFilter=debug
#log4j.logger.org.alfresco.repo.webdav.auth.NTLMAuthenticationFilter=debug
# Kerberos servlet filters
#log4j.logger.org.alfresco.web.app.servlet.KerberosAuthenticationFilter=debug
#log4j.logger.org.alfresco.repo.webdav.auth.KerberosAuthenticationFilter=debug
# File servers
log4j.logger.org.alfresco.fileserver=warn
# Repo filesystem debug logging
#log4j.logger.org.alfresco.filesys.repo.ContentDiskDriver=debug
# Integrity message threshold - if 'failOnViolation' is off, then WARNINGS are generated
log4j.logger.org.alfresco.repo.node.integrity=ERROR
# Indexer debugging
log4j.logger.org.alfresco.repo.search.Indexer=error
#log4j.logger.org.alfresco.repo.search.Indexer=debug
log4j.logger.org.alfresco.repo.search.impl.lucene.index=error
log4j.logger.org.alfresco.repo.search.impl.lucene.fts.FullTextSearchIndexerImpl=warn
#log4j.logger.org.alfresco.repo.search.impl.lucene.index=DEBUG
# Audit debugging
# log4j.logger.org.alfresco.repo.audit=DEBUG
# log4j.logger.org.alfresco.repo.audit.model=DEBUG
# Property sheet and modelling debugging
# change to error to hide the warnings about missing properties and associations
log4j.logger.alfresco.missingProperties=warn
# Dictionary/Model debugging
log4j.logger.org.alfresco.repo.dictionary=warn
log4j.logger.org.alfresco.repo.dictionary.types.period=warn
# Virtualization Server Registry
log4j.logger.org.alfresco.mbeans.VirtServerRegistry=error
# Spring context runtime property setter
log4j.logger.org.alfresco.util.RuntimeSystemPropertiesSetter=info
# Debugging options for clustering
log4j.logger.org.alfresco.repo.content.ReplicatingContentStore=error
log4j.logger.org.alfresco.repo.content.replication=error
#log4j.logger.org.alfresco.repo.deploy.DeploymentServiceImpl=debug
# Activity service
log4j.logger.org.alfresco.repo.activities=warn
# User usage tracking
log4j.logger.org.alfresco.repo.usage=info
# Sharepoint
log4j.logger.org.alfresco.module.vti=info
# Forms Engine
log4j.logger.org.alfresco.web.config.forms=info
log4j.logger.org.alfresco.web.scripts.forms=info
# CMIS
log4j.logger.org.alfresco.opencmis=error
log4j.logger.org.alfresco.opencmis.AlfrescoCmisServiceInterceptor=error
log4j.logger.org.alfresco.cmis=error
log4j.logger.org.alfresco.cmis.dictionary=warn
log4j.logger.org.apache.chemistry.opencmis=info
log4j.logger.org.apache.chemistry.opencmis.server.impl.browser.CmisBrowserBindingServlet=OFF
log4j.logger.org.apache.chemistry.opencmis.server.impl.atompub.CmisAtomPubServlet=OFF
# IMAP
log4j.logger.org.alfresco.repo.imap=info
# JBPM
# Note: non-fatal errors (eg. logged during job execution) should be handled by Alfresco's retrying transaction handler
log4j.logger.org.jbpm.graph.def.GraphElement=fatal
#log4j.logger.org.alfresco.repo.googledocs=debug
# Web Framework
log4j.logger.org.springframework.extensions.webscripts=info
log4j.logger.org.springframework.extensions.webscripts.ScriptLogger=warn
log4j.logger.org.springframework.extensions.webscripts.ScriptDebugger=off
# Repository
log4j.logger.org.alfresco.repo.web.scripts=warn
log4j.logger.org.alfresco.repo.web.scripts.BaseWebScriptTest=info
log4j.logger.org.alfresco.repo.web.scripts.AlfrescoRhinoScriptDebugger=off
log4j.logger.org.alfresco.repo.jscript=error
log4j.logger.org.alfresco.repo.jscript.ScriptLogger=warn
log4j.logger.org.alfresco.repo.cmis.rest.CMISTest=info
log4j.logger.org.alfresco.repo.domain.schema.script.ScriptBundleExecutorImpl=off
log4j.logger.org.alfresco.repo.domain.schema.script.ScriptExecutorImpl=info
log4j.logger.org.alfresco.repo.search.impl.solr.facet.SolrFacetServiceImpl=info
# Bulk Filesystem Import Tool
log4j.logger.org.alfresco.repo.bulkimport=warn
# Freemarker
# Note the freemarker.runtime logger is used to log non-fatal errors that are handled by Alfresco's retrying transaction handler
log4j.logger.freemarker.runtime=
# Metadata extraction
log4j.logger.org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter=warn
# Reduces PDFont error level due to ALF-7105
log4j.logger.org.apache.pdfbox.pdmodel.font.PDSimpleFont=fatal
log4j.logger.org.apache.pdfbox.pdmodel.font.PDFont=fatal
log4j.logger.org.apache.pdfbox.pdmodel.font.PDCIDFont=fatal
# no index support
log4j.logger.org.alfresco.repo.search.impl.noindex.NoIndexIndexer=fatal
log4j.logger.org.alfresco.repo.search.impl.noindex.NoIndexSearchService=fatal
# lucene index warnings
log4j.logger.org.alfresco.repo.search.impl.lucene.index.IndexInfo=warn
# Warn about RMI socket bind retries.
log4j.logger.org.alfresco.util.remote.server.socket.HostConfigurableSocketFactory=warn
log4j.logger.org.alfresco.repo.usage.RepoUsageMonitor=info
# Authorization
log4j.logger.org.alfresco.enterprise.repo.authorization.AuthorizationService=info
log4j.logger.org.alfresco.enterprise.repo.authorization.AuthorizationsConsistencyMonitor=warn

View File

@ -0,0 +1,63 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<beans>
<!--
To support hot reloading of server side Javascript files in Share, we have to turn on development mode.
This setting will tell the Rhinoscript Processor not to compile and cache the JS files.
Cool, we can now change server side JS files and have the changes picked up,
without having to restart or refresh web scripts.
But… Due to a known bug in the Surf framework (ALF-9970) this will break the admin consoles in Share.
Override this bean and disable javascript compilation so that webscripts can be hot reloaded.
We have changed the 'compile' property from true to false.
-->
<bean id="javaScriptProcessor" class="org.alfresco.repo.jscript.RhinoScriptProcessor" init-method="register">
<property name="name">
<value>javascript</value>
</property>
<property name="extension">
<value>js</value>
</property>
<!-- Do not "compile javascript and cache compiled scripts" -->
<property name="compile">
<value>false</value>
</property>
<!-- allow sharing of sealed scopes for performance -->
<!-- disable to give each script it's own new scope which can be extended -->
<property name="shareSealedScopes">
<value>true</value>
</property>
<property name="scriptService">
<ref bean="scriptService"/>
</property>
<!-- Creates ScriptNodes which require the ServiceRegistry -->
<property name="serviceRegistry">
<ref bean="ServiceRegistry"/>
</property>
<property name="storeUrl">
<value>${spaces.store}</value>
</property>
<property name="storePath">
<value>${spaces.company_home.childname}</value>
</property>
</bean>
</beans>

View File

@ -0,0 +1,54 @@
# Set root logger level to error
log4j.rootLogger=error, Console, File
###### Console appender definition #######
# All outputs currently set to be a ConsoleAppender.
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
# use log4j NDC to replace %x with tenant domain / username
log4j.appender.Console.layout.ConversionPattern=%d{ISO8601} %x %-5p [%c{3}] [%t] %m%n
#log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
###### File appender definition #######
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File.File=share.log
log4j.appender.File.Append=true
log4j.appender.File.DatePattern='.'yyyy-MM-dd
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=%d{yyyy-MM-dd} %d{ABSOLUTE} %-5p [%c] [%t] %m%n
# Spring
log4j.logger.org.springframework=warn
# Turn off Spring remoting warnings that should really be info or debug.
log4j.logger.org.springframework.remoting.support=error
log4j.logger.org.springframework.util=error
# MyFaces
log4j.logger.org.apache.myfaces.util.DebugUtils=info
log4j.logger.org.apache.myfaces.el.VariableResolverImpl=error
log4j.logger.org.apache.myfaces.application.jsp.JspViewHandlerImpl=error
log4j.logger.org.apache.myfaces.taglib=error
# Alfresco
log4j.logger.org.alfresco=error
log4j.logger.org.alfresco.config=warn
log4j.logger.org.alfresco.config.JndiObjectFactoryBean=warn
log4j.logger.org.alfresco.web=info
# Web Framework
log4j.logger.org.springframework.extensions.webscripts=info
log4j.logger.org.springframework.extensions.webscripts.ScriptLogger=warn
log4j.logger.org.springframework.extensions.webscripts.ScriptDebugger=off
# Freemarker
# Note the freemarker.runtime logger is used to log non-fatal errors that are handled by Alfresco's retrying transaction handler
log4j.logger.freemarker.runtime=
#-----------------------------------------------------------------------
# Custom Share module logging goes here...
#-----------------------------------------------------------------------

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Context crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="${solr.home}" override="true"/>
<Environment name="solr/model/dir" type="java.lang.String" value="${solr.model.dir}" override="true"/>
<Environment name="solr/content/dir" type="java.lang.String" value="${solr.content.dir}" override="true"/>
</Context>

View File

@ -37,15 +37,15 @@
<!-- Alfresco Platform and Share webapp versions, these are the original Alfresco webapps that will be
customized and then deployed and run by the tomcat maven plugin when
executing for example $ mvn clean install alfresco:run -->
<alfresco.platform.version>5.2.b-EA</alfresco.platform.version>
<alfresco.share.version>5.2.a-EA</alfresco.share.version>
<alfresco.platform.version>5.2.e</alfresco.platform.version>
<alfresco.share.version>5.2.d</alfresco.share.version>
<!-- Alfresco Surf version, if you change Share version you might need to change Surf version -->
<alfresco.surf.version>6.6</alfresco.surf.version>
<alfresco.surf.version>6.11</alfresco.surf.version>
<!-- Aikau framework version, it is released separately, so it can be useful to be able
to bring in newer versions with bug fixes etc -->
<aikau.version>1.0.85</aikau.version>
<aikau.version>1.0.101.3</aikau.version>
<!-- JRebel Hot reloading of classpath stuff and web resource stuff -->
<jrebel.version>1.1.6</jrebel.version>
@ -59,6 +59,52 @@
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<!-- Libs used in Unit and Integration tests -->
<!-- IMPORTANT - Test dependencies need to be here in the top parent POM as
the Alfresco Maven IT Mojo runs as part of the parent project ... -->
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
<scope>test</scope>
</dependency>
<!-- The main Alfresco Repo dependency for compiling Java code in src/main/java -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-repository</artifactId>
</dependency>
<!-- Bring in Spring Context so we can use ApplicationContext, ApplicationContextAware etc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.17.RELEASE</version>
<scope>test</scope>
</dependency>
<!-- Bring in Alfresco RAD so we get access to AlfrescoTestRunner classes -->
<dependency>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-rad</artifactId>
<version>${alfresco.sdk.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<!-- This will import the dependencyManagement for all artifacts in the selected Alfresco platform.
@ -118,7 +164,14 @@
<build>
<pluginManagement>
<plugins>
<!-- Build an AMP if 3rd party libs are needed by the extensions -->
<!--
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.
-->
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
@ -144,6 +197,7 @@
</dependency>
</dependencies>
</plugin>
-->
<!-- Filter resources in any sub-project with this config -->
<plugin>
@ -191,6 +245,7 @@
</resource>
</resources>
<plugins>
<!-- Filter the test resource files in the AIO parent project, and do property substitutions.
We need this config so this is done before the Alfresco Maven Plugin 'run' is executed. -->
@ -248,6 +303,7 @@
(i.e. alfresco.war)
-->
<platformModules>
<!-- Share Services will be ignored if you are on Platform earlier than 5.1 -->
<moduleDependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-share-services</artifactId>
@ -261,19 +317,21 @@
<artifactId>${artifactId}-platform-jar</artifactId>
<version>${project.version}</version>
</moduleDependency>
<!-- Bring in the integration tests -->
<moduleDependency>
<groupId>${project.groupId}</groupId>
<artifactId>integration-tests</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
</moduleDependency>
</platformModules>
<!--
JARs and AMPs that should be overlayed/applied to the Share WAR (i.e. share.war)
-->
<shareModules>
<moduleDependency>
<!-- Bring in a newer version of Aikau, can coexist with older versions in the
WAR distribution, newest version is picked. -->
<groupId>${alfresco.groupId}</groupId>
<artifactId>aikau</artifactId>
<version>${aikau.version}</version>
</moduleDependency>
<!-- Bring in custom Modules -->
<moduleDependency>
@ -306,10 +364,8 @@
<fallback>all</fallback>
<resources>
<resource>
<!--
Empty resource element marks default configuration. By
default it is placed first in generated configuration.
-->
<directory>${project.build.outputDirectory}</directory>
<directory>${project.build.testOutputDirectory}</directory>
</resource>
</resources>
</classpath>

View File

@ -43,9 +43,6 @@ solr.secureComms=none
# Don't try and recover any index
index.recovery.mode=NONE
# As we run embedded, we set Lucene
# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon
#index.subsystem.name=buildonly
# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date
# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597

View File

@ -43,9 +43,6 @@ solr.secureComms=none
# Don't try and recover any index
index.recovery.mode=NONE
# As we run embedded, we set Lucene
# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon
#index.subsystem.name=buildonly
# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date
# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597

View File

@ -43,9 +43,6 @@ solr.secureComms=none
# Don't try and recover any index
index.recovery.mode=NONE
# As we run embedded, we set Lucene
# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon
#index.subsystem.name=buildonly
# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date
# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597

View File

@ -43,9 +43,6 @@ solr.secureComms=none
# Don't try and recover any index
index.recovery.mode=NONE
# As we run embedded, we set Lucene
# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon
#index.subsystem.name=buildonly
# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date
# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597

View File

@ -0,0 +1,48 @@
# Enable hotswap so that changes in this module will be automatically reloaded
# Watch for changed class files on watchResources path and reload class definition in the running application.
autoHotswap=true
#autoHotswap.port=8000
# Add a directory prior to application classpath (load classes and resources).
#
# This may be useful for example in multi module maven project to load class changes from upstream project
# classes. Set extraClasspath to upstream project compiler output and .class file will have precedence to
# classes from built JAR file.
# i.e. monitor /target/classes
# should work with extraClasspath=${project.build.outputDirectory}
# If not try
extraClasspath=${project.basedir}/${artifactId}-platform-jar/target/classes;${project.basedir}/${artifactId}-platform-jar/target/test-classes;${project.basedir}/integration-tests/target/classes;${project.basedir}/integration-tests/target/test-classes
# Comma separated list of disabled plugins
# Use plugin name - e.g.
# Hotswapper, AnonymousClassPatch, WatchResources, Hibernate, Spring, Jersey2, Jetty, Tomcat,
# ZK, Logback, JSF, Seam, ELResolver, OsgiEquinox, Proxy, WebObjects, Weld, JBossModules, Resteasy, Gae
disabledPlugins=Hibernate,Spring
# Add a directory prior to webapp path (load webapp resources).
#
# Load web application resources (such as HTML, JSP, CSS, ...) from this directory prior to default processing.
# Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp).
extraWebappContext=${project.basedir}/${artifactId}-platform-jar/target/classes/META-INF/resources;
# Load static web resources from different directory.
#
# This setting is dependent on application server plugin(Jetty, Tomcat, JBoss, ...)
webappDir=${project.basedir}/${artifactId}-platform-jar/target/classes/META-INF/resources;
# Watch for changes in a directory (resources only).
#
# Similar to extraClasspath this property adds classpath when searching for resources (not classes).
# While extra classpath just modifies the classloader, this setting does nothing until the resource
# is really changed.
#
# Sometimes it is not possible to point extraClasspath to your i.e. src/main/resources, because there are multiple
# replacements of resources in a building step (maven filtering resource option).
# This setting will leave i.e. src/target/classes as default source for resources, but after the resource is modified
# in src/main/resources, the new changed resource is served instead.
# watchResources=
LOGGER.org.hotswap.agent=DEBUG
#LOGGER.org.hotswap.agent.plugin=TRACE
#LOGGER.org.hotswap.agent.watch=TRACE
#LOGGER.org.hotswap.agent.command=TRACE

View File

@ -0,0 +1,49 @@
# Enable hotswap so that changes in this module will be automatically reloaded
# Watch for changed class files on watchResources path and reload class definition in the running application.
autoHotswap=true
#autoHotswap.port=8000
# Add a directory prior to application classpath (load classes and resources).
#
# This may be useful for example in multi module maven project to load class changes from upstream project
# classes. Set extraClasspath to upstream project compiler output and .class file will have precedence to
# classes from built JAR file.
# i.e. monitor /target/classes
# should work with extraClasspath=${project.build.outputDirectory}
# If not try
extraClasspath=${project.basedir}/${artifactId}-share-jar/target/classes;${project.basedir}/${artifactId}-share-jar/target/test-classes
# Comma separated list of disabled plugins
# Use plugin name - e.g.
# Hotswapper, AnonymousClassPatch, WatchResources, Hibernate, Spring, Jersey2, Jetty, Tomcat,
# ZK, Logback, JSF, Seam, ELResolver, OsgiEquinox, Proxy, WebObjects, Weld, JBossModules, Resteasy, Gae
disabledPlugins=Hibernate,Spring
# Add a directory prior to webapp path (load webapp resources).
#
# Load web application resources (such as HTML, JSP, CSS, ...) from this directory prior to default processing.
# Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp).
extraWebappContext=${project.basedir}/${artifactId}-share-jar/target/classes/META-INF/resources;
# Load static web resources from different directory.
#
# This setting is dependent on application server plugin(Jetty, Tomcat, JBoss, ...)
webappDir=${project.basedir}/${artifactId}-share-jar/target/classes/META-INF/resources;
# Watch for changes in a directory (resources only).
#
# Similar to extraClasspath this property adds classpath when searching for resources (not classes).
# While extra classpath just modifies the classloader, this setting does nothing until the resource
# is really changed.
#
# Sometimes it is not possible to point extraClasspath to your i.e. src/main/resources, because there are multiple
# replacements of resources in a building step (maven filtering resource option).
# This setting will leave i.e. src/target/classes as default source for resources, but after the resource is modified
# in src/main/resources, the new changed resource is served instead.
# watchResources=
LOGGER.org.hotswap.agent=DEBUG
#LOGGER.org.hotswap.agent.plugin=TRACE
#LOGGER.org.hotswap.agent.watch=TRACE
#LOGGER.org.hotswap.agent.command=TRACE

View File

@ -0,0 +1,105 @@
<alfresco-config>
<config evaluator="string-compare" condition="WebFramework">
<web-framework>
<autowire>
<!-- Changing this to 'development' currently breaks the Admin Console.
Instead we make a POST to clear Share dependency caches, see 'clear-caches-refresh-ws' profile. -->
<mode>production</mode> <!-- not really need in the long run, used for YUI - deprecate -->
</autowire>
<!--
We don't need to do this when we have the new refresh mojos in the Alfresco plug-in.
If resource caching has been disabled then all the dependency caches will be cleared
before processing the Aikau jsonModel request...
(i.e. this.dojoDependencyHandler.clearCaches() )
For more information see the Aikau source code: https://github.com/Alfresco/Aikau
-->
<disable-resource-caching>false</disable-resource-caching>
</web-framework>
</config>
<!-- Global config section -->
<config replace="true">
<flags>
<!--
Developer debugging setting to turn on DEBUG mode for client scripts in the browser
-->
<client-debug>true</client-debug>
<!--
LOGGING can always be toggled at runtime when in DEBUG mode (Ctrl, Ctrl, Shift, Shift).
This flag automatically activates logging on page load.
-->
<client-debug-autologging>false</client-debug-autologging>
</flags>
</config>
<!--
Disable CSRF completely for now
It seems Share has issues on 4.2.x with the embedded tomcat and CSRFPolicy
-->
<config evaluator="string-compare" condition="CSRFPolicy" replace="true">
<filter/>
</config>
<!--
Change so it is picked up from property where the Alfresco Repo Webapp is running
(e.g. http://localhost:8080/alfresco)
-->
<config evaluator="string-compare" condition="Remote">
<remote>
<endpoint>
<id>alfresco-noauth</id>
<name>Alfresco - unauthenticated access</name>
<description>Access to Alfresco Repository WebScripts that do not require authentication</description>
<connector-id>alfresco</connector-id>
<endpoint-url>${alfresco.repo.url}/s</endpoint-url>
<identity>none</identity>
</endpoint>
<endpoint>
<id>alfresco</id>
<name>Alfresco - user access</name>
<description>Access to Alfresco Repository WebScripts that require user authentication</description>
<connector-id>alfresco</connector-id>
<endpoint-url>${alfresco.repo.url}/s</endpoint-url>
<identity>user</identity>
</endpoint>
<endpoint>
<id>alfresco-feed</id>
<name>Alfresco Feed</name>
<description>Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet</description>
<connector-id>http</connector-id>
<endpoint-url>${alfresco.repo.url}/s</endpoint-url>
<basic-auth>true</basic-auth>
<identity>user</identity>
</endpoint>
<endpoint>
<id>activiti-admin</id>
<name>Activiti Admin UI - user access</name>
<description>Access to Activiti Admin UI, that requires user authentication</description>
<connector-id>activiti-admin-connector</connector-id>
<endpoint-url>${alfresco.repo.url}/activiti-admin</endpoint-url>
<identity>user</identity>
</endpoint>
<endpoint>
<id>alfresco-api</id>
<parent-id>alfresco</parent-id>
<name>Alfresco Public API - user access</name>
<description>Access to Alfresco Repository Public API that require user authentication.
This makes use of the authentication that is provided by parent 'alfresco' endpoint.</description>
<connector-id>alfresco</connector-id>
<endpoint-url>${alfresco.repo.url}/alfresco/api</endpoint-url>
<identity>user</identity>
</endpoint>
</remote>
</config>
</alfresco-config>

View File

@ -0,0 +1 @@
verify -Dmaven.test.skip=true

View File

@ -1 +1 @@
install alfresco:run -Dmaven.tomcat.fork=true
install

View File

@ -36,9 +36,9 @@
<!-- Alfresco Platform webapp version, this is the original Alfresco webapp that will be
customized and then deployed and run by the tomcat maven plugin when
executing for example $ mvn clean install alfresco:run -->
<alfresco.platform.version>5.2.b-EA</alfresco.platform.version>
<alfresco.platform.version>5.2.e</alfresco.platform.version>
<!-- Alfresco Share version, so we can bring in correct alfresco-share-services artifact -->
<alfresco.share.version>5.2.a-EA</alfresco.share.version>
<alfresco.share.version>5.2.d</alfresco.share.version>
<!-- JRebel Hot reloading of classpath stuff and web resource stuff -->
<jrebel.version>1.1.6</jrebel.version>
@ -76,6 +76,31 @@
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-repository</artifactId>
</dependency>
<!-- Bring in Alfresco RAD so we get access to AlfrescoTestRunner classes -->
<dependency>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-rad</artifactId>
<version>${alfresco.sdk.version}</version>
<scope>test</scope>
</dependency>
<!-- Bring in Spring Context so we can use ApplicationContext, ApplicationContextAware etc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.17.RELEASE</version>
<scope>test</scope>
</dependency>
<!-- Integration tests need httpcomponents to execute tests -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@ -88,6 +113,15 @@
<groupId>org.alfresco.maven.plugin</groupId>
<artifactId>alfresco-maven-plugin</artifactId>
<version>${alfresco.sdk.version}</version>
<executions>
<execution>
<id>start-alfresco</id>
<goals>
<goal>it</goal>
</goals>
<phase>pre-integration-test</phase>
</execution>
</executions>
<configuration>
<!-- Default is to run with a Community edition, change to 'enterprise' if using Enterprise edition -->
<alfrescoEdition>community</alfrescoEdition>
@ -109,12 +143,14 @@
-->
<platformModules>
<!-- This AMP is needed if we are going to access the platform webapp from a Share webapp -->
<!-- Share Services will be ignored if you are on Platform earlier than 5.1 -->
<moduleDependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-share-services</artifactId>
<version>${alfresco.share.version}</version>
<type>amp</type>
</moduleDependency>
<!-- Bring in this JAR project, need to be included here, otherwise resources from META-INF
will not be loaded, such as the test.html page
-->
@ -127,7 +163,14 @@
</configuration>
</plugin>
<!-- Build an AMP if 3rd party libs are needed by the extension -->
<!--
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.
-->
<!--
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
@ -152,6 +195,7 @@
</dependency>
</dependencies>
</plugin>
-->
<!-- Hot reloading with JRebel -->
<plugin>
@ -225,6 +269,38 @@
</nonFilteredFileExtensions>
</configuration>
</plugin>
<!-- Runs the integration tests, any class that follows naming convention
"**/IT*.java", "**/*IT.java", and "**/*ITCase.java" will be considered an integration test -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify-test</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.19.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<resources>
@ -241,6 +317,10 @@
<filtering>true</filtering>
</testResource>
</testResources>
</build>
<!--

View File

@ -1,7 +1,20 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<!--
Note that the Module dependency specified in the configuration section for the Alfresco Maven Plugin
needs to be set to amp if any 3rd party libs should be applied by MMT:
`
<platformModules>
<moduleDependency>
<groupId>${project.groupId}</groupId>
<artifactId>some-platform-jar</artifactId>
<version>${project.version}</version>
<type>amp</type>
</moduleDependency>
-->
<id>build-amp-file</id>
@ -25,14 +38,6 @@
</files>
<fileSets>
<!-- Anything in the assembly/lib directory will end up in the /lib directory in the AMP -->
<fileSet>
<directory>src/main/assembly/lib</directory>
<outputDirectory>lib</outputDirectory>
<excludes>
<exclude>README.md</exclude>
</excludes>
</fileSet>
<!-- Anything in the assembly/web directory will end up in the /web directory in the AMP -->
<fileSet>
<directory>src/main/assembly/web</directory>
@ -44,7 +49,9 @@
</fileSet>
</fileSets>
<!-- Include the project artifact (JAR) in the /lib directory in the AMP -->
<!-- Include the project artifact (JAR) in the /lib directory in the AMP, and any 3rd party libraries (JARs)
used by the customization.
-->
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>

View File

@ -1,21 +0,0 @@
# 3rd party libraries (JARs) that should be included in WAR
Put here any 3rd party libraries (JARs) that are needed by customizations,
but that are not part of the out-of-the-box libraries in the *alfresco/WEB-INF/lib*
directory.
**Note**. Module dependency needs to be set to amp for the libs to be applied by MMT:
`
<moduleDependency>
<groupId>${project.groupId}</groupId>
<artifactId>some-platform-jar</artifactId>
<version>${project.version}</version>
<type>amp</type>
</moduleDependency>
`
**Important**. If you need to use a library that is available out-of-the-box, then
include it as a *provided* dependency in the module.

View File

@ -56,7 +56,7 @@ public class DemoComponent extends AbstractModuleComponent {
protected void executeInternal() throws Throwable {
System.out.println("DemoComponent has been executed");
logger.debug("Test debug logging. Congratulation your JAR Module is working");
logger.info("This is only for information purposed. Better remove me from the log in Production");
logger.info("This is only for information purposes. Better remove me from the log in Production");
}
/**

View File

@ -24,15 +24,15 @@
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- A simple class that is initialized by Spring -->
<bean id="${package}.exampleBean" class="${package}.platformsample.Demo" init-method="init" />
<bean id="${package}.Demo" class="${package}.platformsample.Demo" init-method="init" />
<!-- A simple module component that will be executed once.
Note. this module component will only be executed once, and then there will be an entry for it in the Repo DB.
So doing for example $ mvn clean install alfresco:run twice will only execute this component the first time.
You need to remove /alf_data_dev for it to be executed again. -->
<bean id="${package}.exampleComponent" class="${package}.platformsample.DemoComponent" parent="module.baseComponent" >
<bean id="${package}.DemoComponent" class="${package}.platformsample.DemoComponent" parent="module.baseComponent" >
<property name="moduleId" value="${artifactId}" /> <!-- See module.properties -->
<property name="name" value="exampleComponent" />
<property name="name" value="DemoComponent" />
<property name="description" value="A demonstration component" />
<property name="sinceVersion" value="1.0" />
<property name="appliesFromVersion" value="0.99" /> <!-- 1.0 would not work here when using SNAPSHOT version in project -->

View File

@ -73,7 +73,6 @@
<atomic>true</atomic>
<stored>false</stored>
<tokenised>false</tokenised>
<facetable>true</facetable>
</index>
<constraints>
<constraint ref="acme:securityClassificationOptions"/>

View File

@ -43,9 +43,6 @@ solr.secureComms=none
# Don't try and recover any index
index.recovery.mode=NONE
# As we run embedded, we set Lucene
# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon
#index.subsystem.name=buildonly
# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date
# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597

View File

@ -43,9 +43,6 @@ solr.secureComms=none
# Don't try and recover any index
index.recovery.mode=NONE
# As we run embedded, we set Lucene
# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon
#index.subsystem.name=buildonly
# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date
# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597

View File

@ -43,9 +43,6 @@ solr.secureComms=none
# Don't try and recover any index
index.recovery.mode=NONE
# As we run embedded, we set Lucene
# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon
#index.subsystem.name=buildonly
# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date
# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597

View File

@ -43,9 +43,6 @@ solr.secureComms=none
# Don't try and recover any index
index.recovery.mode=NONE
# As we run embedded, we set Lucene
# TODO: Find a better solution for indexing, as buildonly (embedded Lucene) is deprecated and going to be removed soon
#index.subsystem.name=buildonly
# These jobs seem to require Lucene (Unsupported Operation with Solr) so we disable them / set to future date
# See https://forums.alfresco.com/en/viewtopic.php?f=52&t=41597

View File

@ -0,0 +1,48 @@
# Enable hotswap so that changes in this module will be automatically reloaded
# Watch for changed class files on watchResources path and reload class definition in the running application.
autoHotswap=true
#autoHotswap.port=8000
# Add a directory prior to application classpath (load classes and resources).
#
# This may be useful for example in multi module maven project to load class changes from upstream project
# classes. Set extraClasspath to upstream project compiler output and .class file will have precedence to
# classes from built JAR file.
# i.e. monitor /target/classes
# should work with extraClasspath=${project.build.outputDirectory}
# If not try
extraClasspath=${project.build.outputDirectory};${project.build.testOutputDirectory}
# Comma separated list of disabled plugins
# Use plugin name - e.g.
# Hotswapper, AnonymousClassPatch, WatchResources, Hibernate, Spring, Jersey2, Jetty, Tomcat,
# ZK, Logback, JSF, Seam, ELResolver, OsgiEquinox, Proxy, WebObjects, Weld, JBossModules, Resteasy, Gae
disabledPlugins=Hibernate,Spring
# Add a directory prior to webapp path (load webapp resources).
#
# Load web application resources (such as HTML, JSP, CSS, ...) from this directory prior to default processing.
# Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp).
extraWebappContext=${project.build.outputDirectory}/META-INF/resources
# Load static web resources from different directory.
#
# This setting is dependent on application server plugin(Jetty, Tomcat, JBoss, ...)
webappDir=${project.build.outputDirectory}/META-INF/resources
# Watch for changes in a directory (resources only).
#
# Similar to extraClasspath this property adds classpath when searching for resources (not classes).
# While extra classpath just modifies the classloader, this setting does nothing until the resource
# is really changed.
#
# Sometimes it is not possible to point extraClasspath to your i.e. src/main/resources, because there are multiple
# replacements of resources in a building step (maven filtering resource option).
# This setting will leave i.e. src/target/classes as default source for resources, but after the resource is modified
# in src/main/resources, the new changed resource is served instead.
# watchResources=
LOGGER.org.hotswap.agent=DEBUG
#LOGGER.org.hotswap.agent.plugin=TRACE
#LOGGER.org.hotswap.agent.watch=TRACE
#LOGGER.org.hotswap.agent.command=TRACE

View File

@ -1 +1 @@
verify
verify -Dmaven.test.skip=true

View File

@ -1 +1 @@
verify alfresco:run -Dmaven.tomcat.fork=true
install

View File

@ -22,14 +22,14 @@
<!-- Alfresco Share webapp version, this is the original Alfresco webapp that will be
customized and then deployed and run by the tomcat maven plugin when
executing for example $ mvn clean install alfresco:run -->
<alfresco.share.version>5.2.a-EA</alfresco.share.version>
<alfresco.share.version>5.2.d</alfresco.share.version>
<!-- Alfresco Surf version, if you change Share version you might need to change Surf version -->
<alfresco.surf.version>6.6</alfresco.surf.version>
<alfresco.surf.version>6.11</alfresco.surf.version>
<!-- Aikau framework version, it is released separately, so it can be useful to be able
to bring in newer versions with bug fixes etc -->
<aikau.version>1.0.85</aikau.version>
<aikau.version>1.0.101.3</aikau.version>
<!-- Since alfresco.war (i.e. the Platform/Repository) is already running on port 8080, we run Share.WAR on port 8081.
If Alfresco Platform is not running, then generate a platform-jar-module and start it up. -->

View File

@ -1,7 +1,20 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<!--
Note that the Module dependency specified in the configuration section for the Alfresco Maven Plugin
needs to be set to amp if any 3rd party libs should be applied by MMT:
`
<shareModules>
<moduleDependency>
<groupId>${project.groupId}</groupId>
<artifactId>some-share-jar</artifactId>
<version>${project.version}</version>
<type>amp</type>
</moduleDependency>
-->
<id>build-amp-file</id>
@ -25,14 +38,6 @@
</files>
<fileSets>
<!-- Anything in the assembly/lib directory will end up in the /lib directory in the AMP -->
<fileSet>
<directory>src/main/assembly/lib</directory>
<outputDirectory>lib</outputDirectory>
<excludes>
<exclude>README.md</exclude>
</excludes>
</fileSet>
<!-- Anything in the assembly/web directory will end up in the /web directory in the AMP -->
<fileSet>
<directory>src/main/assembly/web</directory>
@ -44,7 +49,9 @@
</fileSet>
</fileSets>
<!-- Include the project artifact (JAR) in the /lib directory in the AMP -->
<!-- Include the project artifact (JAR) in the /lib directory in the AMP, and any 3rd party libraries (JARs)
used by the customization.
-->
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>

View File

@ -1,19 +0,0 @@
# 3rd party libraries (JARs) that should be included in WAR
Put here any 3rd party libraries (JARs) that are needed by customizations,
but that are not part of the out-of-the-box libraries in the *share/WEB-INF/lib*
directory.
**Note**. Module dependency needs to be set to amp for the libs to be applied by MMT:
`
<moduleDependency>
<groupId>${project.groupId}</groupId>
<artifactId>some-share-jar</artifactId>
<version>${project.version}</version>
<type>amp</type>
</moduleDependency>
`
**Important**. If you need to use a library that is available out-of-the-box, then
include it as a *provided* dependency in the module.

View File

@ -1 +1 @@
verify
verify -Dmaven.test.skip=true

View File

@ -1 +1 @@
verify alfresco:run -Dmaven.tomcat.fork=true
install

View File

@ -5,7 +5,8 @@
<packaging>jar</packaging>
<name>Rapid Application Development Support</name>
<description>SDK module for Rapid Development support</description>
<description>SDK module for Rapid Development support, such as Alfresco JUnit runner</description>
<parent>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-sdk-aggregator</artifactId>
@ -13,116 +14,29 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<properties>
<pgsql.dialect.folder>${project.build.directory}/pg-dialect-tmp</pgsql.dialect.folder>
</properties>
<dependencies>
<!-- Enables JUnit remote testing (using JRebel) -->
<dependency>
<groupId>com.tradeshift</groupId>
<artifactId>junit-remote</artifactId>
<version>3</version>
<type>jar</type>
<exclusions>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- Required to have annotation based remote testing working -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.0.6.RELEASE</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Copied PostgreSQL dialect files to generate H2 dialect files on-the-fly -->
<!--
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>extract-postgres-dialect</id>
<phase>generate-test-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-repository</artifactId>
<version>${alfresco.community.default.version}</version>
<includes>alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/*,alfresco/dbscripts/upgrade/*/org.hibernate.dialect.PostgreSQLDialect/*,alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/*</includes>
<outputDirectory>${pgsql.dialect.folder}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>generate-h2-dialect</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<resources>
<resource>
<directory>${pgsql.dialect.folder}/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect</directory>
<includes>
<include>*</include>
</includes>
<targetPath>alfresco/dbscripts/create/org.hibernate.dialect.H2Dialect</targetPath>
</resource>
<resource>
<directory>${pgsql.dialect.folder}/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect</directory>
<includes>
<include>*</include>
</includes>
<targetPath>alfresco/ibatis/org.hibernate.dialect.H2Dialect</targetPath>
</resource>
Upgrade scripts - does not seem to be picked up, so any changes you would make to them are not picked up...
<resource>
<directory>${pgsql.dialect.folder}/alfresco/dbscripts/upgrade/4.1/org.hibernate.dialect.PostgreSQLDialect</directory>
<includes>
<include>*</include>
</includes>
<targetPath>alfresco/dbscripts/upgrade/4.1/org.hibernate.dialect.H2Dialect</targetPath>
</resource>
<resource>
<directory>${pgsql.dialect.folder}/alfresco/dbscripts/upgrade/4.2/org.hibernate.dialect.PostgreSQLDialect</directory>
<includes>
<include>*</include>
</includes>
<targetPath>alfresco/dbscripts/upgrade/4.2/org.hibernate.dialect.H2Dialect</targetPath>
</resource>
<resource>
<directory>${pgsql.dialect.folder}/alfresco/dbscripts/upgrade/5.0/org.hibernate.dialect.PostgreSQLDialect</directory>
<includes>
<include>*</include>
</includes>
<targetPath>alfresco/dbscripts/upgrade/5.0/org.hibernate.dialect.H2Dialect</targetPath>
</resource>
<!-- Access to org.alfresco.service.ServiceRegistry -->
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-repository</artifactId>
<version>${alfresco.community.default.version}</version>
<scope>provided</scope>
</dependency>
</resources>
</configuration>
</execution>
</executions>
</plugin>
-->
</plugins>
</build>
<!-- Bring in ApplicationContextAware, ApplicationContext etc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.17.RELEASE</version>
</dependency>
<!-- Access to JUnit runner classes -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>
</project>

View File

@ -1,16 +0,0 @@
package org.alfresco.maven.rad;
import com.tradeshift.test.remote.RemoteServer;
public class RemoteRunnerWrapper implements Runnable {
public void run() {
try {
RemoteServer.main(new String []{});
} catch (Exception e) {
System.out.println("Could not start JUnit remoteServer because of: " + e.getMessage());
}
}
}

View File

@ -0,0 +1,69 @@
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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 org.alfresco.rad;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
* This Spring bean is aware of the application context in which
* it is initialized.
*
* @author martin.bergljung@alfresco.com
* @since 3.0
*/
public class SpringContextHolder implements ApplicationContextAware {
/**
* The instance of SpringContextHolder
*/
private static SpringContextHolder springContextHolderInstance;
/**
* The Alfresco Spring Application Context.
*/
private ApplicationContext applicationContext;
/**
* Default constructor.
*/
public SpringContextHolder() {
//System.out.println("Initializing the SpringContextHolder class.");
springContextHolderInstance = this;
}
/**
* Return the singleton instance
*
* @return
*/
public static SpringContextHolder Instance() {
return springContextHolderInstance;
}
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
//System.out.println("Setting current Spring Application Context in SpringContextHolder class.");
this.applicationContext = applicationContext;
}
public ApplicationContext getApplicationContext() {
return applicationContext;
}
}

View File

@ -0,0 +1,89 @@
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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 org.alfresco.rad.test;
import org.alfresco.rad.SpringContextHolder;
import org.alfresco.service.ServiceRegistry;
import org.junit.Rule;
import org.junit.rules.MethodRule;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.Statement;
import org.springframework.context.ApplicationContext;
/**
* Abstract Integration Test class to be used
* by Alfresco Integration Tests. Gives access to
* Alfresco Spring Application context and the
* {@link ServiceRegistry} that should be used when
* accessing Alfresco Services.
*
* @author martin.bergljung@alfresco.com
* @since 3.0
*/
public abstract class AbstractAlfrescoIT {
private ApplicationContext applicationContext = null;
private ServiceRegistry serviceRegistry = null;
/**
* Print the test we are currently running, useful if the test is running remotely
* and we don't see the server logs
*/
@Rule
public MethodRule testAnnouncer = new MethodRule() {
@Override
public Statement apply(Statement base, FrameworkMethod method, Object target) {
System.out.println("Running " + getClassName() + " Integration Test: " + method.getName() + "()");
return base;
}
};
protected String getClassName() {
Class<?> enclosingClass = getClass().getEnclosingClass();
if (enclosingClass != null) {
return enclosingClass.getName();
} else {
return getClass().getName();
}
}
protected ApplicationContext getApplicationContext() {
if (applicationContext == null) {
SpringContextHolder springContextHolder = SpringContextHolder.Instance();
if (springContextHolder != null) {
applicationContext = springContextHolder.getApplicationContext();
}
}
return applicationContext;
}
protected ServiceRegistry getServiceRegistry() {
if (serviceRegistry == null) {
ApplicationContext ctx = getApplicationContext();
if (ctx != null) {
Object bean = ctx.getBean("ServiceRegistry");
if (bean != null && bean instanceof ServiceRegistry) {
serviceRegistry = (ServiceRegistry) bean;
}
}
}
return serviceRegistry;
}
}

View File

@ -0,0 +1,249 @@
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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 org.alfresco.rad.test;
import org.alfresco.rad.SpringContextHolder;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.junit.Ignore;
import org.junit.runner.Description;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.*;
/**
* This is a JUnit test runner that is designed to work with an Alfresco repository.
* It detects if it's executing a test inside of a running Alfresco instance. If that
* is the case the tests are all run normally. If however the test is being run from
* outside the repository, from the maven command line or from an IDE
* such as IntelliJ or STS/Eclipse for example, then instead of running the actual
* test an HTTP request is made to a Web Script in a running Alfresco instance. This
* Web Script runs the test and returns enough information to this class so we can
* emulate having run the test locally.
* <p/>
* By doing this, we are able to create Integration Tests (IT) using standard JUnit
* capabilities. These can then be run from our IDEs with the associated visualizations,
* support for re-running failed tests, etc.
* <p/>
* Integration testing framework donated by Zia Consulting
*
* @author Bindu Wavell <bindu@ziaconsulting.com>
* @author martin.bergljung@alfresco.com (some editing)
* @since 3.0
*/
public class AlfrescoTestRunner extends BlockJUnit4ClassRunner {
public static final String SUCCESS = "SUCCESS";
public static final String FAILURE = "FAILURE";
public AlfrescoTestRunner(Class<?> klass) throws InitializationError {
super(klass);
}
public static String serializableToString(Serializable serializable) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(serializable);
oos.close();
String string = Base64.encodeBase64URLSafeString(baos.toByteArray());
return string;
}
@Override
protected void runChild(FrameworkMethod method, RunNotifier notifier) {
if (areWeRunningInAlfresco()) {
// Just run the test as normally
super.runChild(method, notifier);
} else {
// We are not running in an Alfresco Server, we need to call one and have it execute the test...
Description desc = describeChild(method);
if (method.getAnnotation(Ignore.class) != null) {
notifier.fireTestIgnored(desc);
} else {
callProxiedChild(method, notifier, desc);
}
}
}
/**
* Call a remote Alfresco server and have the test run there.
*
* @param method the test method to run
* @param notifier
* @param desc
*/
protected void callProxiedChild(FrameworkMethod method, RunNotifier notifier, Description desc) {
notifier.fireTestStarted(desc);
String className = method.getMethod().getDeclaringClass().getCanonicalName();
String methodName = method.getName();
if (null != methodName) {
className += "#" + methodName;
}
// Login credentials for Alfresco Repo
// TODO: Maybe configure credentials in props...
CredentialsProvider provider = new BasicCredentialsProvider();
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("admin", "admin");
provider.setCredentials(AuthScope.ANY, credentials);
// Create HTTP Client with credentials
CloseableHttpClient httpclient = HttpClientBuilder.create()
.setDefaultCredentialsProvider(provider)
.build();
// Create the GET Request for the Web Script that will run the test
String testWebScriptUrl = "/service/testing/test.xml?clazz=" + className.replace("#", "%23");
//System.out.println("AlfrescoTestRunner: Invoking Web Script for test execution: " + testWebScriptUrl);
HttpGet get = new HttpGet(getContextRoot(method) + testWebScriptUrl);
try {
// Send proxied request and read response
HttpResponse resp = httpclient.execute(get);
InputStream is = resp.getEntity().getContent();
InputStreamReader ir = new InputStreamReader(is);
BufferedReader br = new BufferedReader(ir);
String body = "";
String line;
while ((line = br.readLine()) != null) {
body += line + "\n";
}
// Process response
if (body.length() > 0) {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = null;
dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(new InputSource(new StringReader(body)));
Element root = doc.getDocumentElement();
NodeList results = root.getElementsByTagName("result");
if (null != results && results.getLength() > 0) {
String result = results.item(0).getFirstChild().getNodeValue();
if (SUCCESS.equals(result)) {
notifier.fireTestFinished(desc);
} else {
boolean failureFired = false;
NodeList throwableNodes = root.getElementsByTagName("throwable");
for (int tid = 0; tid < throwableNodes.getLength(); tid++) {
String throwableBody = null;
Object object = null;
Throwable throwable = null;
throwableBody = throwableNodes.item(tid).getFirstChild().getNodeValue();
if (null != throwableBody) {
try {
object = objectFromString(throwableBody);
} catch (ClassNotFoundException e) {
}
if (null != object && object instanceof Throwable) {
throwable = (Throwable) object;
}
}
if (null == throwable) {
throwable = new Throwable("Unable to process exception body: " + throwableBody);
}
notifier.fireTestFailure(new Failure(desc, throwable));
failureFired = true;
}
if (!failureFired) {
notifier.fireTestFailure(new Failure(desc, new Throwable(
"There was an error but we can't figure out what it was, sorry!")));
}
}
} else {
notifier.fireTestFailure(new Failure(desc, new Throwable(
"Unable to process response for proxied test request: " + body)));
}
} else {
notifier.fireTestFailure(new Failure(desc, new Throwable(
"Attempt to proxy test into running Alfresco instance failed, no response received")));
}
} catch (IOException e) {
notifier.fireTestFailure(new Failure(desc, e));
} catch (ParserConfigurationException e) {
notifier.fireTestFailure(new Failure(desc, e));
} catch (SAXException e) {
notifier.fireTestFailure(new Failure(desc, e));
} finally {
try {
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
protected static Object objectFromString(String string) throws IOException, ClassNotFoundException {
byte[] buffer = Base64.decodeBase64(string);
ObjectInputStream ois = new ObjectInputStream(
new ByteArrayInputStream(buffer));
Object object = ois.readObject();
ois.close();
return object;
}
/**
* Check if we are running this test in an Alfresco server instance.
*
* @return true if we are running in an Alfresco server
*/
protected boolean areWeRunningInAlfresco() {
Object contextHolder = SpringContextHolder.Instance();
return (contextHolder != null);
}
/**
* Check the @Remote config on the test class to see where the
* Alfresco Repo is running
*
* @param method
* @return
*/
protected String getContextRoot(FrameworkMethod method) {
Class<?> declaringClass = method.getMethod().getDeclaringClass();
boolean annotationPresent = declaringClass.isAnnotationPresent(Remote.class);
if (annotationPresent) {
Remote annotation = declaringClass.getAnnotation(Remote.class);
return annotation.endpoint();
}
return "http://localhost:8080/alfresco";
}
}

View File

@ -0,0 +1,43 @@
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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 org.alfresco.rad.test;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* By default the ${@link AlfrescoTestRunner} will attempt to find a
* running Alfresco instance at http://localhost:8080/alfresco
* This annotation can be applied to a test class to have the
* proxy calls go to a different host/port.
* <p/>
* Integration testing framework donated by Zia Consulting.
*
* @author Bindu Wavell <bindu@ziaconsulting.com>
* @since 3.0
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Remote {
String endpoint() default "http://localhost:8080/alfresco";
}

View File

@ -0,0 +1,154 @@
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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 org.alfresco.rad.test;
import org.alfresco.error.AlfrescoRuntimeException;
import org.junit.runner.JUnitCore;
import org.junit.runner.Request;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* This Web Script works in consort with the ${@link AlfrescoTestRunner}. When a test is run from an IDE or
* command line, the Alfresco test runner sends a proxied request to perform the test to this script. This runs
* the test and wraps the results up so that the test initiator can be fooled into thinking they are
* running the tests locally.
* <p/>
* Integration testing framework donated by Zia Consulting.
*
* @author Bindu Wavell <bindu@ziaconsulting.com>
* @author martin.bergljung@alfresco.com (some editing)
* @since 3.0
*/
public class RunTestWebScript extends DeclarativeWebScript {
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
System.out.println("RunTestWebScript: Start executing ...");
String result = AlfrescoTestRunner.FAILURE;
String clazzAndMethod = null;
String clazz = null; // Test class
String method = null; // Test method
Result junitRunnerResult = null;
// Example invocation:
// /service/testing/test.xml?clazz=org.alfresco.test.platformsample.DemoComponentIT%23testChildNodesCount
// First, try and get the test class, including method, from a template var, i.e. /clazz/{class%23method}
clazzAndMethod = req.getServiceMatch().getTemplateVars().get("clazz");
if (clazzAndMethod == null) {
// Not found in template var, try parameter, i.e. ?clazz={class%23method}
clazzAndMethod = req.getParameter("clazz");
}
System.out.println("RunTestWebScript: clazzAndMethod = " + clazzAndMethod);
// Do we have a test class and method now?
if (clazzAndMethod == null) {
// No, set class and method as not provided
clazzAndMethod = "not provided";
} else {
// We got a test class and method, proceed
Class c = null;
// Split class and method on %23 = #
String[] clazzAndMethodArray = clazzAndMethod.split("#");
if (clazzAndMethodArray.length > 1) {
clazz = clazzAndMethodArray[0];
method = clazzAndMethodArray[1];
}
System.out.println("RunTestWebScript: [clazz=" + clazz + "][method=" + method + "]");
try {
// Load the Java class that will be run by JUnit
c = Class.forName(clazz);
} catch (ClassNotFoundException ex) {
throw new AlfrescoRuntimeException("Could not find test class: " + clazzAndMethod);
}
// See if JUnit should run test for whole class, or just specified method
if (method == null) {
// No method, run all tests in class
junitRunnerResult = JUnitCore.runClasses(c);
} else {
// We got one specific test method to run
Request jreq = Request.method(c, method);
junitRunnerResult = new JUnitCore().run(jreq);
}
// Check if test was successful
if (junitRunnerResult.wasSuccessful()) {
result = AlfrescoTestRunner.SUCCESS;
}
}
// Set up model to send to Web Script template
//
// What test did we run
Map<String, Object> model = new HashMap<String, Object>();
if (method == null) {
// We don't have a test method...
model.put("test", clazzAndMethod);
} else {
model.put("test", clazzAndMethod + "#" + method);
}
// Overall Alfresco Test runner result
model.put("result", result);
// JUnit Runner stats
if (junitRunnerResult != null) {
model.put("resultObject", junitRunnerResult);
model.put("failures", junitRunnerResult.getFailures());
model.put("failureCount", junitRunnerResult.getFailureCount());
model.put("ignoreCount", junitRunnerResult.getIgnoreCount());
model.put("runCount", junitRunnerResult.getRunCount());
model.put("runTime", junitRunnerResult.getRunTime());
List<String> throwables = new ArrayList<>();
if (null != junitRunnerResult.getFailures()) {
for (Failure failure : junitRunnerResult.getFailures()) {
try {
throwables.add(AlfrescoTestRunner.serializableToString(failure.getException()));
} catch (IOException e) {
try {
throwables.add(AlfrescoTestRunner.serializableToString(
"Unable to serialize exception."));
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
model.put("throwables", throwables);
model.put("wasSuccessful", junitRunnerResult.wasSuccessful());
}
System.out.println("RunTestWebScript: model = " + model);
System.out.println("RunTestWebScript: Stopped executing");
return model;
}
}

View File

@ -20,11 +20,15 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="remoteRunnnerWrapper" class="org.alfresco.maven.rad.RemoteRunnerWrapper"/>
<bean id="remoteRunnnerWrapperThread" class="java.lang.Thread" init-method="start" destroy-method="interrupt">
<constructor-arg ref="remoteRunnnerWrapper"/>
<!-- Bean that holds current Alfresco Spring context -->
<bean id="org.alfresco.rad.springContextHolder" class="org.alfresco.rad.SpringContextHolder"/>
<!-- Web Script that can be used to invoke integration tests remotely.
Integration testing framework donated by Zia Consulting -->
<bean id="webscript.org.alfresco.rad.test.runtest.get"
class="org.alfresco.rad.test.RunTestWebScript"
parent="webscript">
</bean>
</beans>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2017 Alfresco Software Limited.
This file is part of the Alfresco SDK project.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<webscript>
<shortname>Perform Test</shortname>
<description>Run integration test in Alfresco context</description>
<url>/testing/test?clazz={clazz}</url>
<format default="html">any</format>
<lifecycle>internal</lifecycle>
<authentication>user</authentication>
<family>Alfresco SDK</family>
<cache>
<never>false</never>
<public>false</public>
<mustrevalidate/>
</cache>
<negotiate accept="text/html">html</negotiate>
<negotiate accept="text/xml">html</negotiate>
</webscript>

View File

@ -0,0 +1,34 @@
<html>
<head>
<title>${test?html}</title>
<script language="JavaScript">
function showdiv(id) {
//safe function to show an element with a specified id
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = 'block';
}
else {
if (document.layers) { // Netscape 4
document.id.display = 'block';
}
else { // IE 4
document.all.id.style.display = 'block';
}
}
}
</script>
</head>
<body>
<h1>Integration Test: ${test?html}</h1>
<div><b>Result:</b> ${result}</div>
<#if failures??>
<#list failures as failure>
<div id="testHeader"><b>${failure.getTestHeader()?html}</b></div>
<div id="message"><a href="#" onclick="showdiv('trace');return false;">${failure.getMessage()?html}</a></div>
<div id="trace" style="display:none;"><pre>${failure.getTrace()?html}</pre></div>
<br/>
</#list>
</#if>
</body>
</html>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<response>
<test>${test?html}</test>
<result>${result?html}</result>
<#if failures??>
<failures>
<#list failures as failure>
<trace>${failure.getTrace()?html}</trace>
<exception>${failure.getException()?html}</exception>
<message>${failure.getMessage()?html}</message>
<testHeader>${failure.getTestHeader()?html}</testHeader>
</#list>
</failures>
</#if>
<failureCount>${failureCount?html}</failureCount>
<ignoreCount>${ignoreCount?html}</ignoreCount>
<runCount>${runCount?html}</runCount>
<runTime>${runTime?html}</runTime>
<#if throwables??>
<throwables>
<#list throwables as throwable>
<throwable>${throwable?html}</throwable>
</#list>
</throwables>
</#if>
<wasSuccessful>${wasSuccessful?string}</wasSuccessful>
</response>

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2015 Alfresco Software Limited.
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK.
* <p/>

View File

@ -1,3 +1,20 @@
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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 org.alfresco.maven.plugin;
import java.io.File;

View File

@ -0,0 +1,126 @@
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK project.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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 org.alfresco.maven.plugin;
import org.alfresco.maven.plugin.config.ModuleDependency;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.zeroturnaround.zip.ZipUtil;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import static org.twdata.maven.mojoexecutor.MojoExecutor.*;
/**
* Alfresco Plugin mojo that are used when you want to run Integration Tests.
* It will package up all the Integration Test classes and execute contained
* tests with the Maven Failsafe plugin. The test classes will be added
* to the platform war so they can be executed remotely via
* the ${@link org.alfresco.rad.test.AlfrescoTestRunner}
* <p/>
* The Alfresco RAD module is also added to the Platform WAR so
* the Alfresco Test runner classes are available.
*
* @author martin.bergljung@alfresco.com
* @since 3.0
*/
@Mojo(name = "it",
defaultPhase = LifecyclePhase.PRE_INTEGRATION_TEST,
aggregator = true, // Only run against the top-level project in a Maven build
requiresDependencyResolution = ResolutionScope.TEST)
public class IntegrationTestMojo extends AbstractRunMojo {
@Override
public void execute() throws MojoExecutionException {
execEnv = executionEnvironment(
project,
session,
pluginManager
);
// Check if we should skip this Mojo execution, i.e. if tests have been
// skipped by the user
Properties sysProperties = execEnv.getMavenSession().getSystemProperties();
boolean skipThisMojo = sysProperties.containsKey("skipTests") ||
sysProperties.containsKey("skipITs") ||
sysProperties.containsKey("maven.test.skip");
if (skipThisMojo) {
getLog().info("Skipping integration testing.");
return;
}
List<String> goals = execEnv.getMavenSession().getGoals();
if (goals.contains("alfresco:run")) {
sysProperties.put("skipTests", "true");
getLog().info("Skipping integration testing as alfresco:run is active.");
return;
}
getLog().info("Checking if Tomcat is already running on port " + "");
if ( ! tomcatIsRunning() ) {
if (enableSolr) {
unpackSolrConfig();
fixSolrHomePath();
replaceSolrConfigProperties();
installSolr10InLocalRepo();
}
if (enableTestProperties && enablePlatform) {
copyAlfrescoGlobalProperties();
renameAlfrescoGlobalProperties();
}
String testJarArtifactId = null;
if (enablePlatform) {
// Add alfresco-rad module to platform WAR
// So we got access to Alfresco Test Runner in the server
platformModules.add(
new ModuleDependency(
"org.alfresco.maven",
"alfresco-rad",
"${alfresco.sdk.version}",
ModuleDependency.TYPE_JAR));
buildPlatformWar();
}
if (enableShare) {
buildShareWar();
}
if (enableActivitiApp) {
buildActivitiAppWar();
}
if (startTomcat) {
boolean fork = true;
startTomcat(fork);
}
}
}
}

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2015 Alfresco Software Limited.
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK.
* <p/>

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2015 Alfresco Software Limited.
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK.
* <p/>

View File

@ -1,5 +1,5 @@
/**
* Copyright (C) 2015 Alfresco Software Limited.
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK.
* <p/>

View File

@ -1,7 +1,22 @@
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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 org.alfresco.maven.plugin;
import java.io.File;
import org.alfrescolabs.technical.validation.AlfrescoTechnicalValidation;
import org.alfrescolabs.technical.validation.impl.AlfrescoTechnicalValidationImpl;
import org.apache.maven.plugin.AbstractMojo;

View File

@ -1,3 +1,20 @@
/**
* Copyright (C) 2017 Alfresco Software Limited.
* <p/>
* This file is part of the Alfresco SDK.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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 org.alfresco.maven.plugin;
import java.text.DateFormat;

View File

@ -29,6 +29,7 @@ public abstract class MavenDependency {
private String groupId;
private String artifactId;
private String version;
private String classifier;
public MavenDependency() {}
@ -38,6 +39,14 @@ public abstract class MavenDependency {
this.version = v;
}
public MavenDependency(String g, String a, String v, String c) {
this.groupId = g;
this.artifactId = a;
this.version = v;
this.classifier = c;
}
public String getGroupId() {
return groupId;
}
@ -54,14 +63,20 @@ public abstract class MavenDependency {
this.artifactId = artifactId;
}
public String getVersion() {
return version;
}
public String getVersion() { return version; }
public void setVersion(String version) {
this.version = version;
}
public String getClassifier() {
return classifier;
}
public void setClassifier(String c) { this.classifier = c; }
@Override
public boolean equals(Object o) {
if (this == o) return true;
@ -71,6 +86,7 @@ public abstract class MavenDependency {
if (!groupId.equals(that.groupId)) return false;
if (!artifactId.equals(that.artifactId)) return false;
if (!classifier.equals(that.classifier)) return false;
return version.equals(that.version);
}

View File

@ -138,7 +138,7 @@
<alfresco.sdk.tests.exclude>*/*-enterprise/*</alfresco.sdk.tests.exclude>
<!-- The following version is needed to grab the alfresco-mmt -->
<alfresco.community.default.version>5.1.g</alfresco.community.default.version>
<alfresco.community.default.version>5.2.e</alfresco.community.default.version>
<scm.url.base>https://github.com/Alfresco/alfresco-sdk</scm.url.base>
</properties>