3
* ====================================================================
4
* Copyright (c) 2003-2004 CollabNet. All rights reserved.
6
* This software is licensed as described in the file COPYING, which
7
* you should have received as part of this distribution. The terms
8
* are also available at http://subversion.tigris.org/license-1.html.
9
* If newer versions of this license are posted there, you may use a
10
* newer version instead, at your option.
12
* This software consists of voluntary contributions made by many
13
* individuals. For exact contribution history, see the revision
14
* history and logs, available at http://subversion.tigris.org/.
15
* ====================================================================
18
package org.tigris.subversion.javahl.tests;
20
import junit.framework.TestSuite;
21
import junit.framework.TestResult;
22
import org.tigris.subversion.javahl.*;
25
import java.io.FileOutputStream;
26
import java.io.PrintWriter;
27
import java.util.Arrays;
29
* this class tests the basic functionality of javahl binding. It was inspired
30
* by the tests in subversion/tests/clients/cmdline/basic_tests.py
32
public class BasicTests extends SVNTests
35
* base name of all our tests
37
public final static String testName = "basic_test";
40
* Initialize the testBaseName and the testCounter, if this is the first
45
if(!testName.equals(testBaseName))
48
testBaseName = testName;
53
* Build a test suite of all tests of this class
54
* @return the new test suite
56
public static TestSuite suite() {
57
return new TestSuite(BasicTests.class);
61
* Main method to run tests standalone
62
* @param args command line arguments to specify root directory and root
65
public static void main(String[] args) {
67
TestResult tr = junit.textui.TestRunner.run(suite());
68
if (tr.errorCount() != 0 || tr.failureCount() != 0) {
75
* test the basic SVNCLient.checkout functionality
78
public void testBasicCheckout() throws Throwable
80
// build the test setup
81
OneTest thisTest = new OneTest();
84
// obstructed checkout must fail
85
client.checkout(thisTest.getUrl() + "/A", thisTest.getWCPath(),
87
fail("missing exception");
89
catch (ClientException e)
93
File mu = new File(thisTest.getWorkingCopy(), "A/mu");
94
PrintWriter muPW = new PrintWriter(new FileOutputStream(mu, true));
95
muPW.print("appended mu text");
97
thisTest.getWc().setItemTextStatus("A/mu", Status.Kind.modified);
99
// delete A/B/lambda without svn
100
File lambda = new File(thisTest.getWorkingCopy(), "A/B/lambda");
102
thisTest.getWc().setItemTextStatus("A/B/lambda", Status.Kind.missing);
105
client.remove(new String[]{thisTest.getWCPath() + "/A/D/G"}, null,
107
thisTest.getWc().setItemTextStatus("A/D/G", Status.Kind.deleted);
108
thisTest.getWc().setItemTextStatus("A/D/G/pi", Status.Kind.deleted);
109
thisTest.getWc().setItemTextStatus("A/D/G/rho", Status.Kind.deleted);
110
thisTest.getWc().setItemTextStatus("A/D/G/tau", Status.Kind.deleted);
112
// check the status of the working copy
113
thisTest.checkStatus();
115
// recheckout the working copy
116
client.checkout(thisTest.getUrl(), thisTest.getWCPath(), null, true);
118
// deleted file should reapear
119
thisTest.getWc().setItemTextStatus("A/B/lambda", Status.Kind.normal);
121
// check the status of the working copy
122
thisTest.checkStatus();
126
* test the basic SVNClient.status functionality
129
public void testBasicStatus() throws Throwable
131
// build the test setup
132
OneTest thisTest = new OneTest();
134
// check the status of the working copy
135
thisTest.checkStatus();
139
* test the basic SVNClient.commit functionality
142
public void testBasicCommit() throws Throwable
144
// build the test setup
145
OneTest thisTest = new OneTest();
148
File mu = new File(thisTest.getWorkingCopy(), "A/mu");
149
PrintWriter muPW = new PrintWriter(new FileOutputStream(mu, true));
150
muPW.print("appended mu text");
152
thisTest.getWc().setItemWorkingCopyRevision("A/mu", 2);
153
thisTest.getWc().setItemContent("A/mu",
154
thisTest.getWc().getItemContent("A/mu") + "appended mu text");
155
addExpectedCommitItem(thisTest.getWCPath(),
156
thisTest.getUrl(), "A/mu",NodeKind.file,
157
CommitItemStateFlags.TextMods);
159
// modify file A/D/G/rho
160
File rho = new File(thisTest.getWorkingCopy(), "A/D/G/rho");
161
PrintWriter rhoPW = new PrintWriter(new FileOutputStream(rho, true));
162
rhoPW.print("new appended text for rho");
164
thisTest.getWc().setItemWorkingCopyRevision("A/D/G/rho", 2);
165
thisTest.getWc().setItemContent("A/D/G/rho",
166
thisTest.getWc().getItemContent("A/D/G/rho")
167
+ "new appended text for rho");
168
addExpectedCommitItem(thisTest.getWCPath(),
169
thisTest.getUrl(), "A/D/G/rho",NodeKind.file,
170
CommitItemStateFlags.TextMods);
172
// commit the changes
173
assertEquals("wrong revision number from commit",
174
client.commit(new String[]{thisTest.getWCPath()}, "log msg",
177
// check the status of the working copy
178
thisTest.checkStatus();
182
* test the basic SVNClient.update functionality
185
public void testBasicUpdate() throws Throwable
187
// build the test setup. Used for the changes
188
OneTest thisTest = new OneTest();
190
// build the backup test setup. That is the one that will be updated
191
OneTest backupTest = thisTest.copy(".backup");
194
File mu = new File(thisTest.getWorkingCopy(), "A/mu");
195
PrintWriter muPW = new PrintWriter(new FileOutputStream(mu, true));
196
muPW.print("appended mu text");
198
thisTest.getWc().setItemWorkingCopyRevision("A/mu", 2);
199
thisTest.getWc().setItemContent("A/mu",
200
thisTest.getWc().getItemContent("A/mu") + "appended mu text");
201
addExpectedCommitItem(thisTest.getWCPath(),
202
thisTest.getUrl(), "A/mu",NodeKind.file,
203
CommitItemStateFlags.TextMods);
206
File rho = new File(thisTest.getWorkingCopy(), "A/D/G/rho");
207
PrintWriter rhoPW = new PrintWriter(new FileOutputStream(rho, true));
208
rhoPW.print("new appended text for rho");
210
thisTest.getWc().setItemWorkingCopyRevision("A/D/G/rho", 2);
211
thisTest.getWc().setItemContent("A/D/G/rho",
212
thisTest.getWc().getItemContent("A/D/G/rho")
213
+ "new appended text for rho");
214
addExpectedCommitItem(thisTest.getWCPath(),
215
thisTest.getUrl(), "A/D/G/rho",NodeKind.file,
216
CommitItemStateFlags.TextMods);
218
// commit the changes
219
assertEquals("wrong revision number from commit",
220
client.commit(new String[]{thisTest.getWCPath()}, "log msg",
223
// check the status of the working copy
224
thisTest.checkStatus();
226
// update the backup test
227
assertEquals("wrong revision number from update",
228
client.update(backupTest.getWCPath(), null, true), 2);
230
// set the expected working copy layout for the backup test
231
backupTest.getWc().setItemWorkingCopyRevision("A/mu", 2);
232
backupTest.getWc().setItemContent("A/mu",
233
backupTest.getWc().getItemContent("A/mu") + "appended mu text");
234
backupTest.getWc().setItemWorkingCopyRevision("A/D/G/rho", 2);
235
backupTest.getWc().setItemContent("A/D/G/rho",
236
backupTest.getWc().getItemContent("A/D/G/rho")
237
+ "new appended text for rho");
239
// check the status of the working copy of the backup test
240
backupTest.checkStatus();
244
* test basic SVNClient.mkdir with url parameter functionality
247
public void testBasicMkdirUrl() throws Throwable
249
// build the test setup.
250
OneTest thisTest = new OneTest();
252
// create Y and Y/Z directories in the repository
253
addExpectedCommitItem(null, thisTest.getUrl(), "Y", NodeKind.none,
254
CommitItemStateFlags.Add);
255
addExpectedCommitItem(null, thisTest.getUrl(), "Y/Z", NodeKind.none,
256
CommitItemStateFlags.Add);
257
client.mkdir(new String[]{thisTest.getUrl() + "/Y",
258
thisTest.getUrl() + "/Y/Z"}, "log_msg");
260
// add the new directories the expected working copy layout
261
thisTest.getWc().addItem("Y", null);
262
thisTest.getWc().setItemWorkingCopyRevision("Y", 2);
263
thisTest.getWc().addItem("Y/Z", null);
264
thisTest.getWc().setItemWorkingCopyRevision("Y/Z", 2);
266
// update the working copy
267
assertEquals("wrong revision from update",
268
client.update(thisTest.getWCPath(), null, true), 2);
270
// check the status of the working copy
271
thisTest.checkStatus();
275
* test the basic SVNClient.update functionality with concurrent changes
276
* in the repository and the working copy
279
public void testBasicMergingUpdate() throws Throwable
281
// build the first working copy
282
OneTest thisTest = new OneTest();
284
// append 10 lines to A/mu
285
File mu = new File(thisTest.getWorkingCopy(), "A/mu");
286
PrintWriter muPW = new PrintWriter(new FileOutputStream(mu, true));
287
String muContent = thisTest.getWc().getItemContent("A/mu");
288
for (int i = 2; i < 11; i++)
290
muPW.print("\nThis is line " + i + " in mu");
291
muContent = muContent + "\nThis is line " + i + " in mu";
294
thisTest.getWc().setItemWorkingCopyRevision("A/mu", 2);
295
thisTest.getWc().setItemContent("A/mu", muContent);
296
addExpectedCommitItem(thisTest.getWorkingCopy().getAbsolutePath(),
297
thisTest.getUrl(), "A/mu", NodeKind.file,
298
CommitItemStateFlags.TextMods);
300
// append 10 line to A/D/G/rho
301
File rho = new File(thisTest.getWorkingCopy(), "A/D/G/rho");
302
PrintWriter rhoPW = new PrintWriter(new FileOutputStream(rho, true));
303
String rhoContent = thisTest.getWc().getItemContent("A/D/G/rho");
304
for (int i = 2; i < 11; i++)
306
rhoPW.print("\nThis is line " + i + " in rho");
307
rhoContent = rhoContent + "\nThis is line " + i + " in rho";
310
thisTest.getWc().setItemWorkingCopyRevision("A/D/G/rho", 2);
311
thisTest.getWc().setItemContent("A/D/G/rho", rhoContent);
312
addExpectedCommitItem(thisTest.getWCPath(),
313
thisTest.getUrl(), "A/D/G/rho", NodeKind.file,
314
CommitItemStateFlags.TextMods);
316
// commit the changes
317
assertEquals("wrong revision number from commit",
318
client.commit(new String[]{thisTest.getWCPath()}, "log msg",
321
// check the status of the first working copy
322
thisTest.checkStatus();
324
// create a backup copy of the working copy
325
OneTest backupTest = thisTest.copy(".backup");
327
// change the last line of A/mu in the first working copy
328
muPW = new PrintWriter(new FileOutputStream(mu, true));
329
muContent = thisTest.getWc().getItemContent("A/mu");
330
muPW.print(" Appended to line 10 of mu");
331
muContent = muContent + " Appended to line 10 of mu";
333
thisTest.getWc().setItemWorkingCopyRevision("A/mu", 3);
334
thisTest.getWc().setItemContent("A/mu", muContent);
335
addExpectedCommitItem(thisTest.getWCPath(),
336
thisTest.getUrl(), "A/mu", NodeKind.file,
337
CommitItemStateFlags.TextMods);
339
// change the last line of A/mu in the first working copy
340
rhoPW = new PrintWriter(new FileOutputStream(rho, true));
341
rhoContent = thisTest.getWc().getItemContent("A/D/G/rho");
342
rhoPW.print(" Appended to line 10 of rho");
343
rhoContent = rhoContent + " Appended to line 10 of rho";
345
thisTest.getWc().setItemWorkingCopyRevision("A/D/G/rho", 3);
346
thisTest.getWc().setItemContent("A/D/G/rho", rhoContent);
347
addExpectedCommitItem(thisTest.getWCPath(),
348
thisTest.getUrl(), "A/D/G/rho", NodeKind.file,
349
CommitItemStateFlags.TextMods);
351
// commit these changes to the repository
352
assertEquals("wrong revision number from commit",
353
client.commit(new String[]{thisTest.getWCPath()}, "log msg",
356
// check the status of the first working copy
357
thisTest.checkStatus();
359
// modify the first line of A/mu in the backup working copy
360
mu = new File(backupTest.getWorkingCopy(), "A/mu");
361
muPW = new PrintWriter(new FileOutputStream(mu));
362
muPW.print("This is the new line 1 in the backup copy of mu");
363
muContent = "This is the new line 1 in the backup copy of mu";
364
for (int i = 2; i < 11; i++)
366
muPW.print("\nThis is line " + i + " in mu");
367
muContent = muContent + "\nThis is line " + i + " in mu";
370
backupTest.getWc().setItemWorkingCopyRevision("A/mu", 3);
371
muContent = muContent + " Appended to line 10 of mu";
372
backupTest.getWc().setItemContent("A/mu", muContent);
373
backupTest.getWc().setItemTextStatus("A/mu", Status.Kind.modified);
375
// modify the first line of A/D/G/rho in the backup working copy
376
rho = new File(backupTest.getWorkingCopy(), "A/D/G/rho");
377
rhoPW = new PrintWriter(new FileOutputStream(rho));
378
rhoPW.print("This is the new line 1 in the backup copy of rho");
379
rhoContent = "This is the new line 1 in the backup copy of rho";
380
for (int i = 2; i < 11; i++)
382
rhoPW.print("\nThis is line " + i + " in rho");
383
rhoContent = rhoContent + "\nThis is line " + i + " in rho";
386
backupTest.getWc().setItemWorkingCopyRevision("A/D/G/rho", 3);
387
rhoContent = rhoContent + " Appended to line 10 of rho";
388
backupTest.getWc().setItemContent("A/D/G/rho", rhoContent);
389
backupTest.getWc().setItemTextStatus("A/D/G/rho", Status.Kind.modified);
391
// update the backup working copy
392
assertEquals("wrong revision number from update",
393
client.update(backupTest.getWCPath(), null, true), 3);
395
// check the status of the backup working copy
396
backupTest.checkStatus();
400
* test the basic SVNClient.update functionality with concurrent changes
401
* in the repository and the working copy that generate conflicts
404
public void testBasicConflict() throws Throwable
406
// build the first working copy
407
OneTest thisTest = new OneTest();
409
// copy the first working copy to the backup working copy
410
OneTest backupTest = thisTest.copy(".backup");
412
// append a line to A/mu in the first working copy
413
File mu = new File(thisTest.getWorkingCopy(), "A/mu");
414
PrintWriter muPW = new PrintWriter(new FileOutputStream(mu, true));
415
String muContent = thisTest.getWc().getItemContent("A/mu");
416
muPW.print("\nOriginal appended text for mu");
417
muContent = muContent + "\nOriginal appended text for mu";
419
thisTest.getWc().setItemWorkingCopyRevision("A/mu", 2);
420
thisTest.getWc().setItemContent("A/mu", muContent);
421
addExpectedCommitItem(thisTest.getWCPath(),
422
thisTest.getUrl(), "A/mu", NodeKind.file,
423
CommitItemStateFlags.TextMods);
425
// append a line to A/D/G/rho in the first working copy
426
File rho = new File(thisTest.getWorkingCopy(), "A/D/G/rho");
427
PrintWriter rhoPW = new PrintWriter(new FileOutputStream(rho, true));
428
String rhoContent = thisTest.getWc().getItemContent("A/D/G/rho");
429
rhoPW.print("\nOriginal appended text for rho");
430
rhoContent = rhoContent + "\nOriginal appended text for rho";
432
thisTest.getWc().setItemWorkingCopyRevision("A/D/G/rho", 2);
433
thisTest.getWc().setItemContent("A/D/G/rho", rhoContent);
434
addExpectedCommitItem(thisTest.getWCPath(),
435
thisTest.getUrl(), "A/D/G/rho", NodeKind.file,
436
CommitItemStateFlags.TextMods);
438
// commit the changes in the first working copy
439
assertEquals("wrong revision number from commit",
440
client.commit(new String[]{thisTest.getWCPath()}, "log msg",
443
// test the status of the working copy after the commit
444
thisTest.checkStatus();
446
// append a different line to A/mu in the backup working copy
447
mu = new File(backupTest.getWorkingCopy(), "A/mu");
448
muPW = new PrintWriter(new FileOutputStream(mu, true));
449
muPW.print("\nConflicting appended text for mu");
450
muContent = "<<<<<<< .mine\nThis is the file 'mu'.\n"+
451
"Conflicting appended text for mu=======\n"+
452
"This is the file 'mu'.\n"+
453
"Original appended text for mu>>>>>>> .r2";
455
backupTest.getWc().setItemWorkingCopyRevision("A/mu", 2);
456
backupTest.getWc().setItemContent("A/mu", muContent);
457
backupTest.getWc().setItemTextStatus("A/mu", Status.Kind.conflicted);
458
backupTest.getWc().addItem("A/mu.r1", "");
459
backupTest.getWc().setItemNodeKind("A/mu.r1", NodeKind.unknown);
460
backupTest.getWc().setItemTextStatus("A/mu.r1",
461
Status.Kind.unversioned);
462
backupTest.getWc().addItem("A/mu.r2", "");
463
backupTest.getWc().setItemNodeKind("A/mu.r2", NodeKind.unknown);
464
backupTest.getWc().setItemTextStatus("A/mu.r2",
465
Status.Kind.unversioned);
466
backupTest.getWc().addItem("A/mu.mine", "");
467
backupTest.getWc().setItemNodeKind("A/mu.mine", NodeKind.unknown);
468
backupTest.getWc().setItemTextStatus("A/mu.mine",
469
Status.Kind.unversioned);
471
// append a different line to A/D/G/rho in the backup working copy
472
rho = new File(backupTest.getWorkingCopy(), "A/D/G/rho");
473
rhoPW = new PrintWriter(new FileOutputStream(rho, true));
474
rhoPW.print("\nConflicting appended text for rho");
475
rhoContent = "<<<<<<< .mine\nThis is the file 'rho'.\n"+
476
"Conflicting appended text for rho=======\n"+
477
"his is the file 'rho'.\n"+
478
"Original appended text for rho>>>>>>> .r2";
480
backupTest.getWc().setItemWorkingCopyRevision("A/D/G/rho", 2);
481
backupTest.getWc().setItemContent("A/D/G/rho", rhoContent);
482
backupTest.getWc().setItemTextStatus("A/D/G/rho",
483
Status.Kind.conflicted);
484
backupTest.getWc().addItem("A/D/G/rho.r1", "");
485
backupTest.getWc().setItemNodeKind("A/D/G/rho.r1", NodeKind.unknown);
486
backupTest.getWc().setItemTextStatus("A/D/G/rho.r1",
487
Status.Kind.unversioned);
488
backupTest.getWc().addItem("A/D/G/rho.r2", "");
489
backupTest.getWc().setItemNodeKind("A/D/G/rho.r2", NodeKind.unknown);
490
backupTest.getWc().setItemTextStatus("A/D/G/rho.r2",
491
Status.Kind.unversioned);
492
backupTest.getWc().addItem("A/D/G/rho.mine", "");
493
backupTest.getWc().setItemNodeKind("A/D/G/rho.mine", NodeKind.unknown);
494
backupTest.getWc().setItemTextStatus("A/D/G/rho.mine",
495
Status.Kind.unversioned);
497
// update the backup working copy from the repository
498
assertEquals("wrong revision number from update",
499
client.update(backupTest.getWCPath(), null, true), 2);
501
// check the status of the backup working copy
502
backupTest.checkStatus();
504
// flag A/mu as resolved
505
client.resolved(backupTest.getWCPath()+"/A/mu",false);
506
backupTest.getWc().setItemTextStatus("A/mu", Status.Kind.modified);
507
backupTest.getWc().removeItem("A/mu.r1");
508
backupTest.getWc().removeItem("A/mu.r2");
509
backupTest.getWc().removeItem("A/mu.mine");
511
// flag A/D/G/rho as resolved
512
client.resolved(backupTest.getWCPath()+"/A/D/G/rho",false);
513
backupTest.getWc().setItemTextStatus("A/D/G/rho", Status.Kind.modified);
514
backupTest.getWc().removeItem("A/D/G/rho.r1");
515
backupTest.getWc().removeItem("A/D/G/rho.r2");
516
backupTest.getWc().removeItem("A/D/G/rho.mine");
518
// check the status after the conflicts are flaged as resolved
519
backupTest.checkStatus();
523
* test the basic SVNClient.cleanup functionality
526
public void testBasicCleanup() throws Throwable
528
// create a test working copy
529
OneTest thisTest = new OneTest();
531
// create a lock file in A/B
532
File adminLock = new File(thisTest.getWorkingCopy(),"A/B/.svn/lock");
533
PrintWriter pw = new PrintWriter(new FileOutputStream(adminLock));
534
pw.print("stop looking!");
536
thisTest.getWc().setItemIsLocked("A/B", true);
538
// create a lock file in A/D/G
539
adminLock = new File(thisTest.getWorkingCopy(),"A/D/G/.svn/lock");
540
pw = new PrintWriter(new FileOutputStream(adminLock));
541
pw.print("stop looking!");
543
thisTest.getWc().setItemIsLocked("A/D/G", true);
545
// create a lock file in A/C
546
adminLock = new File(thisTest.getWorkingCopy(),"A/C/.svn/lock");
547
pw = new PrintWriter(new FileOutputStream(adminLock));
548
pw.print("stop looking!");
550
thisTest.getWc().setItemIsLocked("A/C", true);
552
// test the status of the working copy
553
thisTest.checkStatus();
556
client.cleanup(thisTest.getWCPath());
557
thisTest.getWc().setItemIsLocked("A/B", false);
558
thisTest.getWc().setItemIsLocked("A/D/G", false);
559
thisTest.getWc().setItemIsLocked("A/C", false);
561
// test the status of the working copy
562
thisTest.checkStatus();
566
* Test the basic SVNClient.revert functionality
569
public void testBasicRevert() throws Throwable
571
// create a test working copy
572
OneTest thisTest = new OneTest();
575
File file = new File(thisTest.getWorkingCopy(), "A/B/E/beta");
576
PrintWriter pw = new PrintWriter(new FileOutputStream(file, true));
577
pw.print("Added some text to 'beta'.");
579
thisTest.getWc().setItemTextStatus("A/B/E/beta", Status.Kind.modified);
582
file = new File(thisTest.getWorkingCopy(), "iota");
583
pw = new PrintWriter(new FileOutputStream(file, true));
584
pw.print("Added some text to 'iota'.");
586
thisTest.getWc().setItemTextStatus("iota", Status.Kind.modified);
589
file = new File(thisTest.getWorkingCopy(), "A/D/G/rho");
590
pw = new PrintWriter(new FileOutputStream(file, true));
591
pw.print("Added some text to 'rho'.");
593
thisTest.getWc().setItemTextStatus("A/D/G/rho", Status.Kind.modified);
595
// create new file A/D/H/zeta and add it to subversion
596
file = new File(thisTest.getWorkingCopy(), "A/D/H/zeta");
597
pw = new PrintWriter(new FileOutputStream(file, true));
598
pw.print("Added some text to 'zeta'.");
600
thisTest.getWc().addItem("A/D/H/zeta", "Added some text to 'zeta'.");
601
thisTest.getWc().setItemTextStatus("A/D/H/zeta", Status.Kind.added);
602
client.add(file.getAbsolutePath(), false);
604
// test the status of the working copy
605
thisTest.checkStatus();
607
// revert the changes
608
client.revert(thisTest.getWCPath()+"/A/B/E/beta", false);
609
thisTest.getWc().setItemTextStatus("A/B/E/beta", Status.Kind.normal);
610
client.revert(thisTest.getWCPath()+"/iota", false);
611
thisTest.getWc().setItemTextStatus("iota", Status.Kind.normal);
612
client.revert(thisTest.getWCPath()+"/A/D/G/rho", false);
613
thisTest.getWc().setItemTextStatus("A/D/G/rho", Status.Kind.normal);
614
client.revert(thisTest.getWCPath()+"/A/D/H/zeta", false);
615
thisTest.getWc().setItemTextStatus("A/D/H/zeta",
616
Status.Kind.unversioned);
617
thisTest.getWc().setItemNodeKind("A/D/H/zeta", NodeKind.unknown);
619
// test the status of the working copy
620
thisTest.checkStatus();
622
// delete A/B/E/beta and revert the change
623
file = new File(thisTest.getWorkingCopy(), "A/B/E/beta");
625
client.revert(file.getAbsolutePath(), false);
627
// resurected file should not be readonly
628
assertTrue("reverted file is not readonly",
629
file.canWrite()&& file.canRead());
631
// test the status of the working copy
632
thisTest.checkStatus();
634
// create & add the directory X
635
client.mkdir(new String[] {thisTest.getWCPath()+"/X"}, null);
636
thisTest.getWc().addItem("X", null);
637
thisTest.getWc().setItemTextStatus("X", Status.Kind.added);
639
// test the status of the working copy
640
thisTest.checkStatus();
643
removeDirectoryWithContent(new File(thisTest.getWorkingCopy(), "X"));
644
client.revert(thisTest.getWCPath()+"/X", false);
645
thisTest.getWc().removeItem("X");
647
// test the status of the working copy
648
thisTest.checkStatus();
650
// delete the directory A/B/E
651
client.remove(new String[] {thisTest.getWCPath()+"/A/B/E"}, null, true);
652
removeDirectoryWithContent(new File(thisTest.getWorkingCopy(), "A/B/E"));
653
thisTest.getWc().setItemTextStatus("A/B/E", Status.Kind.deleted);
654
thisTest.getWc().removeItem("A/B/E/alpha");
655
thisTest.getWc().removeItem("A/B/E/beta");
657
// test the status of the working copy
658
thisTest.checkStatus();
660
// revert A/B/E -> this will not resurect it
661
client.revert(thisTest.getWCPath()+"/A/B/E", true);
663
// test the status of the working copy
664
thisTest.checkStatus();
668
* thest the basic SVNClient.switch functionality
671
public void testBasicSwitch() throws Throwable
673
// create the test working copy
674
OneTest thisTest = new OneTest();
676
// switch iota to A/D/gamma
677
String iotaPath = thisTest.getWCPath() + "/iota";
678
String gammaUrl = thisTest.getUrl() + "/A/D/gamma";
679
thisTest.getWc().setItemContent("iota",
680
greekWC.getItemContent("A/D/gamma"));
681
thisTest.getWc().setItemIsSwitched("iota", true);
682
client.doSwitch(iotaPath, gammaUrl, null, true);
684
// check the status of the working copy
685
thisTest.checkStatus();
687
// switch A/D/H to /A/D/G
688
String adhPath = thisTest.getWCPath() + "/A/D/H";
689
String adgURL = thisTest.getUrl() + "/A/D/G";
690
thisTest.getWc().setItemIsSwitched("A/D/H",true);
691
thisTest.getWc().removeItem("A/D/H/chi");
692
thisTest.getWc().removeItem("A/D/H/omega");
693
thisTest.getWc().removeItem("A/D/H/psi");
694
thisTest.getWc().addItem("A/D/H/pi",
695
thisTest.getWc().getItemContent("A/D/G/pi"));
696
thisTest.getWc().addItem("A/D/H/rho",
697
thisTest.getWc().getItemContent("A/D/G/rho"));
698
thisTest.getWc().addItem("A/D/H/tau",
699
thisTest.getWc().getItemContent("A/D/G/tau"));
700
client.doSwitch(adhPath, adgURL, null, true);
702
// check the status of the working copy
703
thisTest.checkStatus();
707
* test the basic SVNClient.remove functionality
710
public void testBasicDelete() throws Throwable
712
// create the test working copy
713
OneTest thisTest = new OneTest();
716
File file = new File(thisTest.getWorkingCopy(), "A/D/H/chi");
717
PrintWriter pw = new PrintWriter(new FileOutputStream(file, true));
718
pw.print("added to chi");
720
thisTest.getWc().setItemTextStatus("A/D/H/chi", Status.Kind.modified);
722
// set a property on A/D/G/rho file
723
client.propertySet(thisTest.getWCPath()+"/A/D/G/rho", "abc", "def",
725
thisTest.getWc().setItemPropStatus("A/D/G/rho", Status.Kind.modified);
727
// set a property on A/B/F directory
728
client.propertySet(thisTest.getWCPath()+"/A/B/F", "abc", "def", false);
729
thisTest.getWc().setItemPropStatus("A/B/F", Status.Kind.modified);
731
// create a unversioned A/C/sigma file
732
file = new File(thisTest.getWCPath(),"A/C/sigma");
733
pw = new PrintWriter(new FileOutputStream(file));
734
pw.print("unversioned sigma");
736
thisTest.getWc().addItem("A/C/sigma", "unversioned sigma");
737
thisTest.getWc().setItemTextStatus("A/C/sigma", Status.Kind.unversioned);
738
thisTest.getWc().setItemNodeKind("A/C/sigma", NodeKind.unknown);
740
// create unversioned directory A/C/Q
741
file = new File(thisTest.getWCPath(), "A/C/Q");
743
thisTest.getWc().addItem("A/C/Q", null);
744
thisTest.getWc().setItemNodeKind("A/C/Q", NodeKind.unknown);
745
thisTest.getWc().setItemTextStatus("A/C/Q", Status.Kind.unversioned);
747
// create & add the directory A/B/X
748
file = new File(thisTest.getWCPath(), "A/B/X");
749
client.mkdir(new String[] {file.getAbsolutePath()}, null);
750
thisTest.getWc().addItem("A/B/X", null);
751
thisTest.getWc().setItemTextStatus("A/B/X", Status.Kind.added);
753
// create & add the file A/B/X/xi
754
file = new File(file, "xi");
755
pw = new PrintWriter(new FileOutputStream(file));
756
pw.print("added xi");
758
client.add(file.getAbsolutePath(),false);
759
thisTest.getWc().addItem("A/B/X/xi", "added xi");
760
thisTest.getWc().setItemTextStatus("A/B/X/xi", Status.Kind.added);
762
// create & add the directory A/B/Y
763
file = new File(thisTest.getWCPath(), "A/B/Y");
764
client.mkdir(new String[] {file.getAbsolutePath()}, null);
765
thisTest.getWc().addItem("A/B/Y", null);
766
thisTest.getWc().setItemTextStatus("A/B/Y", Status.Kind.added);
768
// test the status of the working copy
769
thisTest.checkStatus();
771
// the following removes should all fail without force
775
// remove of A/D/H/chi without force should fail, because it is
777
client.remove(new String[] {thisTest.getWCPath()+"/A/D/H/chi"},
779
fail("missing exception");
781
catch(ClientException e)
787
// remove of A/D/H without force should fail, because A/D/H/chi is
789
client.remove(new String[] {thisTest.getWCPath()+"/A/D/H"}, null,
791
fail("missing exception");
793
catch(ClientException e)
799
// remove of A/D/G/rho without force should fail, because it has
801
client.remove(new String[] {thisTest.getWCPath()+"/A/D/G/rho"},
803
fail("missing exception");
805
catch(ClientException e)
811
// remove of A/D/G without force should fail, because A/D/G/rho has
813
client.remove(new String[] {thisTest.getWCPath()+"/A/D/G"}, null,
815
fail("missing exception");
817
catch(ClientException e)
823
// remove of A/B/F without force should fail, because it has
825
client.remove(new String[] {thisTest.getWCPath()+"/A/B/F"}, null,
827
fail("missing exception");
829
catch(ClientException e)
835
// remove of A/B without force should fail, because A/B/F has
837
client.remove(new String[] {thisTest.getWCPath()+"/A/B"}, null,
839
fail("missing exception");
841
catch(ClientException e)
847
// remove of A/C/sigma without force should fail, because it is
849
client.remove(new String[] {thisTest.getWCPath()+"/A/C/sigma"},
851
fail("missing exception");
853
catch(ClientException e)
859
// remove of A/C without force should fail, because A/C/sigma is
861
client.remove(new String[] {thisTest.getWCPath()+"/A/C"}, null,
863
fail("missing exception");
865
catch(ClientException e)
871
// remove of A/B/X without force should fail, because it is new
872
client.remove(new String[] {thisTest.getWCPath()+"/A/B/X"}, null,
874
fail("missing exception");
876
catch(ClientException e)
880
// check the status of the working copy
881
thisTest.checkStatus();
883
// the following removes should all work
884
client.remove(new String[] {thisTest.getWCPath()+"/A/B/E"}, null,
886
thisTest.getWc().setItemTextStatus("A/B/E",Status.Kind.deleted);
887
thisTest.getWc().setItemTextStatus("A/B/E/alpha",Status.Kind.deleted);
888
thisTest.getWc().setItemTextStatus("A/B/E/beta",Status.Kind.deleted);
889
client.remove(new String[] {thisTest.getWCPath()+"/A/D/H"}, null, true);
890
thisTest.getWc().setItemTextStatus("A/D/H",Status.Kind.deleted);
891
thisTest.getWc().setItemTextStatus("A/D/H/chi",Status.Kind.deleted);
892
thisTest.getWc().setItemTextStatus("A/D/H/omega",Status.Kind.deleted);
893
thisTest.getWc().setItemTextStatus("A/D/H/psi",Status.Kind.deleted);
894
client.remove(new String[] {thisTest.getWCPath()+"/A/D/G"}, null, true);
895
thisTest.getWc().setItemTextStatus("A/D/G",Status.Kind.deleted);
896
thisTest.getWc().setItemTextStatus("A/D/G/rho",Status.Kind.deleted);
897
thisTest.getWc().setItemPropStatus("A/D/G/rho", Status.Kind.none);
898
thisTest.getWc().setItemTextStatus("A/D/G/pi",Status.Kind.deleted);
899
thisTest.getWc().setItemTextStatus("A/D/G/tau",Status.Kind.deleted);
900
client.remove(new String[] {thisTest.getWCPath()+"/A/B/F"}, null, true);
901
thisTest.getWc().setItemTextStatus("A/B/F",Status.Kind.deleted);
902
thisTest.getWc().setItemPropStatus("A/B/F", Status.Kind.none);
903
client.remove(new String[] {thisTest.getWCPath()+"/A/C"}, null, true);
904
thisTest.getWc().setItemTextStatus("A/C",Status.Kind.deleted);
905
client.remove(new String[] {thisTest.getWCPath()+"/A/B/X"}, null, true);
906
file = new File(thisTest.getWorkingCopy(), "iota");
908
client.remove(new String[] {file.getAbsolutePath()}, null, true);
909
thisTest.getWc().setItemTextStatus("iota",Status.Kind.deleted);
910
file = new File(thisTest.getWorkingCopy(), "A/D/gamma");
912
client.remove(new String[] {file.getAbsolutePath()}, null, false);
913
thisTest.getWc().setItemTextStatus("A/D/gamma",Status.Kind.deleted);
914
client.remove(new String[] {file.getAbsolutePath()}, null, true);
915
client.remove(new String[] {thisTest.getWCPath()+"/A/B/E"}, null,
917
thisTest.getWc().removeItem("A/B/X");
918
thisTest.getWc().removeItem("A/B/X/xi");
919
thisTest.getWc().removeItem("A/C/sigma");
920
thisTest.getWc().removeItem("A/C/Q");
921
thisTest.checkStatus();
922
client.remove(new String[] {thisTest.getWCPath()+"/A/D"},null, true);
923
thisTest.getWc().setItemTextStatus("A/D", Status.Kind.deleted);
924
thisTest.getWc().removeItem("A/D/Y");
926
// check the status of the working copy
927
thisTest.checkStatus();
929
// confirm that the file are realy deleted
930
assertFalse("failed to remove text modified file",
931
new File(thisTest.getWorkingCopy(), "A/D/G/rho").exists());
932
assertFalse("failed to remove prop modified file",
933
new File(thisTest.getWorkingCopy(), "A/D/H/chi").exists());
934
assertFalse("failed to remove unversioned file",
935
new File(thisTest.getWorkingCopy(), "A/C/sigma").exists());
936
assertFalse("failed to remove unmodified file",
937
new File(thisTest.getWorkingCopy(), "A/B/E/alpha").exists());
938
file = new File(thisTest.getWorkingCopy(),"A/B/F");
939
assertTrue("removed versioned dir", file.exists()
940
&& file.isDirectory());
941
assertFalse("failed to remove unversioned dir",
942
new File(thisTest.getWorkingCopy(), "A/C/Q").exists());
943
assertFalse("failed to remove added dir",
944
new File(thisTest.getWorkingCopy(), "A/B/X").exists());
946
// delete unversioned file foo
947
file = new File(thisTest.getWCPath(),"foo");
948
pw = new PrintWriter(new FileOutputStream(file));
949
pw.print("unversioned foo");
951
client.remove(new String[] {file.getAbsolutePath()}, null, true);
952
assertFalse("failed to remove unversioned file foo", file.exists());
953
client.remove(new String[] {file.getAbsolutePath()}, null, true);
955
// delete file iota in the repository
956
addExpectedCommitItem(null, thisTest.getUrl(), "iota", NodeKind.none,
957
CommitItemStateFlags.Delete);
958
client.remove(new String[] {thisTest.getUrl()+"/iota"},
959
"delete iota URL", false);
962
public void testBasicCheckoutDeleted() throws Throwable
964
// create working copy
965
OneTest thisTest = new OneTest();
967
// delete A/D and its content
968
client.remove(new String[] {thisTest.getWCPath()+"/A/D"}, null, true);
969
thisTest.getWc().setItemTextStatus("A/D", Status.Kind.deleted);
970
thisTest.getWc().setItemTextStatus("A/D/G", Status.Kind.deleted);
971
thisTest.getWc().setItemTextStatus("A/D/G/rho", Status.Kind.deleted);
972
thisTest.getWc().setItemTextStatus("A/D/G/pi", Status.Kind.deleted);
973
thisTest.getWc().setItemTextStatus("A/D/G/tau", Status.Kind.deleted);
974
thisTest.getWc().setItemTextStatus("A/D/H", Status.Kind.deleted);
975
thisTest.getWc().setItemTextStatus("A/D/H/chi", Status.Kind.deleted);
976
thisTest.getWc().setItemTextStatus("A/D/H/psi", Status.Kind.deleted);
977
thisTest.getWc().setItemTextStatus("A/D/H/omega", Status.Kind.deleted);
978
thisTest.getWc().setItemTextStatus("A/D/gamma", Status.Kind.deleted);
980
// check the working copy status
981
thisTest.checkStatus();
984
addExpectedCommitItem(thisTest.getWCPath(),
985
thisTest.getUrl(), "A/D", NodeKind.dir,
986
CommitItemStateFlags.Delete);
987
assertEquals("wrong revision from commit",
988
client.commit(new String[]{thisTest.getWCPath()}, "log message",
990
thisTest.getWc().removeItem("A/D");
991
thisTest.getWc().removeItem("A/D/G");
992
thisTest.getWc().removeItem("A/D/G/rho");
993
thisTest.getWc().removeItem("A/D/G/pi");
994
thisTest.getWc().removeItem("A/D/G/tau");
995
thisTest.getWc().removeItem("A/D/H");
996
thisTest.getWc().removeItem("A/D/H/chi");
997
thisTest.getWc().removeItem("A/D/H/psi");
998
thisTest.getWc().removeItem("A/D/H/omega");
999
thisTest.getWc().removeItem("A/D/gamma");
1001
// check the working copy status
1002
thisTest.checkStatus();
1004
// check out the previous revision
1005
client.checkout(thisTest.getUrl()+"/A/D", thisTest.getWCPath()+"/new_D",
1006
new Revision.Number(1), true);
1010
* Test if Subversion will detect the change of a file to a direcory
1013
public void testBasicNodeKindChange() throws Throwable
1015
// create working copy
1016
OneTest thisTest = new OneTest();
1019
client.remove(new String[] {thisTest.getWCPath()+"/A/D/gamma"}, null,
1021
thisTest.getWc().setItemTextStatus("A/D/gamma", Status.Kind.deleted);
1023
// check the working copy status
1024
thisTest.checkStatus();
1028
// creating a directory in the place of the deleted file should
1030
client.mkdir(new String[] {thisTest.getWCPath()+"/A/D/gamma"},
1032
fail("can change node kind");
1034
catch(ClientException e)
1039
// check the working copy status
1040
thisTest.checkStatus();
1042
// commit the deletion
1043
addExpectedCommitItem(thisTest.getWCPath(),
1044
thisTest.getUrl(), "A/D/gamma", NodeKind.file,
1045
CommitItemStateFlags.Delete);
1046
assertEquals("wrong revision number from commit",
1047
client.commit(new String[]{thisTest.getWCPath()},"log message",
1049
thisTest.getWc().removeItem("A/D/gamma");
1051
// check the working copy status
1052
thisTest.checkStatus();
1056
// creating a directory in the place of the deleted file should
1059
new String[] {thisTest.getWCPath()+"/A/D/gamma"}, null);
1060
fail("can change node kind");
1062
catch(ClientException e)
1067
// check the working copy status
1068
thisTest.checkStatus();
1070
// update the working copy
1071
client.update(thisTest.getWCPath(), null, true);
1073
// check the working copy status
1074
thisTest.checkStatus();
1076
// now creating the directory should succeed
1077
client.mkdir(new String[] {thisTest.getWCPath()+"/A/D/gamma"}, null);
1078
thisTest.getWc().addItem("A/D/gamma", null);
1079
thisTest.getWc().setItemTextStatus("A/D/gamma", Status.Kind.added);
1081
// check the working copy status
1082
thisTest.checkStatus();
1086
* Test the basic SVNClient.import functionality
1089
public void testBasicImport() throws Throwable
1091
// create the working copy
1092
OneTest thisTest = new OneTest();
1095
File file = new File(thisTest.getWCPath(),"new_file");
1096
PrintWriter pw = new PrintWriter(new FileOutputStream(file));
1097
pw.print("some text");
1100
// import new_file info dirA/dirB/newFile
1101
addExpectedCommitItem(thisTest.getWCPath(),
1102
null, "new_file", NodeKind.none, CommitItemStateFlags.Add);
1103
client.doImport(file.getAbsolutePath(),
1104
thisTest.getUrl()+"/dirA/dirB/new_file",
1105
"log message for new import", true);
1110
// update the working
1111
assertEquals("wrong revision from update",
1112
client.update(thisTest.getWCPath(), null, true),2);
1113
thisTest.getWc().addItem("dirA", null);
1114
thisTest.getWc().setItemWorkingCopyRevision("dirA",2);
1115
thisTest.getWc().addItem("dirA/dirB", null);
1116
thisTest.getWc().setItemWorkingCopyRevision("dirA/dirB",2);
1117
thisTest.getWc().addItem("dirA/dirB/new_file", "some text");
1118
thisTest.getWc().setItemWorkingCopyRevision("dirA/dirB/new_file",2);
1120
// test the working copy status
1121
thisTest.checkStatus();
1125
* test the basic SVNClient.fileContent functionality
1128
public void testBasicCat() throws Throwable
1130
// create the working copy
1131
OneTest thisTest = new OneTest();
1134
File mu = new File(thisTest.getWorkingCopy(), "A/mu");
1135
PrintWriter pw = new PrintWriter(new FileOutputStream(mu, true));
1136
pw.print("some text");
1138
// get the content from the repository
1139
byte[] content = client.fileContent(thisTest.getWCPath()+"/A/mu", null);
1140
byte[] testContent = thisTest.getWc().getItemContent("A/mu").getBytes();
1142
// the content should be the same
1143
assertTrue("content changed", Arrays.equals(content, testContent));
1147
* test the basic SVNClient.list functionality
1150
public void testBasicLs() throws Throwable
1152
// create the working copy
1153
OneTest thisTest = new OneTest();
1155
// list the repository root dir
1156
DirEntry[] entries = client.list(thisTest.getWCPath(), null, false);
1157
thisTest.getWc().check(entries,"", false);
1160
entries = client.list(thisTest.getWCPath()+"/A", null, false);
1161
thisTest.getWc().check(entries,"A", false);
1163
// list directory A in BASE revision
1164
entries = client.list(thisTest.getWCPath()+"/A", Revision.BASE, false);
1165
thisTest.getWc().check(entries,"A", false);
1168
entries = client.list(thisTest.getWCPath()+"/A/mu", null, false);
1169
thisTest.getWc().check(entries,"A/mu");
1173
* test the basis SVNClient.add functionality with files that should be
1177
public void testBasicAddIgnores() throws Throwable
1179
// create working copy
1180
OneTest thisTest = new OneTest();
1183
File dir = new File(thisTest.getWorkingCopy(), "dir");
1187
File fileC = new File(dir, "foo.c");
1188
new FileOutputStream(fileC).close();
1190
// create dir/foo.o (should be ignored)
1191
File fileO = new File(dir, "foo.o");
1192
new FileOutputStream(fileO).close();
1195
client.add(dir.getAbsolutePath(), true);
1196
thisTest.getWc().addItem("dir", null);
1197
thisTest.getWc().setItemTextStatus("dir",Status.Kind.added);
1198
thisTest.getWc().addItem("dir/foo.c", "");
1199
thisTest.getWc().setItemTextStatus("dir/foo.c",Status.Kind.added);
1200
thisTest.getWc().addItem("dir/foo.o", "");
1201
thisTest.getWc().setItemTextStatus("dir/foo.o",Status.Kind.ignored);
1202
thisTest.getWc().setItemNodeKind("dir/foo.o", NodeKind.unknown);
1204
// test the working copy status
1205
thisTest.checkStatus();
1209
* test the basis SVNClient.import functionality with files that should be
1213
public void testBasicImportIgnores() throws Throwable
1215
// create working copy
1216
OneTest thisTest = new OneTest();
1219
File dir = new File(thisTest.getWorkingCopy(), "dir");
1223
File fileC = new File(dir, "foo.c");
1224
new FileOutputStream(fileC).close();
1226
// create dir/foo.o (should be ignored)
1227
File fileO = new File(dir, "foo.o");
1228
new FileOutputStream(fileO).close();
1231
addExpectedCommitItem(thisTest.getWCPath(),
1232
null, "dir", NodeKind.none, CommitItemStateFlags.Add);
1233
client.doImport(dir.getAbsolutePath(), thisTest.getUrl()+"/dir",
1234
"log message for import", true);
1237
removeDirectoryWithContent(dir);
1239
// udpate the working copy
1240
assertEquals("wrong revision from update", 2,
1241
client.update(thisTest.getWCPath(), null, true));
1242
thisTest.getWc().addItem("dir", null);
1243
thisTest.getWc().addItem("dir/foo.c", "");
1245
// test the working copy status
1246
thisTest.checkStatus();
1250
* test the basic SVNClient.info functionality
1253
public void testBasicInfo() throws Throwable
1255
// create the working copy
1256
OneTest thisTest = new OneTest();
1258
// get the item information and test it
1259
Info info = client.info(thisTest.getWCPath()+"/A/mu");
1260
assertEquals("wrong revision from info", 1,
1261
info.getLastChangedRevision());
1262
assertEquals("wrong schedule kind from info", ScheduleKind.normal,
1263
info.getSchedule());
1264
assertEquals("wrong node kind from info", NodeKind.file,
1265
info.getNodeKind());
1269
* test the basic SVNClient.logMessage functionality
1272
public void testBasicLogMessage() throws Throwable
1274
// create the working copy
1275
OneTest thisTest = new OneTest();
1277
// get the commit message of the initial import and test it
1278
LogMessage lm[] = client.logMessages(thisTest.getWCPath(), null,
1280
assertEquals("wrong number of objects", 1, lm.length);
1281
assertEquals("wrong message", "Log Message", lm[0].getMessage());
1282
assertEquals("wrong revision", 1, lm[0].getRevisionNumber());
1283
assertEquals("wrong user", "jrandom", lm[0].getAuthor());
1284
assertNotNull("changed paths set", lm[0].getChangedPaths());
1285
ChangePath cp[] = lm[0].getChangedPaths();
1286
assertEquals("wrong number of chang pathes", 20, cp.length);
1287
assertEquals("wrong path", "/A", cp[0].getPath());
1288
assertEquals("wrong copy source rev", -1, cp[0].getCopySrcRevision());
1289
assertNull("wrong copy source path", cp[0].getCopySrcPath());
1290
assertEquals("wrong action", 'A', cp[0].getAction());
1294
* test the basic SVNClient.getVersionInfo functionality
1298
public void testBasicVersionInfo() throws Throwable
1300
// create the working copy
1301
OneTest thisTest = new OneTest();
1302
assertEquals("wrong version info","1",
1303
client.getVersionInfo(thisTest.getWCPath(), null, false));
1307
* test the baisc SVNClient locking functionality
1311
public void testBasicLocking() throws Throwable
1313
// build the first working copy
1314
OneTest thisTest = new OneTest();
1316
client.propertySet(thisTest.getWCPath()+"/A/mu",
1317
PropertyData.NEEDS_LOCK, "*", false);
1319
addExpectedCommitItem(thisTest.getWCPath(),
1320
thisTest.getUrl(), "A/mu",NodeKind.file,
1321
CommitItemStateFlags.PropMods);
1322
assertEquals("bad revision number on commit", 2,
1323
client.commit(new String[] {thisTest.getWCPath()},
1325
File f = new File(thisTest.getWCPath()+"/A/mu");
1326
assertEquals("file should be read only now", false, f.canWrite());
1327
client.lock(new String[] {thisTest.getWCPath()+"/A/mu"},
1329
assertEquals("file should be read write now", true, f.canWrite());
1330
client.unlock(new String[]{thisTest.getWCPath()+"/A/mu"},
1332
assertEquals("file should be read only now", false, f.canWrite());
1333
client.lock(new String[]{thisTest.getWCPath()+"/A/mu"},
1335
assertEquals("file should be read write now", true, f.canWrite());
1336
addExpectedCommitItem(thisTest.getWCPath(),
1337
thisTest.getUrl(), "A/mu",NodeKind.file,
1339
assertEquals("rev number from commit",-1, client.commit(
1340
new String[]{thisTest.getWCPath()},"message", true));
1341
assertEquals("file should be read write now", true, f.canWrite());
1345
* test the baisc SVNClient.info2 functionality
1349
public void testBasicInfo2() throws Throwable
1351
// build the first working copy
1352
OneTest thisTest = new OneTest();
1354
Info2[] infos = client.info2(thisTest.getWCPath(), null, null, false);
1355
assertEquals("this should return 1 info object", 1, infos.length);
1356
infos = client.info2(thisTest.getWCPath(), null, null, true);
1357
assertEquals("this should return 21 info objects", 21, infos.length);
1358
infos = client.info2(thisTest.getWCPath(), new Revision.Number(1),
1359
new Revision.Number(1), true);
1360
assertEquals("this should return 21 info objects", 21, infos.length);