1 /**
2 *
3 */
4 package net.sf.statsvn.util;
5
6 import java.io.IOException;
7 import java.util.Iterator;
8 import java.util.Vector;
9
10 import junit.framework.TestCase;
11 import net.sf.statcvs.input.LogSyntaxException;
12 import net.sf.statcvs.output.ConfigurationException;
13 import net.sf.statcvs.output.ConfigurationOptions;
14 import net.sf.statsvn.output.SvnConfigurationOptions;
15
16 /**
17 * @author Jason Kealey
18 *
19 */
20 public class SvnDiffUtilsTest extends TestCase {
21 public void testSimple() {
22 try {
23 SvnConfigurationOptions.setSvnUsername("jkealey");
24 SvnConfigurationOptions.setSvnPassword("PASSWORD");
25 ConfigurationOptions.setCheckedOutDirectory("k:\\work\\lavablast");
26 SvnInfoUtils.loadInfo();
27
28 final Vector output = SvnDiffUtils.getLineDiff("2435");
29
30 for (final Iterator iter = output.iterator(); iter.hasNext();) {
31 final Object[] element = (Object[]) iter.next();
32 if (element.length == 3) {
33 final String file = element[0].toString();
34 final int[] diff = (int[]) element[1];
35 final Boolean isBinary = (Boolean) element[2];
36 System.out.println("File: " + file + ", Added: " + diff[0] + ", Removed: " + diff[1] + ", Binary:" + isBinary);
37 }
38 }
39
40 } catch (final IOException e) {
41
42 e.printStackTrace();
43 } catch (final BinaryDiffException e) {
44
45 e.printStackTrace();
46 } catch (final ConfigurationException e) {
47
48 e.printStackTrace();
49 } catch (final LogSyntaxException e) {
50
51 e.printStackTrace();
52 }
53 }
54 }