View Javadoc
1   package org.apache.maven.it;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.it.util.ResourceExtractor;
23  
24  import java.io.File;
25  
26  /**
27   * The usage of a <code>${revision}</code> for the version in the pom file and furthermore
28   * defining the property in the pom file and overwrite it via command line.
29   * <a href="https://issues.apache.org/jira/browse/MNG-5895">MNG-5895</a>.
30   *
31   * This will result in a failure without the fix for this issue.
32   *
33   * @author Karl Heinz Marbaise khmarbaise@apache.org
34   */
35  public class MavenITmng5895CIFriendlyUsageWithPropertyTest
36      extends AbstractMavenIntegrationTestCase
37  {
38  
39      public MavenITmng5895CIFriendlyUsageWithPropertyTest()
40      {
41          // The first version which contains the fix for the MNG-issue.
42          // TODO: Think about it!
43          super( "[3.5.0-alpha-2,)" );
44      }
45  
46      /**
47       * Check that the resulting run will not fail in case
48       * of defining the property via command line which is
49       * already defined inside the pom.
50       *
51       * @throws Exception in case of failure
52       */
53      public void testitShouldResolveTheDependenciesWithoutBuildConsumer()
54          throws Exception
55      {
56          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5895-ci-friendly-usage-with-property" );
57  
58          Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
59          verifier.setMavenDebug( false );
60          verifier.setAutoclean( false );
61  
62          //verifier.setLogFileName( "log-only.txt" );
63          verifier.addCliOption( "-Drevision=1.2" );
64          verifier.addCliOption( "-Dmaven.experimental.buildconsumer=false" );
65          verifier.executeGoal( "clean" );
66          verifier.executeGoal( "package" );
67          verifier.verifyErrorFreeLog();
68          verifier.resetStreams();
69  
70      }
71  
72      public void testitShouldResolveTheDependenciesWithBuildConsumer()
73                      throws Exception
74      {
75          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5895-ci-friendly-usage-with-property" );
76  
77          Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
78          verifier.setMavenDebug( false );
79          verifier.setAutoclean( false );
80  
81          verifier.setLogFileName( "log-bc.txt" );
82          verifier.addCliOption( "-Drevision=1.2" );
83          verifier.addCliOption( "-Dmaven.experimental.buildconsumer=true" );
84          verifier.executeGoal( "clean" );
85          verifier.executeGoal( "package" );
86          verifier.verifyErrorFreeLog();
87          verifier.resetStreams();
88  
89      }
90  
91  }