use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class P2PTransportTest method testGetAddress.
public void testGetAddress() throws Exception {
User mockUser = UserImpl.create("mock", P2PTransport.CODE);
assertNull("Sanity check", myTransport.getAddress(mockUser));
new AddOnlineUserP2PCommand(myTransport.getUserMonitorThread()).addOnlineUser("localhost", "mock", 3354, null, null);
myTransport.flushCurrentUsers();
assertEquals("Inet address should be set from available online user", "localhost", myTransport.getAddress(mockUser).getHostName());
myTransport.setOnlineUsers(new HashSet<>());
assertNull("Inet address should be reset", myTransport.getAddress(mockUser));
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class P2PTransportTest method testOnUserAdd_AnotherTransport.
public void testOnUserAdd_AnotherTransport() throws Exception {
User mockUser = UserImpl.create("user", MockTransport.NAME);
getBroadcaster().fireEvent(new UserEvent.Added(mockUser));
assertEquals("Should not send notification for another transport:" + myLog, "", myLog);
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class JabberTransportTest method testIsOnlineNotConnected.
public void testIsOnlineNotConnected() throws Throwable {
assertFalse("Not online - return false", UserImpl.create("fake", myTransport.getName()).isOnline());
assertEquals("Not online - offline icon expected", "/ideTalk/offline.png", myTransport.getIcon(myTransport.getUserPresence(new MockUser())));
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class UserTreeTest method setUp.
protected void setUp() throws Exception {
super.setUp();
UserModelImpl userModel = new UserModelImpl(getBroadcaster());
disposeOnTearDown(userModel);
myLocalMessageDispatcher = new LocalMessageDispatcherImpl(getBroadcaster(), new MockIDEFacade(getClass()), userModel);
disposeOnTearDown(myLocalMessageDispatcher);
myUserTree = new UserTree(myLocalMessageDispatcher) {
public void treeDidChange() {
super.treeDidChange();
myTreeChanged = true;
}
protected void invokeSendMessageAction() {
mySendMessageInvoked = true;
}
};
myUser = new MockUser();
myTreePath = new TreePath(myUser);
myTreeChanged = false;
mySendMessageInvoked = false;
}
use of jetbrains.communicator.mock.MockUser in project intellij-plugins by JetBrains.
the class P2PTransportTest method testIsOnline.
public void testIsOnline() throws Exception {
User mockUser = myTransport.createUser("mock", new OnlineUserInfo(InetAddress.getLocalHost(), myTransport.getPort()));
assertFalse(mockUser.isOnline());
myTransport.setOnlineUsers(Arrays.asList(mockUser));
assertTrue("should be online now", mockUser.isOnline());
assertTrue(UserImpl.create("mock", P2PTransport.CODE).isOnline());
}
Aggregations