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  import org.apache.maven.shared.utils.io.FileUtils;
26  
27  /**
28   * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-3503">MNG-3503</a>. The first test verifies that
29   * a plugin using plexus-utils-1.1 does not cause linkage errors. The second test verifies that a plugin with a
30   * different implementation of the shaded classes is used instead.
31   */
32  public class MavenITmng3503Xpp3ShadingTest
33      extends AbstractMavenIntegrationTestCase
34  {
35      public MavenITmng3503Xpp3ShadingTest()
36      {
37          super( "(2.0.9,2.1.0-M1),(2.1.0-M1,)" ); // only test in 2.0.10+, and not in 2.1.0-M1
38      }
39  
40      public void testitMNG3503NoLinkageErrors()
41          throws Exception
42      {
43          File dir =
44              ResourceExtractor.simpleExtractResources( getClass(), "/mng-3503/mng-3503-xpp3Shading-pu11" );
45  
46          Verifier verifier;
47  
48          verifier = newVerifier( dir.getAbsolutePath() );
49  
50          verifier.executeGoal( "validate" );
51  
52          verifier.verifyErrorFreeLog();
53  
54          verifier.resetStreams();
55  
56          assertEquals( "<root />", FileUtils.fileRead( new File( dir, "target/serialized.xml" ), "UTF-8" ) );
57      }
58  
59      public void testitMNG3503Xpp3Shading()
60          throws Exception
61      {
62          File dir =
63              ResourceExtractor.simpleExtractResources( getClass(), "/mng-3503/mng-3503-xpp3Shading-pu-new" );
64          Verifier verifier = newVerifier( dir.getAbsolutePath() );
65  
66          verifier.executeGoal( "validate" );
67  
68          verifier.verifyErrorFreeLog();
69  
70          verifier.resetStreams();
71  
72          assertEquals( "root", FileUtils.fileRead( new File( dir, "target/serialized.xml" ), "UTF-8" ) );
73      }
74  }