79
80
public void testVerify()
80
81
throws SubversionException, IOException
82
OneTest thisTest = new OneTest(false);
83
OneTest thisTest = new OneTest(false, true);
83
84
admin.verify(thisTest.getRepository(), Revision.getInstance(0),
84
85
Revision.HEAD, null);
87
/* This test only tests the call down to the C++ layer. */
88
private class VerifyCallback implements ReposVerifyCallback
91
public int reverr = 0;
92
public boolean keepGoing = false;
94
public void onVerifyError(long revision, ClientException verifyError)
95
throws ClientException
97
if (revision == Revision.SVN_INVALID_REVNUM) {
113
private boolean tryToBreakRepo(OneTest test) throws IOException
115
File repo = test.getRepository();
117
// Check for a sharded repo first
118
File rev1 = new File(repo, "db/revs/0/1");
119
if (!rev1.exists() || !rev1.setWritable(true))
122
rev1 = new File(repo, "db/revs/1");
124
if (!rev1.exists() || !rev1.setWritable(true))
127
FileWriter fd = new FileWriter(rev1);
128
fd.write("inserting junk to corrupt the rev");
133
public void testVerifyBrokenRepo() throws Throwable
135
OneTest thisTest = new OneTest(false, true);
137
if (!tryToBreakRepo(thisTest)) {
138
// We don't support the repos format
139
System.err.print("Cannot break repository for verify test.");
143
VerifyCallback cb = new VerifyCallback();
144
cb.keepGoing = false;
147
admin.verify(thisTest.getRepository(),
148
Revision.getInstance(0),
150
false, false, null, cb);
152
catch(ClientException ex) {
153
assertEquals(cb.mderr, 1);
154
assertEquals(cb.reverr, 0);
158
assert("Verify did not catch repository corruption." == "");
161
public void testVerifyBrokenRepo_KeepGoing() throws Throwable
163
OneTest thisTest = new OneTest(false, true);
165
if (!tryToBreakRepo(thisTest)) {
166
// We don't support the repos format
167
System.err.print("Cannot break repository for verify test.");
171
VerifyCallback cb = new VerifyCallback();
174
admin.verify(thisTest.getRepository(),
175
Revision.getInstance(0),
177
false, false, null, cb);
179
assertEquals(cb.mderr, 1);
180
assertEquals(cb.reverr, 1);
183
/* this test only tests the call down to the C++ layer. */
88
184
public void testUpgrade()
89
185
throws SubversionException, IOException