View Javadoc

1   package org.apache.maven.scm.manager;
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 junit.framework.TestCase;
23  import org.apache.maven.scm.provider.ScmProvider;
24  import org.apache.maven.scm.provider.ScmProviderStub;
25  import org.apache.maven.scm.repository.ScmRepository;
26  import org.apache.maven.scm.repository.ScmRepositoryStub;
27  
28  import java.io.File;
29  import java.util.ArrayList;
30  import java.util.List;
31  
32  /**
33   * Test for the ScmManagerStub
34   *
35   * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
36   *
37   */
38  public class ScmManagerStubTest
39      extends TestCase
40  {
41  
42      private ScmManagerStub scmManagerStub;
43  
44      private List<String> messages;
45  
46      private ScmProvider scmProvider;
47  
48      private ScmRepository scmRepository;
49  
50      protected void setUp()
51          throws Exception
52      {
53          super.setUp();
54  
55          messages = new ArrayList<String>( 0 );
56          scmProvider = new ScmProviderStub();
57          scmRepository = new ScmRepositoryStub();
58  
59          scmManagerStub = new ScmManagerStub();
60          scmManagerStub.setMessages( messages );
61          scmManagerStub.setScmProvider( scmProvider );
62          scmManagerStub.setScmRepository( scmRepository );
63      }
64  
65      /*
66       * Test method for 'org.apache.maven.scm.manager.ScmManagerStub.makeScmRepository(String)'
67       */
68      public void testMakeScmRepository()
69          throws Exception
70      {
71          ScmRepository repository = scmManagerStub.makeScmRepository( "" );
72          assertSame( scmRepository, repository );
73      }
74  
75      /*
76       * Test method for 'org.apache.maven.scm.manager.ScmManagerStub.makeProviderScmRepository(String, File)'
77       */
78      public void testMakeProviderScmRepository()
79          throws Exception
80      {
81          ScmRepository repository = scmManagerStub.makeProviderScmRepository( "", new File( "" ) );
82          assertSame( scmRepository, repository );
83      }
84  
85      /*
86       * Test method for 'org.apache.maven.scm.manager.ScmManagerStub.validateScmRepository(String)'
87       */
88      public void testValidateScmRepository()
89      {
90          List<String> list = scmManagerStub.validateScmRepository( "" );
91          assertSame( messages, list );
92      }
93  
94      /*
95       * Test method for 'org.apache.maven.scm.manager.ScmManagerStub.getProviderByUrl(String)'
96       */
97      public void testGetProviderByUrl()
98          throws Exception
99      {
100         ScmProvider providerByUrl = scmManagerStub.getProviderByUrl( "" );
101         assertSame( scmProvider, providerByUrl );
102     }
103 
104     /*
105      * Test method for 'org.apache.maven.scm.manager.ScmManagerStub.getProviderByType(String)'
106      */
107     public void testGetProviderByType()
108         throws Exception
109     {
110         ScmProvider providerByType = scmManagerStub.getProviderByType( "" );
111         assertSame( scmProvider, providerByType );
112     }
113 
114     /*
115      * Test method for 'org.apache.maven.scm.manager.ScmManagerStub.getProviderByRepository(ScmRepository)'
116      */
117     public void testGetProviderByRepository()
118         throws Exception
119     {
120         ScmProvider providerByRepository = scmManagerStub.getProviderByRepository( new ScmRepositoryStub() );
121         assertSame( scmProvider, providerByRepository );
122     }
123 
124 }