View Javadoc
1   package org.apache.maven.scm.provider.jazz.command.unedit;
2   
3   import org.apache.maven.scm.ScmFileSet;
4   import org.apache.maven.scm.provider.jazz.JazzScmTestCase;
5   import org.apache.maven.scm.provider.jazz.repository.JazzScmProviderRepository;
6   import org.codehaus.plexus.util.cli.Commandline;
7   
8   import java.io.File;
9   
10  /*
11   * Licensed to the Apache Software Foundation (ASF) under one
12   * or more contributor license agreements.  See the NOTICE file
13   * distributed with this work for additional information
14   * regarding copyright ownership.  The ASF licenses this file
15   * to you under the Apache License, Version 2.0 (the
16   * "License"); you may not use this file except in compliance
17   * with the License.  You may obtain a copy of the License at
18   *
19   * http://www.apache.org/licenses/LICENSE-2.0
20   *
21   * Unless required by applicable law or agreed to in writing,
22   * software distributed under the License is distributed on an
23   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
24   * KIND, either express or implied.  See the License for the
25   * specific language governing permissions and limitations
26   * under the License.
27   */
28  
29  /**
30   * @author <a href="mailto:ChrisGWarp@gmail.com">Chris Graham</a>
31   */
32  public class JazzUnEditCommandTest
33      extends JazzScmTestCase
34  {
35      private JazzScmProviderRepository repo;
36  
37      protected void setUp()
38          throws Exception
39      {
40          super.setUp();
41          repo = getScmProviderRepository();
42      }
43  
44      public void testCreateUneditCommandWithSpecificFiles()
45          throws Exception
46      {
47          Commandline cmd = new JazzUnEditCommand().createUneditCommand( repo, getScmFileSet() ).getCommandline();
48          String expected =
49              "scm lock release --repository-uri https://localhost:9443/jazz --username myUserName --password myPassword file1 file2";
50          assertCommandLine( expected, getWorkingDirectory(), cmd );
51      }
52  
53      public void testCreateUneditCommandWithEmptyFileSet()
54          throws Exception
55      {
56          ScmFileSet scmFileSet = new ScmFileSet( new File( "." ) );
57          // An empty file set will be all files, which jazz will take as a "."
58          Commandline cmd =
59              new JazzUnEditCommand().createUneditCommand( repo, scmFileSet ).getCommandline();
60          String expected =
61              "scm lock release --repository-uri https://localhost:9443/jazz --username myUserName --password myPassword .";
62          assertCommandLine( expected, scmFileSet.getBasedir(), cmd );
63      }
64  }