View Javadoc
1   /*
2    * Copyright 2014 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 1.0 (the
5    * "License"); you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl1.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package org.kuali.student.git.model;
17  
18  import java.io.BufferedReader;
19  import java.io.File;
20  import java.io.FileInputStream;
21  import java.io.IOException;
22  import java.io.InputStreamReader;
23  
24  import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
25  import org.apache.commons.io.FileUtils;
26  import org.junit.Assert;
27  import org.junit.Test;
28  import org.junit.runner.RunWith;
29  import org.junit.runners.BlockJUnit4ClassRunner;
30  import org.kuali.student.git.importer.GitImporterMain;
31  
32  /**
33   * 
34   * Test the importer on KS Revision 29500 to make sure the svn:mergeinfo properly is being indexed properly.
35   * @author Kuali Student Team
36   *
37   */
38  @RunWith(BlockJUnit4ClassRunner.class)
39  public class TestKSRevision29500 {
40  
41  	/**
42  	 * @param name
43  	 */
44  	public TestKSRevision29500() {
45  	}
46  
47  	@Test
48  	public void testRevision29500 () throws IOException {
49  		File gitRepository = new File ("target/ks-r29500");
50  		
51  		FileUtils.deleteDirectory(gitRepository);
52  		
53  		GitRepositoryUtils
54  				.buildFileRepository(gitRepository, true);
55  		
56  		GitImporterMain.main(new String [] {"src/test/resources/ks-r29500.dump.bz2", gitRepository.getAbsolutePath(), "target/ks-r29500-ks-veto.log", "target/ks-r29500-ks-copyFrom-skipped.log", "target/ks-r29500-blob.log", "0", "https://svn.kuali.org/repos/student", "uuid"});
57  	
58  		BufferedReader reader = new BufferedReader(new InputStreamReader(new BZip2CompressorInputStream(new FileInputStream("target/ks-r29500/jsvn/merge.map"))));
59  		
60  		String line1 = reader.readLine();
61  		
62  		Assert.assertNotNull(line1);
63  		
64  		Assert.assertEquals(true, line1.startsWith("29500::branches/ks-1.3::branches/ks-1.3-ec1::"));
65  		
66  		String line2 = reader.readLine();
67  		
68  		Assert.assertNotNull(line2);
69  		
70  		Assert.assertEquals(true, line2.startsWith("29500::branches/ks-1.3::branches/ks-1.3-merge:"));
71  		
72  		reader.close();
73  		
74  	}
75  	
76  }