Coverage Report - org.apache.maven.plugin.assembly.artifact.ResolutionManagementInfo
 
Classes in this File Line Coverage Branch Coverage Complexity
ResolutionManagementInfo
79%
31/39
83%
5/6
0
 
 1  
 package org.apache.maven.plugin.assembly.artifact;
 2  
 
 3  
 import org.apache.maven.artifact.Artifact;
 4  
 import org.apache.maven.project.MavenProject;
 5  
 import org.apache.maven.shared.artifact.filter.ScopeArtifactFilter;
 6  
 
 7  
 import java.util.LinkedHashSet;
 8  
 import java.util.Set;
 9  
 
 10  
 /**
 11  
  * Helper class used to accumulate scopes and modules (with binaries included) that are used in an assembly, for the
 12  
  * purposes of creating an aggregated managed-version map with dependency version conflicts resolved.
 13  
  * 
 14  
  * @author jdcasey
 15  
  */
 16  
 class ResolutionManagementInfo
 17  
 {
 18  
     private boolean resolutionRequired;
 19  
 
 20  3
     private final ScopeArtifactFilter scopeFilter = new ScopeArtifactFilter();
 21  
 
 22  
     private boolean resolvedTransitively;
 23  
 
 24  3
     private final Set<MavenProject> enabledProjects = new LinkedHashSet<MavenProject>();
 25  
 
 26  3
     private final Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
 27  
 
 28  
     ResolutionManagementInfo( final MavenProject currentProject )
 29  3
     {
 30  3
         enabledProjects.add( currentProject );
 31  3
     }
 32  
 
 33  
     boolean isResolutionRequired()
 34  
     {
 35  3
         return resolutionRequired;
 36  
     }
 37  
 
 38  
     void setResolutionRequired( final boolean resolutionRequired )
 39  
     {
 40  4
         this.resolutionRequired = resolutionRequired;
 41  4
     }
 42  
 
 43  
     boolean isResolvedTransitively()
 44  
     {
 45  1
         return resolvedTransitively;
 46  
     }
 47  
 
 48  
     void setResolvedTransitively( final boolean resolvedTransitively )
 49  
     {
 50  4
         this.resolvedTransitively = this.resolvedTransitively || resolvedTransitively;
 51  4
     }
 52  
 
 53  
     ScopeArtifactFilter getScopeFilter()
 54  
     {
 55  19
         return scopeFilter;
 56  
     }
 57  
 
 58  
     void enableCompileScope()
 59  
     {
 60  3
         scopeFilter.setIncludeCompileScope( true );
 61  3
         scopeFilter.setIncludeProvidedScope( true );
 62  3
         scopeFilter.setIncludeSystemScope( true );
 63  3
     }
 64  
 
 65  
     void enableProvidedScope()
 66  
     {
 67  0
         scopeFilter.setIncludeProvidedScope( true );
 68  0
     }
 69  
 
 70  
     void enableRuntimeScope()
 71  
     {
 72  0
         scopeFilter.setIncludeRuntimeScope( true );
 73  0
         scopeFilter.setIncludeCompileScope( true );
 74  0
     }
 75  
 
 76  
     void enableTestScope()
 77  
     {
 78  1
         scopeFilter.setIncludeTestScope( true );
 79  1
         scopeFilter.setIncludeCompileScope( true );
 80  1
         scopeFilter.setIncludeProvidedScope( true );
 81  1
         scopeFilter.setIncludeSystemScope( true );
 82  1
         scopeFilter.setIncludeRuntimeScope( true );
 83  1
     }
 84  
 
 85  
     void enableSystemScope()
 86  
     {
 87  2
         scopeFilter.setIncludeSystemScope( true );
 88  2
     }
 89  
 
 90  
     void enableProjectResolution( final MavenProject project )
 91  
     {
 92  3
         if ( !enabledProjects.contains( project ) )
 93  
         {
 94  3
             enabledProjects.add( project );
 95  
         }
 96  3
     }
 97  
 
 98  
     Set<MavenProject> getEnabledProjects()
 99  
     {
 100  1
         return enabledProjects;
 101  
     }
 102  
 
 103  
     Set<Artifact> getArtifacts()
 104  
     {
 105  0
         return artifacts;
 106  
     }
 107  
 
 108  
     void addArtifacts( final Set<Artifact> a )
 109  
     {
 110  4
         artifacts.addAll( a );
 111  4
     }
 112  
 
 113  
     void addArtifact( final Artifact a )
 114  
     {
 115  0
         artifacts.add( a );
 116  0
     }
 117  
 }