Skip to content

Commit

Permalink
SHRINKRES-64 Executing plugin tests via Maven Invoker
Browse files Browse the repository at this point in the history
  • Loading branch information
kpiwko authored and ALRubinger committed Nov 6, 2012
1 parent d68f84a commit e6c57aa
Show file tree
Hide file tree
Showing 7 changed files with 425 additions and 58 deletions.
14 changes: 1 addition & 13 deletions impl-maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -297,19 +297,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-maven-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<goals>
<goal>propagate-execution-context</goal>
</goals>
</execution>
</executions>
</plugin>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
53 changes: 50 additions & 3 deletions maven-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<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/xsd/maven-4.0.0.xsd">
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down Expand Up @@ -62,9 +63,8 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<goalPrefix>resolver</goalPrefix>
<goalPrefix>shrinkwrap-resolver</goalPrefix>
</configuration>
<executions>
<execution>
Expand All @@ -75,6 +75,53 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<debug>false</debug>
<projectsDirectory>src/it</projectsDirectory>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
<preBuildHookScript>setup</preBuildHookScript>
<postBuildHookScript>verify</postBuildHookScript>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<!-- <settingsFile>src/it/settings.xml</settingsFile> -->
<streamLogs>true</streamLogs>
</configuration>
<executions>
<execution>
<id>install-artifacts-into-local-repository</id>
<phase>pre-integration-test</phase>
<goals>
<!-- install artifacts into local testing repository -->
<goal>install</goal>
</goals>
<configuration>
<extraArtifacts>
<!-- depchain seems not be enough -->
<extraArtifact>org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-depchain:${project.version}:pom</extraArtifact>
<!-- we need to install poms, so Invoker will be able to resolve transitive dependencies -->
<extraArtifact>org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api:${project.version}:pom</extraArtifact>
<extraArtifact>org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api-maven:${project.version}:pom</extraArtifact>
<extraArtifact>org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api-maven-archive:${project.version}:pom</extraArtifact>
<extraArtifact>org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven:${project.version}:pom</extraArtifact>
<extraArtifact>org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven-archive:${project.version}:pom</extraArtifact>
</extraArtifacts>
</configuration>
</execution>
<execution>
<id>run-integration-test</id>
<phase>integration-test</phase>
<goals>
<!-- run tests -->
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
<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/xsd/maven-4.0.0.xsd">
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-parent</artifactId>
<version>2.0.0-alpha-5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-maven-plugin-tests</artifactId>
<version>1.0.0</version>
<name>ShrinkWrap Maven Resolver Plugin Tests</name>
<description>Tests for ShrinkWrap Maven Resolver Plugin</description>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-depchain</artifactId>
<version>@project.version@</version>
<type>pom</type>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-maven-plugin</artifactId>
<version>${project.version}</version>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<goals>
Expand All @@ -36,11 +39,13 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.11</version>
<executions>
<execution>
<id>default-test</id>
<configuration>
<forkMode>always</forkMode>
<reportNameSuffix>forking</reportNameSuffix>
</configuration>
<phase>test</phase>
<goals>
Expand All @@ -51,6 +56,7 @@
<id>non-forking-tests</id>
<configuration>
<forkMode>never</forkMode>
<reportNameSuffix>nonforking</reportNameSuffix>
</configuration>
<phase>test</phase>
<goals>
Expand All @@ -61,22 +67,22 @@
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.5</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

<!-- this profile is here to test active profile propagation -->
<profiles>
<profile>
<id>swr-profile</id>
<id>test-profile-for-plugin</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>


</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package org.jboss.shrinkwrap.resolver.impl.maven.integration;

package org.jboss.shrinkwrap.resolver.plugin.test;
import java.io.File;

import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage;
import org.jboss.shrinkwrap.resolver.api.maven.strategy.NonTransitiveStrategy;
import org.jboss.shrinkwrap.resolver.impl.maven.util.ValidationUtil;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
Expand All @@ -23,7 +21,7 @@ public class PluginIntegrationTestCase {
* NOTE: This test will depend upon information declared in this project's POM. Changes to the POM will impact the
* test.
*/

@Test
public void loadCurrentProject() {
PomEquippedResolveStage resolver = Maven.configureResolverViaPlugin();
Expand All @@ -34,22 +32,16 @@ public void loadCurrentProject() {
public void loadCurrentVersion() {
PomEquippedResolveStage resolver = Maven.configureResolverViaPlugin();

File[] files = resolver.resolve("org.sonatype.aether:aether-api").withTransitivity().as(File.class);
new ValidationUtil("aether-api").validate(files);
File[] files = resolver.resolve("junit:junit").withTransitivity().as(File.class);
new ValidationUtil("junit", "hamcrest-core").validate(files);
}

@Ignore
// SHRINKRES-64

@Test
public void strictlyLoadTestDependencies() {
PomEquippedResolveStage resolver = Maven.configureResolverViaPlugin();

final File[] files = resolver.importRuntimeDependencies(NonTransitiveStrategy.INSTANCE).as(File.class);
new ValidationUtil("maven-settings-builder", "plexus-interpolation", "maven-settings", "aether-util",
"aether-spi", "maven-model-builder", "wagon-provider-api", "plexus-cipher", "maven-repository-metadata",
"shrinkwrap-resolver-api-maven", "maven-model", "jsoup", "sisu-inject-plexus", "maven-aether-provider",
"plexus-utils", "wagon-file", "aether-api", "aether-connector-wagon", "plexus-classworlds",
"wagon-http-lightweight", "plexus-component-annotations", "aether-impl").validate(files);
new ValidationUtil("junit").validate(files);
}

}
Loading

0 comments on commit e6c57aa

Please sign in to comment.