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   * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-3221">MNG-3221</a>.
28   *
29   *
30   */
31  public class MavenITmng3221InfiniteForkingTest
32      extends AbstractMavenIntegrationTestCase
33  {
34      public MavenITmng3221InfiniteForkingTest()
35      {
36          super( "(2.0.8,3.0-alpha-1)" ); // irrelevant in 3.0+
37      }
38  
39      public void testitMNG3221a()
40          throws Exception
41      {
42          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3221" );
43  
44          File reportDir = new File( testDir, "report" );
45          File projectDir = new File( testDir, "user" );
46  
47          Verifier verifier = null;
48  
49          try
50          {
51              verifier = newVerifier( reportDir.getAbsolutePath(), "remote" );
52  
53              verifier.deleteArtifact( "org.apache.maven.its.mng3221", "maven-forking-report-plugin", "1", "jar" );
54  
55              verifier.setLogFileName( "mng-3221-a-log.txt" );
56              verifier.executeGoal( "install" );
57              verifier.verifyErrorFreeLog();
58              verifier.resetStreams();
59  
60              verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
61  
62              verifier.addCliOption( "-Psite" );
63  
64              verifier.setLogFileName( "mng-3221-a-log.txt" );
65              verifier.executeGoal( "site" );
66              verifier.verifyErrorFreeLog();
67          }
68          finally
69          {
70              if ( verifier != null )
71              {
72                  verifier.resetStreams();
73              }
74          }
75     }
76  
77      public void testitMNG3221b()
78          throws Exception
79      {
80          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3221" );
81  
82          File pluginDir = new File( testDir, "plugin" );
83          File projectDir = new File( testDir, "user" );
84  
85          Verifier verifier = null;
86  
87          try
88          {
89              verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" );
90  
91              verifier.deleteArtifact( "org.apache.maven.its.mng3221", "maven-forking-test-plugin", "1", "jar" );
92  
93              verifier.setLogFileName( "mng-3221-b-log.txt" );
94              verifier.executeGoal( "install" );
95              verifier.verifyErrorFreeLog();
96              verifier.resetStreams();
97  
98              verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
99  
100             verifier.addCliOption( "-Pplugin" );
101 
102             verifier.setLogFileName( "mng-3221-b-log.txt" );
103             verifier.executeGoal( "package" );
104             verifier.verifyErrorFreeLog();
105         }
106         finally
107         {
108             if ( verifier != null )
109             {
110                 verifier.resetStreams();
111             }
112         }
113     }
114 }