Search in sources :

Example 1 with FafApiProperties

use of com.faforever.api.config.FafApiProperties in project faf-java-api by FAForever.

the class ClanServiceTest method generatePlayerInvitationToken.

@Test
public void generatePlayerInvitationToken() throws IOException {
    Player requester = new Player();
    requester.setId(1);
    Player newMember = new Player();
    newMember.setId(2);
    Clan clan = ClanFactory.builder().leader(requester).build();
    FafApiProperties props = new FafApiProperties();
    when(clanRepository.findById(clan.getId())).thenReturn(Optional.of(clan));
    when(playerRepository.findById(newMember.getId())).thenReturn(Optional.of(newMember));
    when(fafApiProperties.getClan()).thenReturn(props.getClan());
    instance.generatePlayerInvitationToken(requester, newMember.getId(), clan.getId());
    ArgumentCaptor<InvitationResult> captor = ArgumentCaptor.forClass(InvitationResult.class);
    verify(jwtService, Mockito.times(1)).sign(captor.capture());
    assertThat("expire", captor.getValue().getExpire(), greaterThan(System.currentTimeMillis()));
    assertEquals(newMember.getId(), captor.getValue().getNewMember().getId());
    assertEquals(newMember.getLogin(), captor.getValue().getNewMember().getLogin());
    assertEquals(clan.getId(), captor.getValue().getClan().getId());
    assertEquals(clan.getTag(), captor.getValue().getClan().getTag());
    assertEquals(clan.getName(), captor.getValue().getClan().getName());
}
Also used : Player(com.faforever.api.data.domain.Player) Clan(com.faforever.api.data.domain.Clan) InvitationResult(com.faforever.api.clan.result.InvitationResult) FafApiProperties(com.faforever.api.config.FafApiProperties) Test(org.junit.Test)

Example 2 with FafApiProperties

use of com.faforever.api.config.FafApiProperties in project faf-java-api by FAForever.

the class TutorialEnricherTest method setUp.

@Before
public void setUp() {
    FafApiProperties fafApiProperties = new FafApiProperties();
    fafApiProperties.getTutorial().setThumbnailUrlFormat("http://example.com/%s");
    instance = new TutorialEnricherListener();
    instance.init(fafApiProperties, messageSourceAccessor);
}
Also used : FafApiProperties(com.faforever.api.config.FafApiProperties) Before(org.junit.Before)

Example 3 with FafApiProperties

use of com.faforever.api.config.FafApiProperties in project faf-java-api by FAForever.

the class ModServiceTest method setUp.

@Before
public void setUp() throws Exception {
    FafApiProperties properties = new FafApiProperties();
    properties.getMod().setTargetDirectory(temporaryFolder.getRoot().toPath().resolve("mods"));
    properties.getMod().setThumbnailTargetDirectory(temporaryFolder.getRoot().toPath().resolve("thumbnails"));
    when(modRepository.save(any(Mod.class))).thenAnswer(invocation -> invocation.getArgument(0));
    instance = new ModService(properties, modRepository, modVersionRepository);
}
Also used : Mod(com.faforever.api.data.domain.Mod) FafApiProperties(com.faforever.api.config.FafApiProperties) Before(org.junit.Before)

Example 4 with FafApiProperties

use of com.faforever.api.config.FafApiProperties in project faf-java-api by FAForever.

the class GitHubDeploymentServiceTest method setUp.

@Before
public void setUp() throws Exception {
    apiProperties = new FafApiProperties();
    instance = new GitHubDeploymentService(applicationContext, apiProperties, featuredModService);
}
Also used : FafApiProperties(com.faforever.api.config.FafApiProperties) Before(org.junit.Before)

Example 5 with FafApiProperties

use of com.faforever.api.config.FafApiProperties in project faf-java-api by FAForever.

the class LegacyFeaturedModDeploymentTaskTest method setUp.

@Before
public void setUp() throws Exception {
    properties = new FafApiProperties();
    Deployment deployment = properties.getDeployment();
    deployment.setRepositoriesDirectory(repositoriesFolder.getRoot().getAbsolutePath());
    deployment.setFeaturedModsTargetDirectory(targetFolder.getRoot().getAbsolutePath());
    instance = new LegacyFeaturedModDeploymentTask(gitWrapper, featuredModService, properties);
}
Also used : Deployment(com.faforever.api.config.FafApiProperties.Deployment) FafApiProperties(com.faforever.api.config.FafApiProperties) Before(org.junit.Before)

Aggregations

FafApiProperties (com.faforever.api.config.FafApiProperties)12 Before (org.junit.Before)10 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Test (org.junit.Test)2 InvitationResult (com.faforever.api.clan.result.InvitationResult)1 Deployment (com.faforever.api.config.FafApiProperties.Deployment)1 Avatar (com.faforever.api.data.domain.Avatar)1 Clan (com.faforever.api.data.domain.Clan)1 FeaturedModEnricher (com.faforever.api.data.domain.FeaturedModEnricher)1 Mod (com.faforever.api.data.domain.Mod)1 Player (com.faforever.api.data.domain.Player)1 User (com.faforever.api.data.domain.User)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 JavaTimeModule (com.fasterxml.jackson.datatype.jsr310.JavaTimeModule)1 InputStream (java.io.InputStream)1 Matchers.anyString (org.mockito.Matchers.anyString)1 WebMvcTest (org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest)1 MockMultipartFile (org.springframework.mock.web.MockMultipartFile)1