use of com.faforever.server.entity.User in project faf-java-server by FAForever.
the class MatchMakerServiceActivatorTest method setUp.
@Before
public void setUp() throws Exception {
player = new Player();
authentication = new TestingAuthenticationToken(new FafUserDetails((User) new User().setPlayer(player).setPassword("pw").setLogin("JUnit")), null);
instance = new MatchMakerServiceActivator(matchmakerService, matchMakerMapper);
}
use of com.faforever.server.entity.User in project faf-java-server by FAForever.
the class ChatServiceTest method testJoinChannels.
@SuppressWarnings("unchecked")
private void testJoinChannels(Group group, String... expectedChannels) {
User user = (User) new User().setPassword("pw").setGroupAssociation(group == null ? null : new GroupAssociation().setGroup(group)).setLogin("junit");
Player player = new Player().setUser(user).setClanMemberships(Collections.singletonList(new ClanMembership().setClan(new Clan().setTag("junit"))));
instance.onPlayerOnlineEvent(new PlayerOnlineEvent(this, player));
ArgumentCaptor<Set<String>> captor = ArgumentCaptor.forClass((Class) Set.class);
verify(clientService).sendChatChannels(captor.capture(), any());
Set<String> channels = captor.getValue();
assertThat(channels, containsInAnyOrder(expectedChannels));
}
use of com.faforever.server.entity.User in project faf-java-server by FAForever.
the class ClientConnectionServiceTest method disconnectClient.
@Test
public void disconnectClient() throws Exception {
ClientConnection clientConnection12 = new ClientConnection("1", Protocol.V1_LEGACY_UTF_16, mock(InetAddress.class));
Player player12 = new Player().setClientConnection(clientConnection12);
when(playerService.getOnlinePlayer(12)).thenReturn(Optional.of(player12));
instance.disconnectClient(new TestingAuthenticationToken(new User(), null), 12);
ArgumentCaptor<CloseConnectionEvent> captor = ArgumentCaptor.forClass(CloseConnectionEvent.class);
verify(eventPublisher).publishEvent(captor.capture());
CloseConnectionEvent value = captor.getValue();
assertThat(value.getClientConnection(), is(clientConnection12));
}
use of com.faforever.server.entity.User in project faf-java-server by FAForever.
the class FafUserDetailsTest method userWithoutBanDetailsIsNonLocked.
@Test
public void userWithoutBanDetailsIsNonLocked() throws Exception {
User user = (User) new User().setPassword(TEST_PASSWORD).setBanDetails(null).setLogin(TEST_USERNAME);
FafUserDetails fafUserDetails = new FafUserDetails(user);
assertThat(fafUserDetails.isAccountNonLocked(), is(true));
}
use of com.faforever.server.entity.User in project faf-java-server by FAForever.
the class FafUserDetailsTest method userWithExpiredBanDetailsIsNonLocked.
@Test
public void userWithExpiredBanDetailsIsNonLocked() throws Exception {
User user = (User) new User().setPassword(TEST_PASSWORD).setBanDetails(new BanDetails().setExpiresAt(Timestamp.from(Instant.now().minusSeconds(1)))).setLogin(TEST_USERNAME);
FafUserDetails fafUserDetails = new FafUserDetails(user);
assertThat(fafUserDetails.isAccountNonLocked(), is(true));
}
Aggregations