当前位置: 首页>>代码示例>>Java>>正文


Java MockApplicationEx类代码示例

本文整理汇总了Java中com.intellij.mock.MockApplicationEx的典型用法代码示例。如果您正苦于以下问题:Java MockApplicationEx类的具体用法?Java MockApplicationEx怎么用?Java MockApplicationEx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MockApplicationEx类属于com.intellij.mock包,在下文中一共展示了MockApplicationEx类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initApplication

import com.intellij.mock.MockApplicationEx; //导入依赖的package包/类
public void initApplication() {
  //if (ApplicationManager.getApplication() instanceof MockApplicationEx) return;
  final MockApplicationEx instance = new MockApplicationEx(getTestRootDisposable());
  ApplicationManager.setApplication(instance,
                                    new Getter<FileTypeRegistry>() {
                                      @Override
                                      public FileTypeRegistry get() {
                                        return FileTypeManager.getInstance();
                                      }
                                    },
                                    new Getter<EncodingRegistry>() {
                                      @Override
                                      public EncodingRegistry get() {
                                        return EncodingManager.getInstance();
                                      }
                                    },
                                    getTestRootDisposable());
  getApplication().registerService(EncodingManager.class, EncodingManagerImpl.class);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:PlatformLiteFixture.java

示例2: testConnectDisconnect

import com.intellij.mock.MockApplicationEx; //导入依赖的package包/类
@Test
public void testConnectDisconnect() {
  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).disconnectWithoutRetry();
  buckSocket.onClose(0, "FOO");

  assertFalse(BuckClientManager.getOrCreateClient(project, handler).isConnected());
}
 
开发者ID:facebook,项目名称:buck,代码行数:23,代码来源:BuckClientTest.java

示例3: hasBuckDisconnectedThenWeReconnectIfSoSpecified

import com.intellij.mock.MockApplicationEx; //导入依赖的package包/类
@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());
}
 
开发者ID:facebook,项目名称:buck,代码行数:24,代码来源:BuckClientTest.java

示例4: hasBuckModuleAttachReceivedNullTargetThenWeShowNone

import com.intellij.mock.MockApplicationEx; //导入依赖的package包/类
@Test
public void hasBuckModuleAttachReceivedNullTargetThenWeShowNone()
    throws NoSuchFieldException, IllegalAccessException {
  Extensions.registerAreaClass("IDEA_PROJECT", null);
  MockDisposable mockDisposable = new MockDisposable();

  MockApplication application = new MockApplicationEx(mockDisposable);
  ApplicationManager.setApplication(application, mockDisposable);

  BuckEventsConsumer buckEventsConsumer =
      new BuckEventsConsumer(new MockProjectEx(new MockDisposable()));

  buckEventsConsumer.attach(null, new DefaultTreeModel(null));

  Field privateStringField = BuckEventsConsumer.class.getDeclaredField("mTarget");

  privateStringField.setAccessible(true);

  String fieldValue = (String) privateStringField.get(buckEventsConsumer);
  assertEquals(fieldValue, "NONE");
}
 
开发者ID:facebook,项目名称:buck,代码行数:22,代码来源:BuckEventsConsumerTest.java

示例5: initBuckModule

import com.intellij.mock.MockApplicationEx; //导入依赖的package包/类
public Project initBuckModule() {
  Extensions.registerAreaClass("IDEA_PROJECT", null);
  MockDisposable mockDisposable = new MockDisposable();
  MockProjectEx project = new MockProjectEx(mockDisposable);

  MockApplication application = new MockApplicationEx(mockDisposable);
  ApplicationManager.setApplication(application, mockDisposable);
  application.registerService(UISettings.class, UISettings.getShadowInstance());
  application.registerService(PropertiesComponent.class, new ProjectPropertiesComponentImpl());
  FileTypeManager fileTypeManager = EasyMock.createMock(FileTypeManager.class);
  EasyMock.expect(
          fileTypeManager.getFileTypeByFileName(BuckFileType.INSTANCE.getDefaultExtension()))
      .andReturn(BuckFileType.INSTANCE)
      .times(3);
  EasyMock.replay(fileTypeManager);
  application.registerService(FileTypeManager.class, fileTypeManager);
  project.addComponent(PsiDocumentManager.class, EasyMock.createMock(PsiDocumentManager.class));

  return project;
}
 
开发者ID:facebook,项目名称:buck,代码行数:21,代码来源:BuckModuleTest.java

示例6: initApplication

import com.intellij.mock.MockApplicationEx; //导入依赖的package包/类
public void initApplication() {
  //if (ApplicationManager.getApplication() instanceof MockApplicationEx) return;
  final MockApplicationEx instance = new MockApplicationEx(getTestRootDisposable());
  ApplicationManager.setApplication(instance,
                                    new Getter<FileTypeRegistry>() {
                                      @Override
                                      public FileTypeRegistry get() {
                                        return FileTypeManager.getInstance();
                                      }
                                    },
                                    getTestRootDisposable());
  getApplication().registerService(EncodingManager.class, EncodingManagerImpl.class);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:PlatformLiteFixture.java

示例7: setUp

import com.intellij.mock.MockApplicationEx; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  final Application old = ApplicationManagerEx.getApplication();
  myRootDisposable = Disposer.newDisposable();
  MockApplicationEx app = new MockApplicationEx(getRootDisposable()) {
    @NotNull
    @Override
    public Future<?> executeOnPooledThread(@NotNull Runnable action) {
      return old != null ? old.executeOnPooledThread(action) : super.executeOnPooledThread(action);
    }
  };
  ApplicationManager.setApplication(app, myRootDisposable);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:FlyIdeaTestCase.java

示例8: testMessages

import com.intellij.mock.MockApplicationEx; //导入依赖的package包/类
@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());
}
 
开发者ID:facebook,项目名称:buck,代码行数:31,代码来源:BuckClientTest.java

示例9: getApplication

import com.intellij.mock.MockApplicationEx; //导入依赖的package包/类
public static MockApplicationEx getApplication() {
  return (MockApplicationEx)ApplicationManager.getApplication();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:PlatformLiteFixture.java

示例10: createApplication

import com.intellij.mock.MockApplicationEx; //导入依赖的package包/类
@NotNull
protected MockApplication createApplication(@NotNull Disposable parentDisposable) {
  return new MockApplicationEx(parentDisposable);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:CoreApplicationEnvironment.java

示例11: createApplication

import com.intellij.mock.MockApplicationEx; //导入依赖的package包/类
@Nonnull
protected MockApplication createApplication(@Nonnull Disposable parentDisposable) {
  return new MockApplicationEx(parentDisposable);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:CoreApplicationEnvironment.java


注:本文中的com.intellij.mock.MockApplicationEx类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。