View Javadoc
1   package org.apache.maven.scm.provider.tfs.command;
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 org.apache.maven.scm.ScmFile;
23  import org.apache.maven.scm.ScmFileStatus;
24  import org.apache.maven.scm.provider.tfs.TfsScmProviderRepository;
25  import org.apache.maven.scm.provider.tfs.command.consumer.ServerFileListConsumer;
26  import org.codehaus.plexus.util.cli.Commandline;
27  
28  public class TfsListCommandTest
29      extends TfsCommandTest
30  {
31  
32      private ServerFileListConsumer consumer;
33  
34      protected void setUp()
35          throws Exception
36      {
37          super.setUp();
38          consumer = new ServerFileListConsumer();
39      }
40  
41      public void testCommandline()
42          throws Exception    
43      {
44          TfsScmProviderRepository repo = getScmProviderRepository();
45          Commandline cmd = new TfsListCommand().createCommand( repo, getScmFileSet(), true ).getCommandline();
46          String expected = "tf dir -login:user,password -recursive " + getFileList();
47          assertCommandLine( expected, getWorkingDirectory(), cmd );
48      }
49  
50      public void testMSCommand()
51      {
52          consumer.consumeLine( "$/junk/com.teamprise.core/libs/xstream-1.1.3/lib:" );
53          consumer.consumeLine( "xpp3-1.1.3.4d_b4_min.jar" );
54          consumer.consumeLine( "xpp3-license.txt" );
55          consumer.consumeLine( "" );
56          consumer.consumeLine( "$/junk/com.teamprise.core/messages:" );
57          consumer.consumeLine( "$com" );
58          consumer.consumeLine( "" );
59          consumer.consumeLine( "$/junk/com.teamprise.core/messages/com:" );
60          consumer.consumeLine( "$teamprise" );
61          consumer.consumeLine( "" );
62          consumer.consumeLine( "$/junk/com.teamprise.core/messages/com/teamprise:" );
63          consumer.consumeLine( "$core" );
64          consumer.consumeLine( "" );
65          consumer.consumeLine( "$/junk/com.teamprise.core/messages/com/teamprise/core:" );
66          consumer.consumeLine( "$pguidance" );
67          consumer.consumeLine( "$workitem" );
68  
69          assertNotNull( consumer.getFiles() );
70          assertEquals( 9, consumer.getFiles().size() );
71          assertTrue( consumer.getFiles().contains(
72                                                    new ScmFile(
73                                                                 "$/junk/com.teamprise.core/libs/xstream-1.1.3/lib/xpp3-license.txt",
74                                                                 ScmFileStatus.CHECKED_OUT ) ) );
75          assertTrue( consumer.getFiles().contains(
76                                                    new ScmFile( "$/junk/com.teamprise.core/messages/com",
77                                                                 ScmFileStatus.CHECKED_OUT ) ) );
78          assertTrue( consumer.getFiles().contains(
79                                                    new ScmFile(
80                                                                 "$/junk/com.teamprise.core/messages/com/teamprise/core/pguidance",
81                                                                 ScmFileStatus.CHECKED_OUT ) ) );
82      }
83  
84  }