use of no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder in project L4J8 by stelar7.
the class MatchListTest method testMatchAndMatchList.
@Test
@Ignore
public void testMatchAndMatchList() {
DataCall.setCacheProvider(new FileSystemCacheProvider());
DataCall.setLogLevel(LogLevel.INFO);
// EnumSet.of(GameQueueType.TEAM_BUILDER_RANKED_SOLO);
Set<GameQueueType> queue = null;
// EnumSet.of(SeasonType.SEASON_2018);
Set<SeasonType> season = null;
// new HashSet<>(Collections.singletonList(40));
Set<Integer> champ = null;
// LocalDateTime.now().withHour(0).toEpochSecond(ZoneOffset.UTC) * 1000;//1481108400000L; // start of season 2017
Long beginTime = null;
// LocalDateTime.now().withHour(0).plusWeeks(1).toEpochSecond(ZoneOffset.UTC) * 1000; // 604800000 is one week in ms
Long endTime = null;
// 0;
Long beginIndex = null;
// 100;
Long endIndex = null;
MatchListBuilder builder = new MatchListBuilder();
Summoner sum = new SummonerBuilder().withPlatform(Platform.EUW1).withName("stelar7").get();
builder = builder.withPlatform(sum.getPlatform()).withAccountId(sum.getAccountId());
builder = builder.withBeginTime(beginTime).withEndTime(endTime);
builder = builder.withBeginIndex(beginIndex).withEndIndex(endIndex);
builder = builder.withQueues(queue).withSeasons(season).withChampions(champ);
LazyList<MatchReference> all = builder.getLazy();
MatchBuilder mb = new MatchBuilder();
TimelineBuilder tb = new TimelineBuilder();
for (MatchReference reference : all) {
Match detail = reference.getFullMatch();
}
}
use of no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder in project L4J8 by stelar7.
the class MatchListTest method testLazyList.
@Test
@Ignore
public void testLazyList() {
LazyList<MatchReference> refs = new SummonerBuilder().withPlatform(Platform.EUW1).withName("stelar7").get().getGames().getLazy();
Assert.assertTrue("LazyList is populated?", refs.isEmpty());
refs.loadFully();
Assert.assertTrue("LazyList is not populated?", !refs.isEmpty());
}
use of no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder in project L4J8 by stelar7.
the class CurrentGameTest method testCurrentGame.
@Test
public void testCurrentGame() {
final L4J8 l4j8 = new L4J8(SecretFile.CREDS);
SpectatorBuilder sb = new SpectatorBuilder().withPlatform(Platform.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(Constants.TEST_PLATFORM[0]).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.summoner.SummonerBuilder in project L4J8 by stelar7.
the class SummonerTest method testById.
@Test
public void testById() {
for (int i = 0; i < Constants.TEST_SUMMONER_IDS.length; i++) {
Summoner optional = new SummonerBuilder().withPlatform(Constants.TEST_PLATFORM[i]).withSummonerId(Constants.TEST_SUMMONER_IDS[i]).get();
doAssertions.accept(optional);
}
}
use of no.stelar7.api.r4j.impl.lol.builders.summoner.SummonerBuilder in project L4J8 by stelar7.
the class AsyncTest method testAsync.
@Test
@Ignore
public void testAsync() {
List<CompletableFuture> futures = new ArrayList<>();
for (int i = 0; i < 100; i++) {
futures.add(supplyAsync(() -> new SummonerBuilder().withPlatform(Platform.EUW1).withAccountId(Constants.TEST_ACCOUNT_IDS[1]).get()).thenAccept(this::handleSummonerCallback));
}
futures.add(supplyAsync(() -> new MatchListBuilder().withPlatform(Platform.EUW1).withAccountId(Constants.TEST_ACCOUNT_IDS[1]).get()).thenAccept(this::handleMatchCallback));
CompletableFuture spinner = CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()]));
spinner.join();
}
Aggregations