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.Collections;
35  import java.util.HashSet;
36  import java.util.Set;
37  
38  public class IT_004_IdeExcludes
39  {
40      
41      private static final String BASENAME = "ide-excludes";
42      private static final String VERSION = "1";
43      
44      @Test
45      public void execute()
46          throws VerificationException, IOException, URISyntaxException
47      {
48          File testDir = getTestDir( BASENAME );
49          
50          Verifier verifier = new Verifier( testDir.getAbsolutePath() );
51          
52          verifier.executeGoal( "package" );
53          
54          verifier.verifyErrorFreeLog();
55          verifier.resetStreams();
56          
57          File assembly = new File( testDir, "target/" + BASENAME + "-" + VERSION + "-source-release.zip" );
58          
59          Set<String> required = Collections.emptySet();
60          
61          Set<String> banned = new HashSet<String>();
62          
63          banned.add( archivePathFromProject( BASENAME, VERSION, "/.classpath" ) );
64          banned.add( archivePathFromProject( BASENAME, VERSION, "/.project" ) );
65          banned.add( archivePathFromProject( BASENAME, VERSION, "/maven-eclipse.xml" ) );
66          banned.add( archivePathFromProject( BASENAME, VERSION, "/ide-excludes.iml" ) );
67          banned.add( archivePathFromProject( BASENAME, VERSION, "/ide-excludes.ipr" ) );
68          banned.add( archivePathFromProject( BASENAME, VERSION, "/ide-excludes.iws" ) );
69          banned.add( archivePathFromProject( BASENAME, VERSION, "/.deployables" ) );
70          banned.add( archivePathFromProject( BASENAME, VERSION, "/.settings" ) );
71          banned.add( archivePathFromProject( BASENAME, VERSION, "/.wtpmodules" ) );
72          banned.add( archivePathFromProject( BASENAME, VERSION, "/.externalToolBuilders" ) );
73          
74          banned.add( archivePathFromChild( BASENAME, VERSION, "child1", "/.classpath" ) );
75          banned.add( archivePathFromChild( BASENAME, VERSION, "child1", "/.project" ) );
76          banned.add( archivePathFromChild( BASENAME, VERSION, "child1", "/maven-eclipse.xml" ) );
77          banned.add( archivePathFromChild( BASENAME, VERSION, "child1", "/.deployables" ) );
78          banned.add( archivePathFromChild( BASENAME, VERSION, "child1", "/.settings" ) );
79          banned.add( archivePathFromChild( BASENAME, VERSION, "child1", "/.wtpmodules" ) );
80          banned.add( archivePathFromChild( BASENAME, VERSION, "child1", "/.externalToolBuilders" ) );
81          
82          banned.add( archivePathFromChild( BASENAME, VERSION, "child2", "/ide-excludes-child2.iml" ) );
83          banned.add( archivePathFromChild( BASENAME, VERSION, "child2", "/ide-excludes-child2.ipr" ) );
84          banned.add( archivePathFromChild( BASENAME, VERSION, "child2", "/ide-excludes-child2.iws" ) );
85          
86          assertZipContents( required, banned, assembly );
87      }
88  
89  }