use of org.tmatesoft.svn.core.internal.wc17.SVNWCContext in project intellij-community by JetBrains.
the class SvnBusyOnAddTest method testRefusedAdd.
@Test
public void testRefusedAdd() throws Exception {
SVNWCDb db = new SVNWCDb();
final File ioFile = new File(myWorkingCopyRoot, filename);
ioFile.getParentFile().mkdirs();
ioFile.createNewFile();
try {
db.open(ISVNWCDb.SVNWCDbOpenMode.ReadWrite, new DefaultSVNOptions(), true, true);
SVNWCContext context = new SVNWCContext(db, new ISVNEventHandler() {
@Override
public void handleEvent(SVNEvent event, double progress) throws SVNException {
}
@Override
public void checkCancelled() throws SVNCancelException {
}
});
File file = context.acquireWriteLock(myWorkingCopyRoot, false, true);
boolean failed = false;
try {
SVNWCClient client = new SVNWCClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
client.doAdd(ioFile, true, false, false, true);
} catch (SVNException e) {
Assert.assertEquals(155004, e.getErrorMessage().getErrorCode().getCode());
failed = true;
} finally {
context.releaseWriteLock(myWorkingCopyRoot);
}
Assert.assertTrue(failed);
SVNStatusClient readClient = new SVNStatusClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
//readClient.doStatus(ioFile, false);
readClient.doStatus(myWorkingCopyRoot, false);
} finally {
ioFile.delete();
db.close();
}
}
use of org.tmatesoft.svn.core.internal.wc17.SVNWCContext in project intellij-community by JetBrains.
the class SvnBusyOnAddTest method testRefusedAddVariant.
@Test
public void testRefusedAddVariant() throws Exception {
SVNWCDb db = new SVNWCDb();
final File ioFile = new File(myWorkingCopyRoot, filename + System.currentTimeMillis());
ioFile.createNewFile();
System.out.println(getStatus(ioFile));
SVNWCContext context = null;
try {
db.open(ISVNWCDb.SVNWCDbOpenMode.ReadWrite, new DefaultSVNOptions(), true, true);
context = new SVNWCContext(db, new ISVNEventHandler() {
@Override
public void handleEvent(SVNEvent event, double progress) throws SVNException {
}
@Override
public void checkCancelled() throws SVNCancelException {
}
});
File file = context.acquireWriteLock(myWorkingCopyRoot, false, true);
boolean failed = false;
try {
SVNWCClient client = new SVNWCClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
client.doAdd(ioFile, true, false, false, true);
} catch (SVNException e) {
Assert.assertEquals(155004, e.getErrorMessage().getErrorCode().getCode());
failed = true;
}
Assert.assertTrue(failed);
System.out.println(getStatus(ioFile));
} finally {
if (context != null) {
context.releaseWriteLock(myWorkingCopyRoot);
}
ioFile.delete();
db.close();
}
}
Aggregations