From 187e3b7978665444f031325e289837d49991982a Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Wed, 4 Feb 2009 19:13:28 +0000 Subject: [PATCH] [MNG-1957] clause in the activation section has to provide more complex expressions. o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@740832 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...1957JdkActivationWithVersionRangeTest.java | 66 +++++++++++ .../src/test/resources/mng-1957/pom.xml | 105 ++++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1957JdkActivationWithVersionRangeTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-1957/pom.xml diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index b3846ba574..d5ee2bae21 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -246,6 +246,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng1999DefaultReportsInheritanceTest.class ); suite.addTestSuite( MavenITmng1995InterpolateBooleanModelElementsTest.class ); suite.addTestSuite( MavenITmng1992SystemPropOverridesPomPropTest.class ); + suite.addTestSuite( MavenITmng1957JdkActivationWithVersionRangeTest.class ); suite.addTestSuite( MavenITmng1908LegacySnapshotUpdateTest.class ); suite.addTestSuite( MavenITmng1830ShowVersionTest.class ); suite.addTestSuite( MavenITmng1703PluginMgmtDepInheritanceTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1957JdkActivationWithVersionRangeTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1957JdkActivationWithVersionRangeTest.java new file mode 100644 index 0000000000..6acba8543e --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1957JdkActivationWithVersionRangeTest.java @@ -0,0 +1,66 @@ +package org.apache.maven.it; + +/* + * 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 + * + * 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. + */ + +import org.apache.maven.it.Verifier; +import org.apache.maven.it.util.ResourceExtractor; + +import java.io.File; +import java.util.Properties; + +/** + * This is a test set for MNG-1957. + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class MavenITmng1957JdkActivationWithVersionRangeTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng1957JdkActivationWithVersionRangeTest() + { + super( "[2.1.0-M2,)" ); + } + + /** + * Test that JDK profile activation allows version ranges. + */ + public void testitMNG1957() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1957" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + Properties props = verifier.loadProperties( "target/jdk.properties" ); + assertEquals( "PASSED", props.getProperty( "project.properties.jdkProperty1" ) ); + assertEquals( "PASSED", props.getProperty( "project.properties.jdkProperty2" ) ); + assertEquals( "PASSED", props.getProperty( "project.properties.jdkProperty3" ) ); + assertEquals( null, props.getProperty( "project.properties.jdkProperty4" ) ); + assertEquals( null, props.getProperty( "project.properties.jdkProperty5" ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-1957/pom.xml b/its/core-it-suite/src/test/resources/mng-1957/pom.xml new file mode 100644 index 0000000000..c0431f5807 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-1957/pom.xml @@ -0,0 +1,105 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng1957 + test + 1.0-SNAPSHOT + + Maven Integration Test :: MNG-1957 + + Test that JDK profile activation allows version ranges. + + + + + + org.apache.maven.its.plugins + maven-it-plugin-expression + 2.1-SNAPSHOT + + + validate + + eval + + + target/jdk.properties + + project/properties + + + + + + + + + + + test-1 + + [1.4,) + + + PASSED + + + + test-2 + + (,100) + + + PASSED + + + + test-3 + + (1.3,100) + + + PASSED + + + + test-4 + + (100,) + + + FAILED + + + + test-5 + + (,1.4) + + + FAILED + + + +