View Javadoc
1   package org.apache.maven.scm.provider.svn.command.mkdir;
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 java.io.File;
23  
24  import org.apache.maven.scm.ScmFileSet;
25  import org.apache.maven.scm.command.list.ListScmResult;
26  import org.apache.maven.scm.command.mkdir.MkdirScmResult;
27  import org.apache.maven.scm.provider.svn.SvnScmTestUtils;
28  import org.apache.maven.scm.tck.command.mkdir.MkdirCommandTckTest;
29  
30  /**
31   * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
32   *
33   */
34  public class SvnMkdirCommandTckTest
35      extends MkdirCommandTckTest
36  {
37      /** {@inheritDoc} */
38      public String getScmUrl()
39          throws Exception
40      {
41          return SvnScmTestUtils.getScmUrl( new File( getRepositoryRoot(), "trunk" ) );
42      }
43  
44      /** {@inheritDoc} */
45      public void initRepo()
46          throws Exception
47      {
48          SvnScmTestUtils.initializeRepository( getRepositoryRoot() );
49      }
50      
51      public void testMkdirCommandMkdirUrl()
52          throws Exception
53      {
54          ScmFileSet fileSet = new ScmFileSet( getWorkingCopy(), new File( getMissingDirectory() ) );
55      
56          MkdirScmResult result = getScmManager().mkdir( getScmRepository(), fileSet, "Mkdir message", false );
57      
58          assertResultIsSuccess( result );
59      
60          assertNotNull( result.getRevision() );
61      
62          ListScmResult listResult = getScmManager().list( getScmRepository(), fileSet, true, null );
63      
64          assertTrue( "Directory should have been found.", listResult.isSuccess() );
65      }
66      
67      public void testMkdirCommandDirAlreadyAdded()
68          throws Exception
69      {
70          ScmFileSet fileSet = new ScmFileSet( getWorkingCopy(), new File( getMissingDirectory() ) );
71      
72          MkdirScmResult result = getScmManager().mkdir( getScmRepository(), fileSet, null, false );
73      
74          assertResultIsSuccess( result );
75      
76          assertNotNull( result.getRevision() );
77      
78          ListScmResult listResult = getScmManager().list( getScmRepository(), fileSet, true, null );
79          
80          assertTrue( "Directory should have been found.", listResult.isSuccess() );
81                  
82          // add the directory again
83          result = getScmManager().mkdir( getScmRepository(), fileSet, null, false );
84      
85          printOutputError( result ); 
86          
87          assertFalse( result.isSuccess() );
88      }
89  }