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  import java.util.List;
26  
27  public class MavenITmng5214DontMapWsdlToJar
28      extends AbstractMavenIntegrationTestCase
29  {
30      public MavenITmng5214DontMapWsdlToJar()
31      {
32          super( "[3.1,)" );
33      }
34  
35      /**
36       * Test that the code that allows test-jar and ejb-client dependencies to resolve to the
37       * target/classes or target/test-class is *not* applies to other types, e.g. wsdl.
38       *
39       * @throws Exception in case of failure
40       */
41      public void testitTestPhase()
42          throws Exception
43      {
44          File setupDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5214/dependency" );
45  
46          Verifier setupVerifier = newVerifier( setupDir.getAbsolutePath() );
47          setupVerifier.setAutoclean( false );
48          setupVerifier.setMavenDebug( true );
49          setupVerifier.deleteDirectory( "target" );
50          setupVerifier.deleteArtifacts( "org.apache.maven.its.mng5214" );
51          setupVerifier.setLogFileName( "log-setup.txt" );
52          setupVerifier.addCliOption( "-PcreateWsdl" );
53          setupVerifier.executeGoal( "generate-resources" );
54  
55          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5214" );
56  
57          Verifier verifier = newVerifier( testDir.getAbsolutePath() );
58          verifier.setAutoclean( false );
59          verifier.deleteDirectory( "consumer/target" );
60          verifier.deleteDirectory( "dependency/target" );
61          verifier.setLogFileName( "log-test.txt" );
62          verifier.executeGoal( "test" );
63          verifier.verifyErrorFreeLog();
64          List<String> lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
65          // RESOLVE-ONE-DEPENDENCY org.apache.maven.its.mng5214:dependency:wsdl:1.0-SNAPSHOT $ /tmp/it
66          // .repo/org/apache/maven/its/mng5214/dependency/1.0-SNAPSHOT/dependency-1.0-SNAPSHOT.wsdl
67          for ( String line : lines )
68          {
69              if ( line.contains( "RESOLVE-ONE-DEPENDENCY org.apache.maven.its.mng5214:dependency:wsdl:1.0-SNAPSHOT" ) )
70              {
71                  assertFalse( line.contains( "classes-main" ) );
72                  assertTrue( line.endsWith( ".wsdl" ) );
73              }
74          }
75      }
76  }