use of com.intellij.mock.MockProjectEx in project buck by facebook.
the class BuckClientTest method hasBuckDisconnectedThenWeReconnectIfSoSpecified.
@Test
public void hasBuckDisconnectedThenWeReconnectIfSoSpecified() {
Extensions.registerAreaClass("IDEA_PROJECT", null);
MockDisposable mockDisposable = new MockDisposable();
MockApplication application = new MockApplicationEx(mockDisposable);
ApplicationManager.setApplication(application, mockDisposable);
Project project = new MockProjectEx(new MockDisposable());
TestBuckEventHandler handler = new TestBuckEventHandler();
BuckSocket buckSocket = new BuckSocket(handler);
BuckClientManager.getOrCreateClient(project, handler).setBuckSocket(buckSocket);
BuckClientManager.getOrCreateClient(project, handler).connect();
buckSocket.onConnect(new MockSession());
BuckClientManager.getOrCreateClient(project, handler).disconnectWithRetry();
buckSocket.onClose(0, "FOO");
buckSocket.onConnect(new MockSession());
assertTrue(BuckClientManager.getOrCreateClient(project, handler).isConnected());
}
use of com.intellij.mock.MockProjectEx 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;
}
use of com.intellij.mock.MockProjectEx in project buck by facebook.
the class BuckClientTest method testMessages.
@Test
public void testMessages() {
Extensions.registerAreaClass("IDEA_PROJECT", null);
MockDisposable mockDisposable = new MockDisposable();
MockApplication application = new MockApplicationEx(mockDisposable);
ApplicationManager.setApplication(application, mockDisposable);
Project project = new MockProjectEx(new MockDisposable());
TestBuckEventHandler handler = new TestBuckEventHandler();
BuckClient client = BuckClientManager.getOrCreateClient(project, handler);
// Set the socket we control
BuckSocket socket = new BuckSocket(handler);
client.setBuckSocket(socket);
client.connect();
assertEquals("", handler.getLastMessage());
socket.onMessage("some text");
assertEquals("some text", handler.getLastMessage());
socket.onMessage("some text 1");
socket.onMessage("some text 2");
socket.onMessage("some text 3");
socket.onMessage("some text 4");
assertEquals("some text 4", handler.getLastMessage());
}
use of com.intellij.mock.MockProjectEx 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);
}
use of com.intellij.mock.MockProjectEx in project ServiceStack.Java by ServiceStack.
the class AddRefTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
initApplication();
Extensions.registerAreaClass("IDEA_PROJECT", null);
myProject = new MockProjectEx(getTestRootDisposable());
windowManager = new TestWindowManager();
getApplication().registerService(WindowManager.class, windowManager);
}
Aggregations