001package org.apache.maven.scm.provider.vss.commands.status; 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 java.io.BufferedReader; 023import java.io.IOException; 024import java.io.InputStreamReader; 025 026import org.apache.maven.scm.ScmFileSet; 027import org.apache.maven.scm.ScmTestCase; 028import org.apache.maven.scm.manager.NoSuchScmProviderException; 029import org.apache.maven.scm.manager.ScmManager; 030import org.apache.maven.scm.manager.plexus.PlexusLogger; 031import org.apache.maven.scm.provider.vss.repository.VssScmProviderRepository; 032import org.apache.maven.scm.repository.ScmRepository; 033import org.apache.maven.scm.repository.ScmRepositoryException; 034import org.codehaus.plexus.util.IOUtil; 035 036/** 037 * @author <a href="mailto:matpimenta@gmail.com">Mateus Pimenta</a> 038 * 039 */ 040public class VssStatusConsumerTest 041 extends ScmTestCase 042{ 043 044 private ScmManager scmManager; 045 046 private org.codehaus.plexus.logging.Logger logger; 047 048 public void setUp() 049 throws Exception 050 { 051 super.setUp(); 052 scmManager = getScmManager(); 053 logger = getContainer().getLogger(); 054 } 055 056 public void testConsumeLine() 057 throws ScmRepositoryException, NoSuchScmProviderException, IOException 058 { 059 BufferedReader reader = new BufferedReader( new InputStreamReader( this.getResourceAsStream( "/test.txt" ), 060 "UTF-8" ) ); 061 try 062 { 063 ScmRepository repository = scmManager 064 .makeScmRepository( "scm:vss|username|password@C:/Program File/Visual Source Safe|D:/myProject" ); 065 ScmFileSet fileSet = new ScmFileSet( getTestFile( "target" ) ); 066 067 VssStatusConsumer consumer = new VssStatusConsumer( (VssScmProviderRepository) repository 068 .getProviderRepository(), new PlexusLogger( logger ), fileSet ); 069 070 String line = reader.readLine(); 071 while ( line != null ) 072 { 073 consumer.consumeLine( line ); 074 line = reader.readLine(); 075 } 076 } 077 finally 078 { 079 IOUtil.close( reader ); 080 } 081 } 082 083}