2.11.1. Maven pom.xml file configuration

Organization Service TCK tests are available as a separate Maven artifact, so the first thing you need is to add this artifact as a dependency to your pom.xml file.


<dependency>
    <groupId>org.exoplatform.core</groupId>
    <artifactId>exo.core.component.organization.tests</artifactId>
    <version>2.4.3-GA</version>
    <classifier>sources</classifier>
    <scope>test</scope>
</dependency>

You will also need to unpack tests as they are archieved within jar file. For this purpose, you may use maven-dependency-plugin.


<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
           <id>unpack</id>
           <phase>generate-test-sources</phase>
           <goals>
              <goal>unpack</goal>
           </goals>
           <configuration>
              <artifactItems>
                 <artifactItem>
                    <groupId>org.exoplatform.core</groupId>
                    <artifactId>exo.core.component.organization.tests</artifactId>
                    <classifier>sources</classifier>
                    <type>jar</type>
                    <overWrite>false</overWrite>
                 </artifactItem>
              </artifactItems>
              <outputDirectory>${project.build.directory}/org-service-tck-tests</outputDirectory>
           </configuration>
        </execution>
    </executions>
</plugin>

Note

Remember the value of outputDirectory parameter as you will need it later.

After you have unpacked the tests, you need to add the test sources and resources by using build-helper-maven-plugin.


<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.3</version>
    <executions>
        <execution>
           <id>add-test-resource</id>
           <phase>generate-test-sources</phase>
           <goals>
              <goal>add-test-resource</goal>
           </goals>
           <configuration>
              <resources>
                 <resource>
                    <directory>${project.build.directory}/org-service-tck-tests</directory>
                 </resource>
              </resources>
           </configuration>
        </execution> 
        <execution>
           <id>add-test-source</id>
           <phase>generate-test-sources</phase>
           <goals>
              <goal>add-test-source</goal>
           </goals>
           <configuration>
              <sources>
                 <source>${project.build.directory}/org-service-tck-tests</source>
              </sources>
           </configuration>
        </execution>
    </executions>
</plugin>

Note

The directory and source parameters should point to the location you have specified in the outputDirectory parameter just above.

You also need to include all TCK tests using maven-surefire-plugin.


<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
      ...
      <includes>
          <include>org/exoplatform/services/tck/organization/Test*.java</include>
      </includes>                   
      ...
    </configuration>
</plugin>

As a result, you should have TCK being launched during your next maven clean install. You can file example of the configured pom.xml file at GIT server.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus