use of pokeraidbot.domain.gym.Gym in project pokeraidbot by magnusmickelsson.
the class TestServerMain method getGymRepositoryForConfig.
public static GymRepository getGymRepositoryForConfig(LocaleService localeService, ServerConfigRepository serverConfigRepository) {
Map<String, Set<Gym>> gymsPerRegion = new HashMap<>();
final Map<String, Config> configMap = serverConfigRepository.getAllConfig();
System.out.println("Config has following servers: " + configMap.keySet());
for (String server : configMap.keySet()) {
final Config config = serverConfigRepository.getConfigForServer(server);
final String region = config.getRegion();
if (!gymsPerRegion.containsKey(region)) {
final Set<Gym> gymsInRegion = new CSVGymDataReader("/gyms_" + region + ".csv").readAll();
gymsPerRegion.put(region, gymsInRegion);
System.out.println("Loaded " + gymsInRegion.size() + " gyms for server " + server + ".");
}
}
return new GymRepository(gymsPerRegion, localeService);
}
use of pokeraidbot.domain.gym.Gym in project pokeraidbot by magnusmickelsson.
the class GymRepositoryTest method noDuplicatesInDataFiles.
@Test
public void noDuplicatesInDataFiles() {
Map<String, Set<Gym>> gymData = repo.getAllGymData();
for (String region : gymData.keySet()) {
Set<Gym> gyms = gymData.get(region);
for (Gym gym : gyms) {
final Gym gymFromRepo = repo.findByName(gym.getName(), region);
assertThat("Seems we have a duplicate for gymname: " + gym.getName() + " \n" + gymFromRepo.toStringDetails() + " != " + gym.toStringDetails(), gymFromRepo, is(gym));
}
}
}
use of pokeraidbot.domain.gym.Gym in project pokeraidbot by magnusmickelsson.
the class GymRepositoryTest method malakIsExGym.
@Test
public void malakIsExGym() throws Exception {
final Gym gym = repo.findByName("Malak", "vännäs");
assertThat(gym.isInArea("Vännäs"), is(true));
assertThat(gym.isExGym(), is(true));
}
use of pokeraidbot.domain.gym.Gym in project pokeraidbot by magnusmickelsson.
the class GymRepositoryTest method assertAllExGymsInRegion.
private void assertAllExGymsInRegion(String region) {
Set<String> exGymNamesForRegion;
final String fileName = "/gyms_" + region.toLowerCase() + ".csv.ex.txt";
final InputStream inputStreamEx = GymRepositoryTest.class.getResourceAsStream(fileName);
exGymNamesForRegion = CSVGymDataReader.readExGymListIfExists(inputStreamEx, fileName);
for (String gymName : exGymNamesForRegion) {
final Gym gym = repo.findByName(gymName, region);
assertThat(gym != null, is(true));
assertThat(gym.getName(), is(gymName));
}
}
use of pokeraidbot.domain.gym.Gym in project pokeraidbot by magnusmickelsson.
the class GymRepositoryTest method feather360IsExGym.
@Test
public void feather360IsExGym() throws Exception {
final Gym feather360 = repo.findByName("Feather Sculpture 360", "uppsala");
assertThat(feather360.isInArea("Uppsala"), is(true));
assertThat(feather360.isExGym(), is(true));
}
Aggregations