Search in sources :

Example 1 with MockProject

use of com.intellij.mock.MockProject in project buck by facebook.

the class BuckEventsConsumerTest method initialiseEventsConsumer.

public BuckEventsConsumer initialiseEventsConsumer() {
    Extensions.registerAreaClass("IDEA_PROJECT", null);
    MockDisposable mockDisposable = new MockDisposable();
    MockProject project = new MockProjectEx(new MockDisposable());
    MockApplication application = new MyMockApplication(mockDisposable);
    ApplicationManager.setApplication(application, mockDisposable);
    final BuckEventsConsumer buckEventsConsumer = new BuckEventsConsumer(project);
    project.registerService(BuckUIManager.class, new BuckUIManager());
    project.registerService(ToolWindowManager.class, new Mock.MyToolWindowManager());
    application.registerService(FileDocumentManager.class, new MockFileDocumentManagerImpl(null, null));
    application.registerService(VirtualFileManager.class, EasyMock.createMock(VirtualFileManager.class));
    return buckEventsConsumer;
}
Also used : MockProject(com.intellij.mock.MockProject) MockFileDocumentManagerImpl(com.intellij.mock.MockFileDocumentManagerImpl) MockApplication(com.intellij.mock.MockApplication) MyMockApplication(com.facebook.buck.intellij.ideabuck.test.util.MyMockApplication) VirtualFileManager(com.intellij.openapi.vfs.VirtualFileManager) MockDisposable(com.facebook.buck.intellij.ideabuck.test.util.MockDisposable) MyMockApplication(com.facebook.buck.intellij.ideabuck.test.util.MyMockApplication) MockProjectEx(com.intellij.mock.MockProjectEx) EasyMock(org.easymock.EasyMock) Mock(com.intellij.mock.Mock)

Example 2 with MockProject

use of com.intellij.mock.MockProject in project intellij-community by JetBrains.

the class ActivityMonitorTest method testReady.

public void testReady() {
    assertReady(null);
    MockProject project1 = new MockProjectEx(getTestRootDisposable());
    assertReady(project1);
    MockProject project2 = new MockProjectEx(getTestRootDisposable());
    assertReady(project2);
    myMonitor.initBusyObjectFor(project1);
    assertTrue(myMonitor.hasObjectFor(project1));
    myMonitor.initBusyObjectFor(project2);
    assertTrue(myMonitor.hasObjectFor(project2));
    myMonitor.addActivity(new UiActivity("global"), ModalityState.any());
    assertBusy(null);
    assertBusy(project1);
    assertBusy(project2);
    myMonitor.addActivity(new UiActivity("global"), ModalityState.any());
    assertBusy(null);
    assertBusy(project1);
    assertBusy(project2);
    myMonitor.removeActivity(new UiActivity("global"));
    assertReady(null);
    assertReady(project1);
    assertReady(project2);
    myMonitor.addActivity(project1, new UiActivity("p1"), ModalityState.any());
    assertReady(null);
    assertBusy(project1);
    assertReady(project2);
    myMonitor.addActivity(new UiActivity("global"), ModalityState.any());
    assertBusy(null);
    assertBusy(project1);
    assertBusy(project2);
    myMonitor.removeActivity(new UiActivity("global"));
    assertReady(null);
    assertBusy(project1);
    assertReady(project2);
    myMonitor.removeActivity(project1, new UiActivity("p1"));
    assertReady(null);
    assertReady(project1);
    assertReady(project2);
}
Also used : MockProject(com.intellij.mock.MockProject) MockProjectEx(com.intellij.mock.MockProjectEx)

Example 3 with MockProject

use of com.intellij.mock.MockProject in project intellij by bazelbuild.

the class BlazeTestCase method setup.

@Before
public final void setup() {
    testDisposable = new RootDisposable();
    TestUtils.createMockApplication(testDisposable);
    MutablePicoContainer applicationContainer = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer();
    MockProject mockProject = TestUtils.mockProject(applicationContainer, testDisposable);
    Extensions.cleanRootArea(testDisposable);
    extensionsArea = (ExtensionsAreaImpl) Extensions.getRootArea();
    this.project = mockProject;
    initTest(new Container(applicationContainer), new Container(mockProject.getPicoContainer()));
}
Also used : MockProject(com.intellij.mock.MockProject) MutablePicoContainer(org.picocontainer.MutablePicoContainer) MutablePicoContainer(org.picocontainer.MutablePicoContainer) Before(org.junit.Before)

Aggregations

MockProject (com.intellij.mock.MockProject)3 MockProjectEx (com.intellij.mock.MockProjectEx)2 MockDisposable (com.facebook.buck.intellij.ideabuck.test.util.MockDisposable)1 MyMockApplication (com.facebook.buck.intellij.ideabuck.test.util.MyMockApplication)1 Mock (com.intellij.mock.Mock)1 MockApplication (com.intellij.mock.MockApplication)1 MockFileDocumentManagerImpl (com.intellij.mock.MockFileDocumentManagerImpl)1 VirtualFileManager (com.intellij.openapi.vfs.VirtualFileManager)1 EasyMock (org.easymock.EasyMock)1 Before (org.junit.Before)1 MutablePicoContainer (org.picocontainer.MutablePicoContainer)1