use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder in project L4J8 by stelar7.
the class CurrentGameTest method testCurrentGame.
@Test
public void testCurrentGame() {
final R4J r4J = new R4J(SecretFile.CREDS);
SpectatorBuilder sb = new SpectatorBuilder().withPlatform(LeagueShard.EUW1);
// Get a game in progess
final List<SpectatorGameInfo> game = sb.getFeaturedGames();
// Get a summoner from that game
final String name = game.get(0).getParticipants().get(0).getSummonerName();
final Summoner sum = new SummonerBuilder().withPlatform(game.get(0).getPlatform()).withName(name).get();
// Get game info
final SpectatorGameInfo currentGame = sb.withSummonerId(sum.getSummonerId()).getCurrentGame();
if (currentGame != null) {
doAssertions.accept(currentGame);
}
}
use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder in project L4J8 by stelar7.
the class TournamentTest method testAllRegistrations.
@Test
@Disabled
public void testAllRegistrations() {
final ProviderRegistrationParameters params = new ProviderRegistrationParameters(LeagueShard.EUW1, "http://stelar7.no/loltest/provider.php");
final long providerId = this.api.registerAsProvider(params);
final TournamentRegistrationParameters trparams = new TournamentRegistrationParameters("THE BEST TOURNAMENT EVER", providerId);
final long tournamentId = this.api.registerTournament(trparams);
final int teamSize = 5;
SpectatorBuilder spectatorBuilder = new SpectatorBuilder().withPlatform(LeagueShard.EUW1);
final SpectatorGameInfo game = spectatorBuilder.getFeaturedGames().get(0);
List<String> names = game.getParticipants().stream().map(SpectatorParticipant::getSummonerName).collect(Collectors.toList());
List<String> ids = new ArrayList<>();
SummonerBuilder sb = new SummonerBuilder().withPlatform(LeagueShard.EUW1);
for (String name : names) {
ids.add(sb.withName(name).get().getSummonerId());
}
final TournamentCodeUpdateParameters tcinner = new TournamentCodeUpdateParameters(ids, TournamentMapType.SUMMONERS_RIFT, TournamentPickType.TOURNAMENT_DRAFT, TournamentSpectatorType.ALL);
final TournamentCodeParameters tcparams = new TournamentCodeParameters(tcinner, "THIS IS METADATA YOOO", teamSize);
final List<String> codes = this.api.generateTournamentCodes(tcparams, tournamentId, 1);
final TournamentCodeUpdateParameters tcuparams = new TournamentCodeUpdateParameters(ids, TournamentMapType.TWISTED_TREELINE, TournamentPickType.TOURNAMENT_DRAFT, TournamentSpectatorType.ALL);
final List<LobbyEvent> events = this.api.getTournamentLobbyInfo(codes.get(0));
if (!api.isStub()) {
this.api.updateTournament(codes.get(0), tcuparams);
final TournamentCode id = this.api.getTournamentInfo(codes.get(0));
final List<Long> tournamentCodeMatchIds = this.api.getMatchIds(LeagueShard.EUW1, codes.get(0));
final LOLMatch matchDetail = this.api.getMatchInfo(LeagueShard.EUW1, codes.get(0), tournamentCodeMatchIds.get(0));
}
}
use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder in project L4J8 by stelar7.
the class SummonerTest method testByPUUID.
@Test
public void testByPUUID() {
String id = new SpectatorBuilder().withPlatform(LeagueShard.EUW1).getFeaturedGames().get(0).getParticipants().get(0).getSummonerName();
Summoner s = new SummonerBuilder().withPlatform(LeagueShard.EUW1).withName(id).get();
Summoner optional = new SummonerBuilder().withPlatform(s.getPlatform()).withPUUID(s.getPUUID()).get();
doAssertions.accept(optional);
}
use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder in project L4J8 by stelar7.
the class SummonerTest method testByName.
@Test
public void testByName() {
String id = new SpectatorBuilder().withPlatform(LeagueShard.EUW1).getFeaturedGames().get(0).getParticipants().get(0).getSummonerName();
Summoner s = new SummonerBuilder().withPlatform(LeagueShard.EUW1).withName(id).get();
Summoner optional = new SummonerBuilder().withPlatform(s.getPlatform()).withName(s.getNormalizedName()).get();
doAssertions.accept(optional);
}
use of no.stelar7.api.r4j.impl.lol.builders.spectator.SpectatorBuilder in project L4J8 by stelar7.
the class SummonerTest method testById.
@Test
public void testById() {
/*
Summoner ids have been removed from the spectator endpoint, so this test wont work anymore...
String id = new SpectatorBuilder().withPlatform(Platform.EUW1).getFeaturedGames().get(0).getParticipants().get(0).getSummonerId();
Summoner s = new SummonerBuilder().withPlatform(Platform.EUW1).withSummonerId(id).get();
*/
String id = new SpectatorBuilder().withPlatform(LeagueShard.EUW1).getFeaturedGames().get(0).getParticipants().get(0).getSummonerName();
Summoner s = new SummonerBuilder().withPlatform(LeagueShard.EUW1).withName(id).get();
doAssertions.accept(s);
}
Aggregations