1 package org.apache.maven.scm.provider.jazz;
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 import java.util.ArrayList;
24 import java.util.Iterator;
25 import java.util.List;
26
27 import org.apache.maven.scm.ScmFileSet;
28 import org.apache.maven.scm.ScmTestCase;
29 import org.apache.maven.scm.provider.jazz.repository.JazzScmProviderRepository;
30
31 /**
32 * The base class for our Jazz test cases.
33 * It sets up a dummy JazzScmProviderRepository for testing purposes.
34 *
35 * @author <a href="mailto:ChrisGWarp@gmail.com">Chris Graham</a>
36 */
37 public abstract class JazzScmTestCase
38 extends ScmTestCase
39 {
40
41 /**
42 * Get a dummy JazzScmProviderRepostitory to allow us to test.
43 * @return The dummy JazzScmProviderRepository.
44 */
45 protected JazzScmProviderRepository getScmProviderRepository()
46 {
47 return new JazzScmProviderRepository( "https://localhost:9443/jazz", "myUserName", "myPassword",
48 "localhost", 9443, "Dave's Repository Workspace" );
49 }
50
51 /**
52 * Return a list of our files, space separated as a single string.
53 * @return The list of files.
54 */
55 protected String getFiles()
56 {
57 String path = "";
58 for ( Iterator<File> it = getScmFileSet().getFileList().iterator(); it.hasNext(); )
59 {
60 File file = (File) it.next();
61 path += file.getName() + " ";
62 }
63 return path.trim();
64 }
65
66 /**
67 * Return a dummy set of files.
68 * @return A ScmFileSet of dummy files to allow us to test.
69 */
70 protected ScmFileSet getScmFileSet()
71 {
72 File file1 = new File( "file1" );
73 File file2 = new File( "file2" );
74 List<File> fileList = new ArrayList<File>();
75
76 fileList.add( file1 );
77 fileList.add( file2 );
78
79 return new ScmFileSet( getWorkingDirectory(), fileList );
80 }
81 }