1   package org.apache.maven.plugin.dependency.utils;
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 java.io.IOException;
23  import java.util.HashSet;
24  import java.util.Set;
25  
26  import org.apache.maven.plugin.dependency.AbstractDependencyMojoTestCase;
27  
28  public class TestDependencyStatusSets
29      extends AbstractDependencyMojoTestCase
30  {
31  
32      protected void setUp()
33          throws Exception
34      {
35          // required for mojo lookups to work
36          super.setUp( "dss", true );
37      }
38  
39      public void testDependencyStatusSettersGetters()
40      {
41          /*
42           * DependencyStatusSets dss = new DependencyStatusSets(); Set set = new HashSet(); dss.setResolvedDependencies(
43           * set ); assertSame( set, dss.getResolvedDependencies() ); set = new HashSet(); dss.setUnResolvedDependencies(
44           * set ); assertSame( set, dss.getUnResolvedDependencies() ); set = new HashSet(); dss.setSkippedDependencies(
45           * set ); assertSame( set, dss.getSkippedDependencies() ); assertNotSame( dss.getResolvedDependencies(),
46           * dss.getSkippedDependencies() ); assertNotSame( dss.getResolvedDependencies(), dss.getUnResolvedDependencies() );
47           * assertNotSame( dss.getSkippedDependencies(), dss.getUnResolvedDependencies() );
48           */
49      }
50  
51      public void testDependencyStatusConstructor()
52      {
53          /*
54           * Set r = new HashSet(); Set u = new HashSet(); Set s = new HashSet(); DependencyStatusSets dss = new
55           * DependencyStatusSets( r, u, s ); assertSame( r, dss.getResolvedDependencies() ); assertSame( u,
56           * dss.getUnResolvedDependencies() ); assertSame( s, dss.getSkippedDependencies() );
57           */
58      }
59  
60      public void testDependencyStatusLog()
61          throws IOException
62      {
63          Set artifacts = this.stubFactory.getMixedArtifacts();
64          doTestDependencyStatusLog( artifacts );
65      }
66  
67      public void testDependencyStatusLogNullFiles()
68          throws IOException
69      {
70          this.stubFactory.setCreateFiles( false );
71          Set artifacts = this.stubFactory.getMixedArtifacts();
72          doTestDependencyStatusLog( artifacts );
73      }
74  
75      public void testDependencyStatusEmptySet()
76      {
77          doTestDependencyStatusLog( new HashSet() );
78      }
79  
80      public void doTestDependencyStatusLog( Set artifacts )
81      {
82          // TODO: implement logger to check correct output
83          // this test is just looking for unexpected exceptions.
84  
85          DependencyStatusSets dss = new DependencyStatusSets();
86          dss.getOutput( false );
87          dss.getOutput( true );
88  
89          dss = new DependencyStatusSets( artifacts, null, null );
90          dss.getOutput( false );
91          dss.getOutput( true );
92  
93          dss = new DependencyStatusSets( null, artifacts, null );
94          dss.getOutput( false );
95          dss.getOutput( true );
96  
97          dss = new DependencyStatusSets( null, null, artifacts );
98          dss.getOutput( false );
99          dss.getOutput( true );
100 
101         dss = new DependencyStatusSets( artifacts, artifacts, null );
102         dss.getOutput( false );
103         dss.getOutput( true );
104 
105         dss = new DependencyStatusSets( null, artifacts, artifacts );
106         dss.getOutput( false );
107         dss.getOutput( true );
108 
109         dss = new DependencyStatusSets( artifacts, null, artifacts );
110         dss.getOutput( false );
111         dss.getOutput( true );
112 
113         dss = new DependencyStatusSets( artifacts, artifacts, artifacts );
114         dss.getOutput( false );
115         dss.getOutput( true );
116         dss.getOutput( false, true );
117         dss.getOutput( true, true );
118         dss.getOutput( false, false );
119         dss.getOutput( true, false );
120 
121     }
122 }