use of jetbrains.communicator.ide.IDEFacade in project intellij-plugins by JetBrains.
the class JabberUserFinderTest method testAskForRegister_AnswerYes.
public void testAskForRegister_AnswerYes() throws Exception {
Mock facadeMock = mock(IDEFacade.class);
final String[] params = new String[2];
myUserFinder = new JabberUserFinderImpl((IDEFacade) facadeMock.proxy(), myUserModel) {
@Override
protected void doRegister(final String jabberUserId, final String currentProjectId) {
params[0] = jabberUserId;
params[1] = currentProjectId;
}
};
set_project(facadeMock, "id1", true);
myUserFinder.registerForProject("kir@fff");
assertEquals("kir@fff", params[0]);
assertEquals("id1", params[1]);
params[0] = params[1] = null;
set_project(facadeMock, "id1", false);
myUserFinder.registerForProject("kir@fff");
assertNull("No questions expected now - same user and project", params[0]);
set_project(facadeMock, "id1", true);
myUserFinder.registerForProject("kir@fff1");
assertEquals("Another user, expect question", "kir@fff1", params[0]);
params[0] = params[1] = null;
set_project(facadeMock, "id2", true);
myUserFinder.registerForProject("kir@fff1");
assertEquals("Another project, expect question", "kir@fff1", params[0]);
}
use of jetbrains.communicator.ide.IDEFacade in project intellij-plugins by JetBrains.
the class JabberUserFinderTest method testAskForRegister_AnswerNo.
public void testAskForRegister_AnswerNo() throws Exception {
Mock facadeMock = mock(IDEFacade.class);
final String[] params = new String[2];
myUserFinder = new JabberUserFinderImpl((IDEFacade) facadeMock.proxy(), myUserModel) {
@Override
protected void doRegister(final String jabberUserId, final String currentProjectId) {
params[0] = jabberUserId;
params[1] = currentProjectId;
}
};
facadeMock.expects(atLeastOnce()).method("getCacheDir").will(returnValue(myFacade.getCacheDir()));
facadeMock.expects(once()).method("getCurrentProjectId").will(returnValue("id1"));
facadeMock.expects(once()).method("askQuestion").will(returnValue(false));
myUserFinder.registerForProject("kir@fff");
assertNull(params[0]);
}
use of jetbrains.communicator.ide.IDEFacade in project intellij-plugins by JetBrains.
the class ViewFilesCommandTest method testExecute_NoInformation.
public void testExecute_NoInformation() throws Exception {
final ProjectsData projectsData = new ProjectsData();
MockUser mockUser = new MockUser("user", null) {
@Override
public ProjectsData getProjectsData(IDEFacade ideFacade) {
return projectsData;
}
};
mockUser.setOnline(true);
myMockUserListComponent.setSelectedNodes(new User[] { mockUser });
myFacadeMock.expects(once()).method("showMessage");
myCommand.execute();
}
use of jetbrains.communicator.ide.IDEFacade in project intellij-plugins by JetBrains.
the class ShowDiffCommandTest method testExecute.
public void testExecute() throws Exception {
final VFile vFile = VFile.create("a file");
MockUser user = new MockUser() {
@Override
public String getVFile(VFile file, IDEFacade ideFacade) {
assertSame(vFile, file);
return "something";
}
};
myCommand.setUser(user);
myCommand.setVFile(vFile);
myFacadeMock.expects(once()).method("showDiffFor").with(eq(user), eq(vFile), eq("something"));
myCommand.execute();
}
use of jetbrains.communicator.ide.IDEFacade in project intellij-plugins by JetBrains.
the class OutgoingCodePointerLocalMessage method createConsoleMessage.
public ConsoleMessage createConsoleMessage(User user) {
return new OwnConsoleMessage(user, StringUtil.getMsg("code.pointer"), getWhen()) {
public void printMessage(Project project, ConsoleView console) {
final IDEAFacade ideFacade = (IDEAFacade) Pico.getInstance().getComponentInstanceOfType(IDEFacade.class);
IncomingCodePointerMessage printer = new IncomingCodePointerMessage(myEvent, ideFacade);
printer.outputMessage(console);
}
};
}
Aggregations