Search in sources :

Example 66 with GitController

use of com.oxygenxml.git.view.event.GitController in project oxygen-git-client-addon by oxygenxml.

the class GitEditorVariables2Test method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    noOfShortBranchCalls = 0;
    noOfFullBranchCalls = 0;
    noOfWCCalls = 0;
    Repository repo = createRepository(LOCAL_TEST_REPOSITORY);
    GitAccess.getInstance().setRepositorySynchronously(LOCAL_TEST_REPOSITORY);
    GitAccess gitAccessMock = Mockito.mock(GitAccess.class);
    Mockito.doAnswer(new Answer<BranchInfo>() {

        @Override
        public BranchInfo answer(InvocationOnMock invocation) throws Throwable {
            noOfShortBranchCalls++;
            return new BranchInfo("main", false);
        }
    }).when(gitAccessMock).getBranchInfo();
    Mockito.doAnswer(new Answer<Repository>() {

        @Override
        public Repository answer(InvocationOnMock invocation) throws Throwable {
            noOfFullBranchCalls++;
            return repo;
        }
    }).when(gitAccessMock).getRepository();
    Mockito.doAnswer(new Answer<File>() {

        @Override
        public File answer(InvocationOnMock invocation) throws Throwable {
            noOfWCCalls++;
            return new File(LOCAL_TEST_REPOSITORY);
        }
    }).when(gitAccessMock).getWorkingCopy();
    editorVariablesResolver = new GitEditorVariablesResolver(new GitController(gitAccessMock));
}
Also used : Repository(org.eclipse.jgit.lib.Repository) GitAccess(com.oxygenxml.git.service.GitAccess) BranchInfo(com.oxygenxml.git.service.BranchInfo) InvocationOnMock(org.mockito.invocation.InvocationOnMock) GitController(com.oxygenxml.git.view.event.GitController) File(java.io.File)

Aggregations

GitController (com.oxygenxml.git.view.event.GitController)66 File (java.io.File)54 FileStatus (com.oxygenxml.git.service.entities.FileStatus)48 JButton (javax.swing.JButton)29 Test (org.junit.Test)28 JDialog (javax.swing.JDialog)24 Repository (org.eclipse.jgit.lib.Repository)21 AbstractAction (javax.swing.AbstractAction)19 GitTreeNode (com.oxygenxml.git.view.GitTreeNode)18 GitActionsManager (com.oxygenxml.git.view.actions.GitActionsManager)18 JFrame (javax.swing.JFrame)15 StagingPanel (com.oxygenxml.git.view.staging.StagingPanel)14 GitControllerBase (com.oxygenxml.git.service.GitControllerBase)13 ArrayList (java.util.ArrayList)12 List (java.util.List)12 JTextField (javax.swing.JTextField)10 BranchManagementPanel (com.oxygenxml.git.view.branches.BranchManagementPanel)8 BranchTreeMenuActionsProvider (com.oxygenxml.git.view.branches.BranchTreeMenuActionsProvider)7 ToolbarPanel (com.oxygenxml.git.view.staging.ToolbarPanel)7 JCheckBox (javax.swing.JCheckBox)7