View Javadoc

1   package org.apache.maven.it;
2   
3   import java.io.File;
4   import java.util.Iterator;
5   import java.util.List;
6   
7   import org.apache.maven.it.util.ResourceExtractor;
8   
9   /*
10   * Licensed to the Apache Software Foundation (ASF) under one
11   * or more contributor license agreements.  See the NOTICE file
12   * distributed with this work for additional information
13   * regarding copyright ownership.  The ASF licenses this file
14   * to you under the Apache License, Version 2.0 (the
15   * "License"); you may not use this file except in compliance
16   * with the License.  You may obtain a copy of the License at
17   *
18   *   http://www.apache.org/licenses/LICENSE-2.0
19   *
20   * Unless required by applicable law or agreed to in writing,
21   * software distributed under the License is distributed on an
22   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23   * KIND, either express or implied.  See the License for the
24   * specific language governing permissions and limitations
25   * under the License.
26   */
27  
28  
29  public class MavenITmng5214DontMapWsdlToJar extends AbstractMavenIntegrationTestCase
30  {
31      public MavenITmng5214DontMapWsdlToJar()
32      {
33          super( "[3.0.5,)" );
34      }
35      
36      /**
37       * Test that the code that allows test-jar and ejb-client dependencies to resolve to the 
38       * target/classes or target/test-class is *not* applies to other types, e.g. wsdl.
39       */
40      public void testitTestPhase()
41          throws Exception
42      {
43          File setupDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5214/dependency" );
44          
45          Verifier setupVerifier = newVerifier( setupDir.getAbsolutePath() );
46          setupVerifier.setAutoclean( false );
47          setupVerifier.setMavenDebug( true );
48          setupVerifier.deleteDirectory( "target" );
49          setupVerifier.deleteArtifacts( "org.apache.maven.its.mng5214" );
50          setupVerifier.setLogFileName( "log-setup.txt" );
51          setupVerifier.addCliOption( "-PcreateWsdl" );
52          setupVerifier.executeGoal( "generate-resources" );
53  
54          File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5214" );
55          
56          Verifier verifier = newVerifier( testDir.getAbsolutePath() );
57          verifier.setAutoclean( false );
58          verifier.deleteDirectory( "consumer/target" );
59          verifier.deleteDirectory( "dependency/target" );
60          verifier.setLogFileName( "log-test.txt" );
61          verifier.executeGoal( "test" );
62          verifier.verifyErrorFreeLog();
63          List lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
64          Iterator lineIt = lines.iterator();
65          // RESOLVE-ONE-DEPENDENCY org.apache.maven.its.mng5214:dependency:wsdl:1.0-SNAPSHOT $ /tmp/it.repo/org/apache/maven/its/mng5214/dependency/1.0-SNAPSHOT/dependency-1.0-SNAPSHOT.wsdl
66          while ( lineIt.hasNext() )
67          {
68              String line = (String) lineIt.next();
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  }