001package org.apache.maven.scm.provider.tfs.command; 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 org.apache.maven.scm.ScmFile; 023import org.apache.maven.scm.ScmFileStatus; 024import org.apache.maven.scm.provider.tfs.TfsScmProviderRepository; 025import org.apache.maven.scm.provider.tfs.command.consumer.ServerFileListConsumer; 026import org.codehaus.plexus.util.cli.Commandline; 027 028public class TfsListCommandTest 029 extends TfsCommandTest 030{ 031 032 private ServerFileListConsumer consumer; 033 034 protected void setUp() 035 throws Exception 036 { 037 super.setUp(); 038 consumer = new ServerFileListConsumer(); 039 } 040 041 public void testCommandline() 042 throws Exception 043 { 044 TfsScmProviderRepository repo = getScmProviderRepository(); 045 Commandline cmd = new TfsListCommand().createCommand( repo, getScmFileSet(), true ).getCommandline(); 046 String expected = "tf dir -login:user,password -recursive " + getFileList(); 047 assertCommandLine( expected, getWorkingDirectory(), cmd ); 048 } 049 050 public void testMSCommand() 051 { 052 consumer.consumeLine( "$/junk/com.teamprise.core/libs/xstream-1.1.3/lib:" ); 053 consumer.consumeLine( "xpp3-1.1.3.4d_b4_min.jar" ); 054 consumer.consumeLine( "xpp3-license.txt" ); 055 consumer.consumeLine( "" ); 056 consumer.consumeLine( "$/junk/com.teamprise.core/messages:" ); 057 consumer.consumeLine( "$com" ); 058 consumer.consumeLine( "" ); 059 consumer.consumeLine( "$/junk/com.teamprise.core/messages/com:" ); 060 consumer.consumeLine( "$teamprise" ); 061 consumer.consumeLine( "" ); 062 consumer.consumeLine( "$/junk/com.teamprise.core/messages/com/teamprise:" ); 063 consumer.consumeLine( "$core" ); 064 consumer.consumeLine( "" ); 065 consumer.consumeLine( "$/junk/com.teamprise.core/messages/com/teamprise/core:" ); 066 consumer.consumeLine( "$pguidance" ); 067 consumer.consumeLine( "$workitem" ); 068 069 assertNotNull( consumer.getFiles() ); 070 assertEquals( 9, consumer.getFiles().size() ); 071 assertTrue( consumer.getFiles().contains( 072 new ScmFile( 073 "$/junk/com.teamprise.core/libs/xstream-1.1.3/lib/xpp3-license.txt", 074 ScmFileStatus.CHECKED_OUT ) ) ); 075 assertTrue( consumer.getFiles().contains( 076 new ScmFile( "$/junk/com.teamprise.core/messages/com", 077 ScmFileStatus.CHECKED_OUT ) ) ); 078 assertTrue( consumer.getFiles().contains( 079 new ScmFile( 080 "$/junk/com.teamprise.core/messages/com/teamprise/core/pguidance", 081 ScmFileStatus.CHECKED_OUT ) ) ); 082 } 083 084}