Search in sources :

Example 1 with UpdateSession

use of com.intellij.openapi.vcs.update.UpdateSession in project intellij-community by JetBrains.

the class SvnNativeClientAuthTest method updateExpectAuthCanceled.

private void updateExpectAuthCanceled(File wc1, String expectedText) {
    Assert.assertTrue(wc1.isDirectory());
    final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wc1);
    final UpdatedFiles files = UpdatedFiles.create();
    final UpdateSession session = myVcs.getUpdateEnvironment().updateDirectories(new FilePath[] { VcsUtil.getFilePath(vf) }, files, new EmptyProgressIndicator(), new Ref<>());
    Assert.assertTrue(session.getExceptions() != null && !session.getExceptions().isEmpty());
    Assert.assertTrue(!session.isCanceled());
    Assert.assertTrue(session.getExceptions().get(0).getMessage().contains(expectedText));
    if (myIsSecure) {
        ++myExpectedCreds;
        ++myExpectedCert;
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) UpdateSession(com.intellij.openapi.vcs.update.UpdateSession) UpdatedFiles(com.intellij.openapi.vcs.update.UpdatedFiles)

Example 2 with UpdateSession

use of com.intellij.openapi.vcs.update.UpdateSession in project intellij-community by JetBrains.

the class SvnNativeClientAuthTest method updateSimple.

private void updateSimple(File wc1) {
    Assert.assertTrue(wc1.isDirectory());
    final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wc1);
    final UpdatedFiles files = UpdatedFiles.create();
    final UpdateSession session = myVcs.getUpdateEnvironment().updateDirectories(new FilePath[] { VcsUtil.getFilePath(vf) }, files, new EmptyProgressIndicator(), new Ref<>());
    Assert.assertTrue(session.getExceptions() == null || session.getExceptions().isEmpty());
    Assert.assertTrue(!session.isCanceled());
    if (myIsSecure) {
        ++myExpectedCreds;
        ++myExpectedCert;
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) UpdateSession(com.intellij.openapi.vcs.update.UpdateSession) UpdatedFiles(com.intellij.openapi.vcs.update.UpdatedFiles)

Example 3 with UpdateSession

use of com.intellij.openapi.vcs.update.UpdateSession in project intellij-community by JetBrains.

the class SvnProtocolsTest method testUpdateImpl.

// todo this test writes to repository - so it's disabled for now - while admins are preparing a server
/*
  @Test
  public void testUpdateAndCommit() throws Exception {
    for (String url : ourTestURL) {
      final File wc1 = testCheckoutImpl(url);
      final File wc2 = testCheckoutImpl(url);

      final File file = testCommitImpl(wc1);
      System.out.println("Committed file: " + file.getPath());
      testUpdateImpl(wc2, file);
    }
  }*/
private void testUpdateImpl(File wc1, final File created) {
    Assert.assertTrue(wc1.isDirectory());
    final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wc1);
    final UpdatedFiles files = UpdatedFiles.create();
    final UpdateSession session = myVcs.getUpdateEnvironment().updateDirectories(new FilePath[] { VcsUtil.getFilePath(vf) }, files, new EmptyProgressIndicator(), new Ref<>());
    Assert.assertTrue(session.getExceptions() == null || session.getExceptions().isEmpty());
    Assert.assertTrue(!session.isCanceled());
    Assert.assertTrue(!files.getGroupById(FileGroup.CREATED_ID).getFiles().isEmpty());
    final String path = files.getGroupById(FileGroup.CREATED_ID).getFiles().iterator().next();
    final String name = path.substring(path.lastIndexOf(File.separator) + 1);
    Assert.assertEquals(created.getName(), name);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) UpdateSession(com.intellij.openapi.vcs.update.UpdateSession) UpdatedFiles(com.intellij.openapi.vcs.update.UpdatedFiles)

Aggregations

EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)3 UpdateSession (com.intellij.openapi.vcs.update.UpdateSession)3 UpdatedFiles (com.intellij.openapi.vcs.update.UpdatedFiles)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3