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 java.io.File;
23  
24  import org.apache.maven.it.util.ResourceExtractor;
25  
26  /**
27   * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-3746">MNG-3746</a>.
28   *
29   * todo Fill in a better description of what this test verifies!
30   *
31   * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
32   * @author jdcasey
33   */
34  public class MavenITmng3746POMPropertyOverrideTest
35      extends AbstractMavenIntegrationTestCase
36  {
37      public MavenITmng3746POMPropertyOverrideTest()
38      {
39          super( "(2.0.8,)" ); // only test in 2.0.9+
40      }
41  
42      public void testitMNG3746_UsingDefaultSystemProperty()
43          throws Exception
44      {
45          // The testdir is computed from the location of this
46          // file.
47          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3746" );
48          File pluginDir = new File( testDir, "maven-mng3746-plugin" );
49          File projectDir = new File( testDir, "project" );
50  
51          Verifier verifier;
52  
53          verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" );
54          verifier.setLogFileName( "log-sys.txt" );
55          verifier.executeGoal( "install" );
56          verifier.verifyErrorFreeLog();
57          verifier.resetStreams();
58  
59          verifier = newVerifier( projectDir.getAbsolutePath() );
60          verifier.setLogFileName( "log-sys.txt" );
61          verifier.executeGoal( "validate" );
62          verifier.verifyErrorFreeLog();
63          verifier.resetStreams();
64      }
65  
66      public void testitMNG3746_UsingCLIProperty()
67          throws Exception
68      {
69          // The testdir is computed from the location of this
70          // file.
71          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3746" );
72          File pluginDir = new File( testDir, "maven-mng3746-plugin" );
73          File projectDir = new File( testDir, "project" );
74  
75          Verifier verifier;
76  
77          verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" );
78          verifier.setLogFileName( "log-cli.txt" );
79          verifier.executeGoal( "install" );
80          verifier.verifyErrorFreeLog();
81          verifier.resetStreams();
82  
83          verifier = newVerifier( projectDir.getAbsolutePath() );
84          verifier.setLogFileName( "log-cli.txt" );
85  
86          verifier.addCliOption( "-Dtest.verification=cli" );
87          verifier.addCliOption( "-Dtest.usingCliValue=true" );
88          verifier.addCliOption( "-Djava.version=cli" );
89  
90          verifier.executeGoal( "validate" );
91          verifier.verifyErrorFreeLog();
92          verifier.resetStreams();
93      }
94  }