-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SHRINKRES-42 Added unit tests for property interpolation
- Loading branch information
Showing
32 changed files
with
218 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...org/jboss/shrinkwrap/resolver/impl/maven/integration/PropertiesInterpolationTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2010, Red Hat Middleware LLC, and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* 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 | ||
* 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. | ||
*/ | ||
package org.jboss.shrinkwrap.resolver.impl.maven.integration; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
import junit.framework.Assert; | ||
|
||
import org.jboss.shrinkwrap.resolver.api.maven.Maven; | ||
import org.jboss.shrinkwrap.resolver.impl.maven.util.TestFileUtil; | ||
import org.jboss.shrinkwrap.resolver.impl.maven.util.ValidationUtil; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Tests for System property interpolation in Maven metadata. | ||
* | ||
* SHRINKRES-42 | ||
* | ||
* @author <a href="kpiwko@redhat.com">Karel Piwko</a> | ||
* | ||
*/ | ||
public class PropertiesInterpolationTestCase { | ||
|
||
private static final File INTERPOLATED_REPOSITORY; | ||
static { | ||
String javaVersion = System.getProperty("java.version"); | ||
INTERPOLATED_REPOSITORY = new File("target/repository-" + javaVersion); | ||
} | ||
|
||
@BeforeClass | ||
public static void initialize() throws IOException { | ||
System.clearProperty("maven.repo.local"); // May conflict with release settings | ||
TestFileUtil.removeDirectory(INTERPOLATED_REPOSITORY); | ||
} | ||
|
||
@Test | ||
public void interpolateSettingsXml() { | ||
|
||
File file = Maven.configureResolver().fromFile("target/settings/profiles/settings-interpolation.xml") | ||
.resolve("org.jboss.shrinkwrap.test:test-deps-c:1.0.0") | ||
.withoutTransitivity().asSingle(File.class); | ||
Assert.assertEquals("The file is packaged as test-deps-c-1.0.0.jar", "test-deps-c-1.0.0.jar", file.getName()); | ||
|
||
// check that repository was created | ||
Assert.assertTrue("Local repository was created using interpolated ${java.version}", INTERPOLATED_REPOSITORY.exists()); | ||
} | ||
|
||
@Test | ||
public void interpolatePomWithSystemScopeXml() { | ||
|
||
File[] files = Maven.configureResolver().fromFile("target/settings/profiles/settings.xml") | ||
.resolve("org.jboss.shrinkwrap.test:test-system-scope:pom:1.0.0") | ||
.withTransitivity().asFile(); | ||
|
||
new ValidationUtil("tools").validate(files); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?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"> | ||
|
||
<!-- Model Version --> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<!-- Artifact Configuration --> | ||
<groupId>org.jboss.shrinkwrap.test</groupId> | ||
<artifactId>test-system-scope</artifactId> | ||
<version>1.0.0</version> | ||
<packaging>pom</packaging> | ||
|
||
<build> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.sun</groupId> | ||
<artifactId>tools</artifactId> | ||
<version>1.6</version> | ||
<scope>system</scope> | ||
<systemPath>${java.home}/../lib/tools.jar</systemPath> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
42 changes: 42 additions & 0 deletions
42
impl-maven/src/test/resources/profiles/settings-interpolation.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<settings> | ||
<!-- here we are on purpose excaping java version is maven does not filter it by itself --> | ||
<localRepository>target/repository-\${java.version}</localRepository> | ||
|
||
<profiles> | ||
<profile> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<repositories> | ||
<repository> | ||
<id>test-repository</id> | ||
<name>Test repository</name> | ||
<url>file://${basedir}/target/repository</url> | ||
<layout>default</layout> | ||
<releases> | ||
<enabled>true</enabled> | ||
<updatePolicy>never</updatePolicy> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
<updatePolicy>never</updatePolicy> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>test-repository</id> | ||
<name>Test repository</name> | ||
<url>file://${basedir}/target/repository</url> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
</profile> | ||
</profiles> | ||
</settings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
.../repository/org/jboss/shrinkwrap/test/test-system-scope/1.0.0/test-system-scope-1.0.0.pom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?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"> | ||
|
||
<!-- Model Version --> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<!-- Artifact Configuration --> | ||
<groupId>org.jboss.shrinkwrap.test</groupId> | ||
<artifactId>test-system-scope</artifactId> | ||
<version>1.0.0</version> | ||
<packaging>pom</packaging> | ||
|
||
<build> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.sun</groupId> | ||
<artifactId>tools</artifactId> | ||
<version>1.6</version> | ||
<scope>system</scope> | ||
<systemPath>${java.home}/../lib/tools.jar</systemPath> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
Oops, something went wrong.