Commit 8bf4214b authored by mindthegab's avatar mindthegab
Browse files

added amp testing framework to aio. tested remote junit working

parent bfd6d9cc
Loading
Loading
Loading
Loading
+6 −0
Changes for archetypes/alfresco-allinone-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -25,6 +25,12 @@
            <include>**/*.java</include>
          </includes>
        </fileSet>
        <fileSet filtered="false" packaged="false" encoding="UTF-8">
          <directory>src/test/java</directory>
          <includes>
            <include>**/*.java</include>
          </includes>
        </fileSet>
        <fileSet encoding="UTF-8" filtered="false">
          <directory>src/main/amp</directory>
          <includes>
+6 −0
Changes for archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/repo-amp/pom.xml: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -45,5 +45,11 @@
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>run</id>
            <properties>
            	<skipTests>true</skipTests>
            </properties>
        </profile>
    </profiles>
</project>
+2 −0
Changes for archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/repo-amp/src/main/amp/config/alfresco/module/__artifactId__/context/service-context.xml: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@
        <property name="description" value="A demonstration component" />
        <property name="sinceVersion" value="2.0" />
        <property name="appliesFromVersion" value="2.0" />
        <property name="nodeService" ref="NodeService" />
        <property name="nodeLocatorService" ref="nodeLocatorService" />
    </bean>
    
</beans>
+63 −6
Changes for archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/repo-amp/src/main/java/org/alfresco/demoamp/DemoComponent.java: 63 added lines, 6 removed lines.
Original line number Diff line number Diff line
package org.alfresco.demoamp;
/*
    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
	
import java.util.logging.Logger;
	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.demoamp;

import org.alfresco.repo.module.AbstractModuleComponent;
import org.alfresco.repo.nodelocator.NodeLocatorService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * A basic component that will be started for this module.
 * This is a sample taken from Maven Alfresco SDK
 * Uses the NodeLocatorService to easily find nodes and the 
 * NodeService to display them
 * 
 * @author Derek Hulley
 * @author Gabriele Columbro
 * @author Maurizio Pillitu
 */
public class DemoComponent extends AbstractModuleComponent
{
    Log log = LogFactory.getLog(DemoComponent.class);
    
    private NodeService nodeService;
    
    private NodeLocatorService nodeLocatorService;

    public void setNodeService(NodeService nodeService) {
        this.nodeService = nodeService;
    }
    
    public void setNodeLocatorService(NodeLocatorService nodeLocatorService) {
        this.nodeLocatorService = nodeLocatorService;
    }

    /**
     * Bogus component execution 
     */
    @Override
    protected void executeInternal() throws Throwable
    {
        System.out.println("DemoComponent has been executed");
        log.debug("Test debug logging is working");
        log.info("This should not be outputted by default");
        log.debug("Test debug logging. Congratulation your AMP is working");
        log.info("This is only for information purposed. Better remove me from the log in Production");
    }
    
    /**
     * This is a demo service interaction with Alfresco Foundation API.
     * This sample method returns the number of child nodes of a certain type 
     * under a certain node.
     * 
     * @return
     */
    public int childNodesCount(NodeRef nodeRef)
    {
        return nodeService.countChildAssocs(nodeRef, true);
    }
    
    /**
     * Returns the NodeRef of "Company Home"
     * 
     * @return
     */
    public NodeRef getCompanyHome()

    {
        return nodeLocatorService.getNode("companyhome", null, null);
    }
}
+7 −0
Changes for archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/repo/pom.xml: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -145,6 +145,13 @@
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.alfresco.maven</groupId>
                    <artifactId>alfresco-rad</artifactId>
                    <version>${maven.alfresco.version}</version>
                </dependency>
            </dependencies>
        </profile>
        <!-- Installs the needed runtime artifact for an RM (Records Management) project -->
        <profile>