1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.git.model;
17
18 import java.io.IOException;
19 import java.util.Arrays;
20
21 import org.eclipse.jgit.lib.Constants;
22 import org.eclipse.jgit.lib.Repository;
23 import org.junit.Test;
24 import org.junit.runner.RunWith;
25 import org.junit.runners.BlockJUnit4ClassRunner;
26 import org.kuali.student.git.model.ref.exception.BranchRefExistsException;
27 import org.kuali.student.git.model.utils.GitTestUtils;
28
29
30
31
32
33
34
35
36 @RunWith(BlockJUnit4ClassRunner.class)
37 public class TestKSRevision65409To65443 extends AbstractGitImporterMainTestCase {
38
39
40
41
42 public TestKSRevision65409To65443() {
43 super("ks-r65409-to-r65443", true);
44 }
45
46 @Test
47 public void testImport () throws IOException, BranchRefExistsException {
48
49 runImporter (repository, 65409);
50
51
52
53 GitTestUtils.assertRefNotNull(repository, "enrollment_ks-ap_trunk", "ks-ap trunk should exist");
54
55 GitTestUtils.assertPathsExist (repository, "enrollment_ks-ap_trunk", Arrays.asList(new String [] {"ks-ap-ui/src/main/resources", "ks-ap-web"}));
56
57
58
59 runImporter (repository, 65425);
60
61
62 GitTestUtils.assertRefNull(repository, "enrollment_ks-ap_trunk", "ks-ap trunk should be null (deleted)");
63
64 GitTestUtils.assertRefNotNull(repository, "enrollment_ks-ap_branches_inactive_KSAP", "enrollment_ks-ap_branches_inactive_KSAP should exist");
65
66 GitTestUtils.assertRefNotNull(repository, "enrollment_ks-ap_trunk@65424", "enrollment_ks-ap_trunk@65424 should exist");
67
68 GitTestUtils.assertPathsExist (repository, "enrollment_ks-ap_trunk@65424", Arrays.asList(new String [] {"ks-ap-ui/src/main/resources", "ks-ap-web"}));
69
70
71
72
73
74
75 GitTestUtils.createBranch (repository, Constants.R_HEADS + "enrollment_ks-ap_branches_inactive_KSAP-M8", "pom.xml", "some text");
76
77 GitTestUtils.assertRefNotNull(repository, "enrollment_ks-ap_branches_inactive_KSAP-M8", "enrollment_ks-ap_branches_inactive_KSAP-M8 should exist");
78
79 GitTestUtils.assertPathsExist (repository, "enrollment_ks-ap_branches_inactive_KSAP-M8", Arrays.asList(new String [] {"pom.xml"}));
80
81
82 runImporter (repository, 65431);
83
84 GitTestUtils.assertRefNotNull(repository, Constants.R_HEADS + "enrollment_ks-ap_trunk", "expected ks-ap trunk to exist");
85
86 GitTestUtils.assertPathsExist (repository, "enrollment_ks-ap_trunk", Arrays.asList(new String [] {"KSAP", "KSAP-M8", "KSAP/ks-ap-ui/src/main/resources", "KSAP-M8/pom.xml"}));
87
88 GitTestUtils.assertRefNull(repository, Constants.R_HEADS + "enrollment_ks-ap_branches_inactive_KSAP", "expected ks-ap inactive KSAP to not exist");
89
90 GitTestUtils.assertRefNull(repository, Constants.R_HEADS + "enrollment_ks-ap_branches_inactive_KSAP-M8", "expected ks-ap inactive KSAP-M8 to not exist");
91
92 runImporter (repository, 65434);
93
94
95
96 GitTestUtils.createBranch (repository, Constants.R_HEADS + "enrollment_ks-ap_branches_KSAP-M7", "pom.xml", "some text");
97
98 runImporter (repository, 65435);
99
100 GitTestUtils.assertRefNotNull(repository, Constants.R_HEADS + "enrollment_ks-ap_branches_inactive_KSAP-M7", "expected ks-ap trunk to exist");
101
102 GitTestUtils.assertPathsExist (repository, "enrollment_ks-ap_branches_inactive_KSAP-M7", Arrays.asList(new String [] {"pom.xml"}));
103
104 GitTestUtils.assertRefNull(repository, Constants.R_HEADS + "enrollment_ks-ap_branches_KSAP-M7", "expected ks-ap KSAP-M7 to not exist");
105
106
107 GitTestUtils.createBranch (repository, Constants.R_HEADS + "enrollment_ks-ap_branches_KSAP-archived-2013-09-25", "pom.xml", "some text");
108
109 runImporter (repository, 65437);
110
111 GitTestUtils.assertRefNotNull(repository, Constants.R_HEADS + "enrollment_ks-ap_branches_inactive_KSAP-archived-2013-09-25", "expected ks-ap braches inactive KSAP-2013-09-25 to exist");
112
113 GitTestUtils.assertRefNull(repository, Constants.R_HEADS + "enrollment_ks-ap_branches_KSAP-archived-2013-09-25", "expected ks-ap KSAP-archived-2013-09-25 to not exist");
114
115 runImporter (repository, 65439);
116
117 GitTestUtils.assertRefNotNull(repository, Constants.R_HEADS + "enrollment_ks-ap_inactive", "expected ks-ap inactive to exist");
118
119
120
121
122 runImporter (repository, 65440);
123
124 GitTestUtils.assertRefNotNull(repository, Constants.R_HEADS + "enrollment_ks-ap_branches_KSAP", "expected ks-ap branches KSAP to exist");
125
126 GitTestUtils.assertRefNull(repository, Constants.R_HEADS + "enrollment_ks-ap_inactive", "expected ks-ap inactive to not exist");
127
128 runImporter (repository, 65441);
129
130 GitTestUtils.assertRefNotNull(repository, Constants.R_HEADS + "enrollment_ks-ap_branches_KSAP-M8", "expected ks-ap branches KSAP-M8 to exist");
131
132 GitTestUtils.assertPathsExist (repository, "enrollment_ks-ap_branches_KSAP-M8", Arrays.asList(new String [] {"pom.xml"}));
133
134
135
136
137 runImporter (repository, 65442);
138
139 GitTestUtils.assertRefNull(repository, Constants.R_HEADS + "enrollment_ks-ap_trunk", "expected ks-ap trunk to not exist");
140
141 runImporter (repository, 65443);
142
143 GitTestUtils.assertRefNotNull(repository, Constants.R_HEADS + "enrollment_ks-ap_trunk", "expected ks-ap trunk to exist");
144
145 GitTestUtils.assertRefNull(repository, Constants.R_HEADS + "enrollment_ks-ap_branches_KSAP", "expected ks-ap branches KSAP to not exist");
146
147
148 }
149
150 private void runImporter(Repository repository, long importRevision) throws IOException {
151 super.runImporter(repository, importRevision, "src/test/resources/ks-r" + importRevision + ".dump.bz2", "https://svn.kuali.org/repos/student", "fake-uuid");
152 }
153
154
155 }