1 package org.apache.maven.scm.provider.local.command.mkdir;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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.tck.command.mkdir.MkdirCommandTckTest;
28
29
30
31
32
33 public class LocalMkdirCommandTckTest
34 extends MkdirCommandTckTest
35 {
36 private static final String moduleName = "checkin-tck";
37
38 public String getScmUrl()
39 throws Exception
40 {
41 return "scm:local|" + getRepositoryRoot() + "|" + moduleName;
42 }
43
44 public void initRepo()
45 throws Exception
46 {
47 makeRepo( getRepositoryRoot() );
48 }
49
50 private void makeRepo( File workingDirectory )
51 throws Exception
52 {
53 makeFile( workingDirectory, moduleName + "/pom.xml", "/pom.xml" );
54
55 makeFile( workingDirectory, moduleName + "/readme.txt", "/readme.txt" );
56
57 makeFile( workingDirectory, moduleName + "/src/main/java/Application.java", "/src/main/java/Application.java" );
58
59 makeFile( workingDirectory, moduleName + "/src/test/java/Test.java", "/src/test/java/Test.java" );
60
61 makeDirectory( workingDirectory, moduleName + "/src/test/resources" );
62 }
63
64 public void testMkdirCommandMkdirUrl()
65 throws Exception
66 {
67 ScmFileSet fileSet = new ScmFileSet( getWorkingCopy(), new File( getMissingDirectory() ) );
68
69 MkdirScmResult result = getScmManager().mkdir( getScmRepository(), fileSet, "Mkdir message", false );
70
71 assertResultIsSuccess( result );
72
73 ListScmResult listResult = getScmManager().list( getScmRepository(), fileSet, true, null );
74
75 assertTrue( "Directory should have been found.", listResult.isSuccess() );
76 }
77
78 public void testMkdirCommandDirAlreadyAdded()
79 throws Exception
80 {
81 ScmFileSet fileSet = new ScmFileSet( getWorkingCopy(), new File( getMissingDirectory() ) );
82
83 MkdirScmResult result = getScmManager().mkdir( getScmRepository(), fileSet, "Mkdir message", false );
84
85 assertResultIsSuccess( result );
86
87 ListScmResult listResult = getScmManager().list( getScmRepository(), fileSet, true, null );
88
89 assertTrue( "Directory should have been found.", listResult.isSuccess() );
90
91
92 result = getScmManager().mkdir( getScmRepository(), fileSet, "Mkdir message", false );
93
94 assertFalse( result.isSuccess() );
95
96 printOutputError( result );
97 }
98 }