1   package org.apache.its;
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 static org.apache.its.util.TestUtils.archivePathFromChild;
23  import static org.apache.its.util.TestUtils.archivePathFromProject;
24  import static org.apache.its.util.TestUtils.assertZipContents;
25  import static org.apache.its.util.TestUtils.getTestDir;
26  
27  import org.apache.maven.it.VerificationException;
28  import org.apache.maven.it.Verifier;
29  import org.junit.Test;
30  
31  import java.io.File;
32  import java.io.IOException;
33  import java.net.URISyntaxException;
34  import java.util.HashSet;
35  import java.util.Set;
36  
37  public class IT_IncludeIdeFilesWithinSrcDir
38  {
39      
40      private static final String BASENAME = "src-contains-ide-files";
41      private static final String VERSION = "1";
42      
43      @Test
44      public void execute()
45          throws VerificationException, IOException, URISyntaxException
46      {
47          File testDir = getTestDir( BASENAME );
48          
49          Verifier verifier = new Verifier( testDir.getAbsolutePath() );
50          
51          verifier.executeGoal( "package" );
52          
53          verifier.verifyErrorFreeLog();
54          verifier.resetStreams();
55          
56          File assembly = new File( testDir, "target/" + BASENAME + "-" + VERSION + "-source-release.zip" );
57          
58          Set<String> required = new HashSet<String>();
59          
60          required.add( archivePathFromProject( BASENAME, VERSION, "/pom.xml" ) );
61          required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/pom.xml" ) );
62  
63          required.add( archivePathFromProject( BASENAME, VERSION, "/src/test/resources/.classpath" ) );
64          required.add( archivePathFromProject( BASENAME, VERSION, "/src/test/resources/.project" ) );
65          required.add( archivePathFromProject( BASENAME, VERSION, "/src/test/resources/maven-eclipse.xml" ) );
66          required.add( archivePathFromProject( BASENAME, VERSION, "/src/test/resources/ide-excludes.iml" ) );
67          required.add( archivePathFromProject( BASENAME, VERSION, "/src/test/resources/ide-excludes.ipr" ) );
68          required.add( archivePathFromProject( BASENAME, VERSION, "/src/test/resources/ide-excludes.iws" ) );
69          required.add( archivePathFromProject( BASENAME, VERSION, "/src/test/resources/.deployables/" ) );
70          required.add( archivePathFromProject( BASENAME, VERSION, "/src/test/resources/.settings/" ) );
71          required.add( archivePathFromProject( BASENAME, VERSION, "/src/test/resources/.wtpmodules/" ) );
72          required.add( archivePathFromProject( BASENAME, VERSION, "/src/test/resources/.externalToolBuilders/" ) );
73  
74          required.add( archivePathFromProject( BASENAME, VERSION, "/src/test/resources/release.properties" ) );
75          required.add( archivePathFromProject( BASENAME, VERSION, "/src/test/resources/pom.xml.releaseBackup" ) );
76  
77          required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/test/resources/.classpath" ) );
78          required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/test/resources/.project" ) );
79          required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/test/resources/maven-eclipse.xml" ) );
80          required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/test/resources/ide-excludes.iml" ) );
81          required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/test/resources/ide-excludes.ipr" ) );
82          required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/test/resources/ide-excludes.iws" ) );
83          required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/test/resources/.deployables/" ) );
84          required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/test/resources/.settings/" ) );
85          required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/test/resources/.wtpmodules/" ) );
86          required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/test/resources/.externalToolBuilders/" ) );
87  
88          required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/test/resources/release.properties" ) );
89          required.add( archivePathFromChild( BASENAME, VERSION, "child1", "/src/test/resources/pom.xml.releaseBackup" ) );
90          
91          Set<String> banned = new HashSet<String>();
92          
93          assertZipContents( required, banned, assembly );
94      }
95  
96  }