Commit 56475bb7 authored by mindthegab's avatar mindthegab
Browse files

-- fixed proper installation of modules at test time

-- created a separate test-classpath mimicking MMT behavior by adding module.properties in the right classpath location
-- separated amp-testing profile so that it only activated when src/test/java is enabled
-- externalized properties

git-svn-id: http://maven-alfresco-archetypes.googlecode.com/svn/trunk@628 04253f4f-3451-0410-a141-5562f1e59037
parent 884f1596
Loading
Loading
Loading
Loading
+46 −5
Original line number Diff line number Diff line
@@ -72,6 +72,8 @@
        | This can be overridden your pom
     -->
    <app.amp.folder>src/main/amp</app.amp.folder>
    <app.amp.output.folder>../${project.build.finalName}</app.amp.output.folder>
    <app.amp.test.output.folder>${project.build.directory}/amp-test-classpath</app.amp.test.output.folder>
    <app.properties.folder>src/main/properties/${env}</app.properties.folder>
    <app.properties.test.folder>src/test/properties/${env}</app.properties.test.folder>
    <app.properties.include>**</app.properties.include>
@@ -252,7 +254,7 @@
        </resource>
        <resource>
            <directory>${app.amp.folder}</directory>
            <targetPath>../${project.build.finalName}</targetPath>
            <targetPath>${app.amp.output.folder}</targetPath>
            <filtering>${app.filtering.enabled}</filtering>
        </resource>
    </resources>
@@ -414,6 +416,46 @@
            <groupId>org.alfresco.maven.plugin</groupId>
            <artifactId>alfresco-maven-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
    
    <!-- Enable AMP lifecycle if finds a module.properties, including unit testing support -->
    <profile>
      <id>enable-alfresco-testing</id>
      <activation>
        <file>
          <exists>src/test/java</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <id>prepare-amp-testing-classpath</id>
                <phase>process-test-resources</phase>
                <goals><goal>copy-resources</goal></goals>
                <configuration>
                  <outputDirectory>${app.amp.test.output.folder}</outputDirectory>
                  <resources>
                    <resource>
                      <directory>${app.amp.folder}/config</directory>
                      <filtering>${app.filtering.enabled}</filtering>
                    </resource>
                    <resource>
                      <directory>${app.amp.folder}</directory>
                      <includes><include>module.properties</include></includes>
                      <targetPath>alfresco/module/${project.artifactId}</targetPath>
                      <filtering>${app.filtering.enabled}</filtering>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
@@ -421,9 +463,8 @@
              <configuration>
                  <argLine>${app.testing.jvm.args}</argLine>
                  <additionalClasspathElements>
                      <!-- Adds the config directory to the test classpath for unit testing purposes -->
                      <additionalClasspathElement>${project.build.directory}/${project.build.finalName}/config</additionalClasspathElement>
                    <additionalClasspathElement>${project.build.directory}/${project.build.finalName}/module.properties</additionalClasspathElement>
                      <!-- Adds the previously built ${app.amp.test.output.folder} to test classpath to enable module installation at test time -->
                      <additionalClasspathElement>${app.amp.test.output.folder}</additionalClasspathElement>
                  </additionalClasspathElements>
              </configuration>
            </plugin>