001package org.apache.maven.scm.manager; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import junit.framework.TestCase; 023import org.apache.maven.scm.provider.ScmProvider; 024import org.apache.maven.scm.provider.ScmProviderStub; 025import org.apache.maven.scm.repository.ScmRepository; 026import org.apache.maven.scm.repository.ScmRepositoryStub; 027 028import java.io.File; 029import java.util.ArrayList; 030import java.util.List; 031 032/** 033 * Test for the ScmManagerStub 034 * 035 * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a> 036 * 037 */ 038public class ScmManagerStubTest 039 extends TestCase 040{ 041 042 private ScmManagerStub scmManagerStub; 043 044 private List<String> messages; 045 046 private ScmProvider scmProvider; 047 048 private ScmRepository scmRepository; 049 050 protected void setUp() 051 throws Exception 052 { 053 super.setUp(); 054 055 messages = new ArrayList<String>( 0 ); 056 scmProvider = new ScmProviderStub(); 057 scmRepository = new ScmRepositoryStub(); 058 059 scmManagerStub = new ScmManagerStub(); 060 scmManagerStub.setMessages( messages ); 061 scmManagerStub.setScmProvider( scmProvider ); 062 scmManagerStub.setScmRepository( scmRepository ); 063 } 064 065 /* 066 * Test method for 'org.apache.maven.scm.manager.ScmManagerStub.makeScmRepository(String)' 067 */ 068 public void testMakeScmRepository() 069 throws Exception 070 { 071 ScmRepository repository = scmManagerStub.makeScmRepository( "" ); 072 assertSame( scmRepository, repository ); 073 } 074 075 /* 076 * Test method for 'org.apache.maven.scm.manager.ScmManagerStub.makeProviderScmRepository(String, File)' 077 */ 078 public void testMakeProviderScmRepository() 079 throws Exception 080 { 081 ScmRepository repository = scmManagerStub.makeProviderScmRepository( "", new File( "" ) ); 082 assertSame( scmRepository, repository ); 083 } 084 085 /* 086 * Test method for 'org.apache.maven.scm.manager.ScmManagerStub.validateScmRepository(String)' 087 */ 088 public void testValidateScmRepository() 089 { 090 List<String> list = scmManagerStub.validateScmRepository( "" ); 091 assertSame( messages, list ); 092 } 093 094 /* 095 * Test method for 'org.apache.maven.scm.manager.ScmManagerStub.getProviderByUrl(String)' 096 */ 097 public void testGetProviderByUrl() 098 throws Exception 099 { 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}