From d42edcf01c49753cac85407d2356a425c8f6c33b Mon Sep 17 00:00:00 2001 From: Julian Arndt Date: Wed, 4 Nov 2020 21:22:27 +0100 Subject: [PATCH] Improve error output and add team id matcher template creator --- src/main/java/de/jeyp91/App.java | 4 +- src/main/java/de/jeyp91/TeamIDMatcher.java | 18 ++++-- .../apifootball/APIFootballConnector.java | 19 +++++++ .../apifootball/APIFootballUpdater.java | 52 +++--------------- .../java/de/jeyp91/gists/GistProvider.java | 19 ++++++- .../de/jeyp91/gists/MatchesListCreator.java | 42 +------------- .../jeyp91/gists/MatchesListGistUpdater.java | 13 +++-- .../gists/TeamIDMatcherTemplateCreator.java | 31 +++++++++++ .../java/de/jeyp91/tippliga/TLWMatch.java | 42 ++------------ .../tippliga/TLWMatchesUpdaterFootball.java | 8 ++- .../java/de/jeyp91/TeamIDMatcherTest.java | 39 +++++++++++-- .../apifootball/APIFootballUpdaterTest.java | 8 +-- .../gists/MatchesListGistUpdaterTest.java | 4 +- .../TeamIDMatcherTemplateCreatorTest.java | 13 +++++ tokens/StoredCredential | Bin 1089 -> 1089 bytes 15 files changed, 158 insertions(+), 154 deletions(-) create mode 100644 src/main/java/de/jeyp91/gists/TeamIDMatcherTemplateCreator.java create mode 100644 src/test/java/de/jeyp91/gists/TeamIDMatcherTemplateCreatorTest.java diff --git a/src/main/java/de/jeyp91/App.java b/src/main/java/de/jeyp91/App.java index d54ea0d..2a14c34 100644 --- a/src/main/java/de/jeyp91/App.java +++ b/src/main/java/de/jeyp91/App.java @@ -49,10 +49,10 @@ public class App { break; case "APIFootballUpdater": APIFootballUpdater apiFootballUpdater = new APIFootballUpdater(season); - apiFootballUpdater.updateAllFixtures(configFile); + apiFootballUpdater.updateAllFixtures(); break; case "MatchesListGistUpdater": - MatchesListGistUpdater matchesListGistUpdater = new MatchesListGistUpdater(configFile); + MatchesListGistUpdater matchesListGistUpdater = new MatchesListGistUpdater(); matchesListGistUpdater.updateAllLeagues(); break; default: diff --git a/src/main/java/de/jeyp91/TeamIDMatcher.java b/src/main/java/de/jeyp91/TeamIDMatcher.java index 5bae3c8..e4aec4c 100644 --- a/src/main/java/de/jeyp91/TeamIDMatcher.java +++ b/src/main/java/de/jeyp91/TeamIDMatcher.java @@ -1,6 +1,7 @@ package de.jeyp91; import com.google.common.collect.HashBiMap; +import de.jeyp91.apifootball.APIFootballMatch; import de.jeyp91.gists.GistProvider; import org.apache.logging.log4j.*; import org.json.simple.JSONArray; @@ -12,6 +13,8 @@ public class TeamIDMatcher { private static final Logger logger = LogManager.getLogger(TeamIDMatcher.class); private static JSONArray teams; private static boolean init = false; + public static final int HOME = 0; + public static final int GUEST = 1; private static void initBiMap() { if(!init) { @@ -39,16 +42,19 @@ public class TeamIDMatcher { } } - public static Integer getTippligaIdFromApiFootballId(Integer id) { - if(id == null) return null; + public static Integer getTippligaIdFromApiFootballId(APIFootballMatch match, int homeguest) { + Integer apiFootballId = homeguest == HOME ? match.getTeamIdHome() : match.getTeamIdGuest(); + Integer tlwId = null; + if(apiFootballId == null) return null; initBiMap(); - if(ids.inverse().containsKey(id)) { - return ids.inverse().get(id); + if(ids.inverse().containsKey(apiFootballId)) { + tlwId = ids.inverse().get(apiFootballId); } else { - logger.error("API Football ID: " + id + " not in ID Matcher."); + String teamname = homeguest == HOME ? match.getTeamNameHome() : match.getTeamNameGuest(); + logger.error("Could not find id " + apiFootballId + " for " + teamname); StatusHolder.setError(); - return null; } + return tlwId; } public static String getTeamNameFromTippligaId(Integer id) { diff --git a/src/main/java/de/jeyp91/apifootball/APIFootballConnector.java b/src/main/java/de/jeyp91/apifootball/APIFootballConnector.java index 5340990..7226e10 100644 --- a/src/main/java/de/jeyp91/apifootball/APIFootballConnector.java +++ b/src/main/java/de/jeyp91/apifootball/APIFootballConnector.java @@ -121,4 +121,23 @@ public class APIFootballConnector { return object; } + + public JSONObject getTeamsForLeague(int league) { + String url = "https://v2.api-football.com/teams/league/" + league; + String content = new APIFootballUpdater(0).getRawData(url); + return stringToJSONObject(content); + } + + private JSONObject stringToJSONObject(String rawData) { + + JSONParser parser = new JSONParser(); + JSONObject data = null; + try { + data = (JSONObject) parser.parse(rawData); + } catch (Exception e) { + /* TODO */ + e.printStackTrace(); + } + return data; + } } \ No newline at end of file diff --git a/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java b/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java index f29f37c..a1a4a1d 100644 --- a/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java +++ b/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java @@ -1,24 +1,19 @@ package de.jeyp91.apifootball; -import com.google.common.io.Resources; import de.jeyp91.gists.GistProvider; import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.HttpClientBuilder; -import org.json.simple.JSONArray; import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; import java.io.*; import java.util.HashSet; public class APIFootballUpdater { - private int season; - private GistProvider provider; + private final int season; + private final GistProvider provider; private final String exceededLimitError = "{\"api\":{\"results\":0,\"error\":\"You have reached the request limit for the day\"}}"; @@ -36,8 +31,8 @@ public class APIFootballUpdater { } } - public void updateAllFixtures(String configPath) throws IOException { - HashSet leagues = getAllLeaguesFromLeagueConfig(configPath); + public void updateAllFixtures() throws IOException { + HashSet leagues = provider.getLeagues(); for (Integer league : leagues) { updateFixtures(league); } @@ -52,8 +47,8 @@ public class APIFootballUpdater { } } - public void updateAllRounds(String configPath) throws IOException { - HashSet leagues = getAllLeaguesFromLeagueConfig(configPath); + public void updateAllRounds() throws IOException { + HashSet leagues = provider.getLeagues(); for (Integer league : leagues) { updateRounds(league); } @@ -64,37 +59,6 @@ public class APIFootballUpdater { this.provider.updateGist(id, filename, content); } - public static HashSet getAllLeaguesFromLeagueConfig(String config) { - - HashSet leagues = new HashSet<>(); - - JSONParser jsonParser = new JSONParser(); - GistProvider prov = GistProvider.getInstance(); - String jsonConfig = prov.getTippligaConfig(config); - JSONObject configObject = null; - try { - configObject = (JSONObject) jsonParser.parse(jsonConfig); - } catch (ParseException e) { - e.printStackTrace(); - } - - JSONArray matchdayConfigs = (JSONArray) configObject.get("matchdayConfig"); - for (Object matchdayConfig : matchdayConfigs) { - JSONArray matchesConfig = (JSONArray) ((JSONObject) matchdayConfig).get("matchesConfig"); - for (Object matchConfig : matchesConfig) { - if (((JSONObject) matchConfig).containsKey("matchesLeague")) { - int league = Integer.parseInt(((JSONObject) matchConfig).get("matchesLeague").toString()); - leagues.add(league); - } - if (((JSONObject) matchConfig).containsKey("matchLeague")) { - int league = Integer.parseInt(((JSONObject) matchConfig).get("matchLeague").toString()); - leagues.add(league); - } - } - } - return leagues; - } - public String getRawData(String requestUrl) { HttpClient client = HttpClientBuilder.create().build(); @@ -106,9 +70,6 @@ public class APIFootballUpdater { HttpResponse response = null; try { response = client.execute(request); - } catch (ClientProtocolException e) { - /* TODO */ - e.printStackTrace(); } catch (IOException e) { /* TODO */ e.printStackTrace(); @@ -116,6 +77,7 @@ public class APIFootballUpdater { BufferedReader rd = null; try { + assert response != null; rd = new BufferedReader( new InputStreamReader(response.getEntity().getContent()) ); diff --git a/src/main/java/de/jeyp91/gists/GistProvider.java b/src/main/java/de/jeyp91/gists/GistProvider.java index 6069bf6..f857116 100644 --- a/src/main/java/de/jeyp91/gists/GistProvider.java +++ b/src/main/java/de/jeyp91/gists/GistProvider.java @@ -21,6 +21,7 @@ import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.URL; import java.nio.charset.StandardCharsets; +import java.util.HashSet; import java.util.Set; public class GistProvider { @@ -156,6 +157,18 @@ public class GistProvider { return stringToJSONArray(getFileFromGist("Team_ID_Matcher.json")); } + public HashSet getLeagues() { + JSONObject leaguesObject = stringToJSONObject(getFileFromGist("Ligen.json")); + JSONArray leaguesArray = (JSONArray) leaguesObject.get("Ligen"); + HashSet leagues = new HashSet<>(); + for (Object leagueObject : leaguesArray) { + JSONObject leagueJSONObject = (JSONObject) leagueObject; + Integer leagueId = ((Long) leagueJSONObject.get("league_id")).intValue(); + leagues.add(leagueId); + } + return leagues; + } + public String getFileFromGist(String filename) { String fileurl = null; for (Object o : this.gistList) { @@ -176,6 +189,8 @@ public class GistProvider { private String getRawData(String requestUrl) { + System.out.println("Gist request: " + requestUrl); + String auth = this.username + ":" + this.password; byte[] encodedAuth = Base64.encodeBase64( auth.getBytes(StandardCharsets.ISO_8859_1)); @@ -229,7 +244,7 @@ public class GistProvider { JSONArray data = null; try { data = (JSONArray) parser.parse(rawData); - } catch (ParseException e) { + } catch (Exception e) { /* TODO */ e.printStackTrace(); } @@ -242,7 +257,7 @@ public class GistProvider { JSONObject data = null; try { data = (JSONObject) parser.parse(rawData); - } catch (ParseException e) { + } catch (Exception e) { /* TODO */ e.printStackTrace(); } diff --git a/src/main/java/de/jeyp91/gists/MatchesListCreator.java b/src/main/java/de/jeyp91/gists/MatchesListCreator.java index 4d5dddd..de1c255 100644 --- a/src/main/java/de/jeyp91/gists/MatchesListCreator.java +++ b/src/main/java/de/jeyp91/gists/MatchesListCreator.java @@ -4,9 +4,6 @@ import com.google.gson.*; import org.json.simple.JSONArray; import org.json.simple.JSONObject; -import java.util.ArrayList; -import java.util.Comparator; - public class MatchesListCreator { private final JSONObject matches = new JSONObject(); @@ -29,14 +26,13 @@ public class MatchesListCreator { } private void populateMatches(JSONArray matchesAPIFootball) { - matchesAPIFootball = sortFixtures(matchesAPIFootball); JSONArray matches = new JSONArray(); for(Object matchAPIFootballObject : matchesAPIFootball) { JSONObject matchAPIFootball = (JSONObject) matchAPIFootballObject; JSONObject match = new JSONObject(); String matchday = matchAPIFootball.get("round").toString(); - match.put("matchday", Integer.parseInt(matchday.substring(17))); + match.put("matchday", matchday); JSONObject teamHome = (JSONObject) matchAPIFootball.get("homeTeam"); String teamNameHome = teamHome.get("team_name").toString(); @@ -65,42 +61,6 @@ public class MatchesListCreator { return gson.toJson(jelement); } - public JSONArray sortFixtures(JSONArray fixturesArray) { - - JSONArray sortedJsonArray = new JSONArray(); - - ArrayList fixturesList = new ArrayList<>(); - for (int i = 0; i < fixturesArray.size(); i++) { - fixturesList.add((JSONObject) fixturesArray.get(i)); - } - fixturesList.sort(new Comparator() { - private static final String KEY_NAME = "round"; - - @Override - public int compare(JSONObject a, JSONObject b) { - String matchdayNameA = (String) a.get(KEY_NAME); - Integer matchdayNumberA = getMatchdayNumberFromString(matchdayNameA); - String matchdayNameB = (String) b.get(KEY_NAME); - Integer matchdayNumberB = getMatchdayNumberFromString(matchdayNameB); - - return matchdayNumberA.compareTo(matchdayNumberB); - } - }); - - for (int i = 0; i < fixturesArray.size(); i++) { - sortedJsonArray.add(fixturesList.get(i)); - } - return sortedJsonArray; - } - - private Integer getMatchdayNumberFromString(String matchdayName) { - Integer matchdayNumber = null; - if(matchdayName.startsWith("Regular Season - ")) { - matchdayNumber = Integer.parseInt(matchdayName.substring(17, matchdayName.length())); - } - return matchdayNumber; - } - public String getFilename() { return "Spiele " + this.country + " " + this.leagueName + ".json"; } diff --git a/src/main/java/de/jeyp91/gists/MatchesListGistUpdater.java b/src/main/java/de/jeyp91/gists/MatchesListGistUpdater.java index 5cbf8e7..dab33ca 100644 --- a/src/main/java/de/jeyp91/gists/MatchesListGistUpdater.java +++ b/src/main/java/de/jeyp91/gists/MatchesListGistUpdater.java @@ -1,15 +1,17 @@ package de.jeyp91.gists; -import de.jeyp91.apifootball.APIFootballUpdater; - import java.io.UnsupportedEncodingException; import java.util.HashSet; public class MatchesListGistUpdater { private HashSet leagues; + private final String gistId; + private final GistProvider prov; - public MatchesListGistUpdater(String configFile) { - this.leagues = APIFootballUpdater.getAllLeaguesFromLeagueConfig(configFile); + public MatchesListGistUpdater() { + this.prov = GistProvider.getInstance(); + this.gistId = prov.getGistID("Spiele"); + this.leagues = prov.getLeagues(); } public void updateAllLeagues() throws UnsupportedEncodingException { @@ -23,7 +25,6 @@ public class MatchesListGistUpdater { String filename = creator.getFilename(); String content = creator.getMatchesBeautful(); GistProvider prov = GistProvider.getInstance(); - String gistId = prov.getGistID("Spiele"); - prov.updateGist(gistId, filename, content); + prov.updateGist(this.gistId, filename, content); } } diff --git a/src/main/java/de/jeyp91/gists/TeamIDMatcherTemplateCreator.java b/src/main/java/de/jeyp91/gists/TeamIDMatcherTemplateCreator.java new file mode 100644 index 0000000..23e5d72 --- /dev/null +++ b/src/main/java/de/jeyp91/gists/TeamIDMatcherTemplateCreator.java @@ -0,0 +1,31 @@ +package de.jeyp91.gists; + +import de.jeyp91.apifootball.APIFootballConnector; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; + +public class TeamIDMatcherTemplateCreator { + APIFootballConnector con; + JSONArray teams; + + public TeamIDMatcherTemplateCreator(int season, int league) { + this.con = APIFootballConnector.getAPIFootballConnectorInstance(season); + JSONObject apiObject = con.getTeamsForLeague(league); + JSONObject teamsObject = (JSONObject) apiObject.get("api"); + this.teams = (JSONArray) teamsObject.get("teams"); + } + + public String getTeamsTemplate() { + String teamsTemplate = ""; + for (Object team : this.teams) { + JSONObject teamObject = (JSONObject) team; + teamsTemplate += ",\n"; + teamsTemplate += " {\n"; + teamsTemplate += " \"teamname\": \"" + teamObject.get("name") + "\",\n"; + teamsTemplate += " \"tippligaID\": " + ",\n"; + teamsTemplate += " \"apiFootballID\": " + teamObject.get("team_id") + "\n"; + teamsTemplate += " }"; + } + return teamsTemplate; + } +} diff --git a/src/main/java/de/jeyp91/tippliga/TLWMatch.java b/src/main/java/de/jeyp91/tippliga/TLWMatch.java index 1d91061..33fe9af 100644 --- a/src/main/java/de/jeyp91/tippliga/TLWMatch.java +++ b/src/main/java/de/jeyp91/tippliga/TLWMatch.java @@ -94,29 +94,13 @@ public class TLWMatch extends BaseMatch{ } } - public TLWMatch(OpenLigaDBMatch oldbmatch, int season, int league, int matchday, int matchNo) { - this.season = season; - this.league = league; - this.matchday = matchday; - this.matchNo = matchNo; - this.teamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(oldbmatch.getTeamIdHome()); - this.teamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(oldbmatch.getTeamIdGuest()); - this.goalsHome = oldbmatch.getGoalsHome(); - this.goalsGuest = oldbmatch.getGoalsGuest(); - this.matchDatetime = oldbmatch.getMatchDateTime().replace("T", " "); - this.groupId = ""; - this.formulaHome = ""; - this.formulaGuest = ""; - this.status = 0; - } - public TLWMatch(APIFootballMatch apiFootballMatch, int season, int league, int matchday, int matchNo, int status, int koMatch) { this.season = season; this.league = league; this.matchday = matchday; this.matchNo = matchNo; - this.teamIdHome = this.getTeamIdHomeFromApiFootballMatch(apiFootballMatch); - this.teamIdGuest = this.getTeamIdGuestFromApiFootballMatch(apiFootballMatch); + this.teamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.HOME); + this.teamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.GUEST); this.goalsHome = apiFootballMatch.getGoalsHome(); this.goalsGuest = apiFootballMatch.getGoalsGuest(); this.matchDatetime = apiFootballMatch.getMatchDateTime().replace("T", " ").substring(0, 19); @@ -279,30 +263,12 @@ public class TLWMatch extends BaseMatch{ } public void updateMatch(APIFootballMatch apiFootballMatch) { - this.teamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch.getTeamIdHome()); - this.teamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch.getTeamIdGuest()); + this.teamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.HOME); + this.teamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.GUEST); this.teamNameHome = apiFootballMatch.getTeamNameHome(); this.teamNameGuest = apiFootballMatch.getTeamNameGuest(); this.goalsHome = apiFootballMatch.getGoalsHome(); this.goalsGuest = apiFootballMatch.getGoalsGuest(); this.matchDatetime = apiFootballMatch.getMatchDateTime().replace("T", " ").substring(0, 19); } - - private Integer getTeamIdHomeFromApiFootballMatch(APIFootballMatch match) { - Integer id = TeamIDMatcher.getTippligaIdFromApiFootballId(match.getTeamIdHome()); - if(id == null) { - logger.error("Could not find id " + match.getTeamIdHome() + " for " + match.getTeamNameHome()); - StatusHolder.setError(); - } - return id; - } - - private Integer getTeamIdGuestFromApiFootballMatch(APIFootballMatch match) { - Integer id = TeamIDMatcher.getTippligaIdFromApiFootballId(match.getTeamIdGuest()); - if(id == null) { - logger.error("Could not find id " + match.getTeamIdGuest() + " for " + match.getTeamNameGuest()); - StatusHolder.setError(); - } - return id; - } } \ No newline at end of file diff --git a/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java b/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java index 7d66bc6..88ad6b6 100644 --- a/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java +++ b/src/main/java/de/jeyp91/tippliga/TLWMatchesUpdaterFootball.java @@ -208,8 +208,12 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase { int foundMatches = 0; TLWMatch matchingMatch = null; for(TLWMatch match : tlwMatches) { - int apiTeamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch.getTeamIdHome()); - int apiTeamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch.getTeamIdGuest()); + Integer apiTeamIdHome = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.HOME); + Integer apiTeamIdGuest = TeamIDMatcher.getTippligaIdFromApiFootballId(apiFootballMatch, TeamIDMatcher.GUEST); + if(apiTeamIdHome == null + || apiTeamIdGuest == null) { + throw new NullPointerException(); + } if( apiTeamIdHome == match.getTeamIdHome() && apiTeamIdGuest == match.getTeamIdGuest() diff --git a/src/test/java/de/jeyp91/TeamIDMatcherTest.java b/src/test/java/de/jeyp91/TeamIDMatcherTest.java index 8951bd3..d00d8c9 100644 --- a/src/test/java/de/jeyp91/TeamIDMatcherTest.java +++ b/src/test/java/de/jeyp91/TeamIDMatcherTest.java @@ -1,4 +1,8 @@ package de.jeyp91; +import de.jeyp91.apifootball.APIFootballMatch; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -18,14 +22,39 @@ public class TeamIDMatcherTest { } @Test - public void getTippligaIdFromOpenLigaDbIdTest() { + public void getTippligaIdFromOpenLigaDbIdTest() throws ParseException { int tlwId; - - tlwId = TeamIDMatcher.getTippligaIdFromApiFootballId(80); + String jsonMatch = "{" + + "\"fixture_id\":1," + + "\"league_id\":1240," + + "\"league\":{" + + "\"name\":\"Testliga\"" + + "}," + + "\"event_date\":\"2020-01-01T00:00:00+02:00\"" + + "\"round\":\"Bayern - 1\"," + + "\"statusShort\":\"FT\"" + + "\"homeTeam\":{" + + "\"team_id\":9330," + + "\"team_name\":\"TestHome\"" + + "}," + + "\"awayTeam\":{" + + "\"team_id\":9331," + + "\"team_name\":\"TestGuest\"" + + "}" + + "}"; + JSONObject matchObject; + JSONParser jsonParser = new JSONParser(); + matchObject = (JSONObject) jsonParser.parse(jsonMatch); + APIFootballMatch match = new APIFootballMatch(matchObject, 2021); + ; + match.teamIdHome = 80; + tlwId = TeamIDMatcher.getTippligaIdFromApiFootballId(match, TeamIDMatcher.HOME); assertEquals(505, tlwId); - tlwId = TeamIDMatcher.getTippligaIdFromApiFootballId(91); + match.teamIdHome = 91; + tlwId = TeamIDMatcher.getTippligaIdFromApiFootballId(match, TeamIDMatcher.HOME); assertEquals(160, tlwId); - tlwId = TeamIDMatcher.getTippligaIdFromApiFootballId(12754); + match.teamIdHome = 12754; + tlwId = TeamIDMatcher.getTippligaIdFromApiFootballId(match, TeamIDMatcher.HOME); assertEquals(182, tlwId); } } diff --git a/src/test/java/de/jeyp91/apifootball/APIFootballUpdaterTest.java b/src/test/java/de/jeyp91/apifootball/APIFootballUpdaterTest.java index 8f381a9..90d6ce4 100644 --- a/src/test/java/de/jeyp91/apifootball/APIFootballUpdaterTest.java +++ b/src/test/java/de/jeyp91/apifootball/APIFootballUpdaterTest.java @@ -9,20 +9,18 @@ public class APIFootballUpdaterTest { @Test public void updateFixturesTest() throws IOException { APIFootballUpdater updater = new APIFootballUpdater(2021); - // updater.updateFixtures(2743); +// updater.updateFixtures(2692); } @Test public void updateAllFixturesTest() throws IOException { APIFootballUpdater updater = new APIFootballUpdater(2021); - // updater.updateAllFixtures("Tippliga.json"); - // updater.updateAllFixtures("WTL_Pokal.json"); +// updater.updateAllFixtures(); } @Test public void updateAllRoundsTest() throws IOException { APIFootballUpdater updater = new APIFootballUpdater(2021); - // updater.updateAllRounds("Tippliga.json"); - // updater.updateAllRounds("WTL_Pokal.json"); +// updater.updateAllRounds(); } } diff --git a/src/test/java/de/jeyp91/gists/MatchesListGistUpdaterTest.java b/src/test/java/de/jeyp91/gists/MatchesListGistUpdaterTest.java index 0385b3d..eef5cae 100644 --- a/src/test/java/de/jeyp91/gists/MatchesListGistUpdaterTest.java +++ b/src/test/java/de/jeyp91/gists/MatchesListGistUpdaterTest.java @@ -8,7 +8,7 @@ public class MatchesListGistUpdaterTest { @Test public void updateAllLeaguesTest() throws UnsupportedEncodingException { - MatchesListGistUpdater updater = new MatchesListGistUpdater("Tippliga.json"); - // updater.updateAllLeagues(); + MatchesListGistUpdater updater = new MatchesListGistUpdater(); + updater.updateAllLeagues(); } } diff --git a/src/test/java/de/jeyp91/gists/TeamIDMatcherTemplateCreatorTest.java b/src/test/java/de/jeyp91/gists/TeamIDMatcherTemplateCreatorTest.java new file mode 100644 index 0000000..a13baf6 --- /dev/null +++ b/src/test/java/de/jeyp91/gists/TeamIDMatcherTemplateCreatorTest.java @@ -0,0 +1,13 @@ +package de.jeyp91.gists; + +import org.junit.Test; + +public class TeamIDMatcherTemplateCreatorTest { + + @Test + public void getTeamsTemplate() { + TeamIDMatcherTemplateCreator creator = new TeamIDMatcherTemplateCreator(0, 2790); + String template = creator.getTeamsTemplate(); + System.out.println(template); + } +} diff --git a/tokens/StoredCredential b/tokens/StoredCredential index ab7d7b93c7c3b55ace7202784e4a201607172c52..ef3e086f0efea52beac044f70b94d9bc8f1ab5ca 100644 GIT binary patch delta 190 zcmV~$!4iQ$007Wo9QqZ9oe|d5v9g0ETiMO()RbLnjY1J8f8bzzh#4oxzR3@GuTdK1 zy=vXZ92&@o*QJpH2?m-riL6Ab5!*QD(_xqJe8`Y_42U~~TIm%2zAivkPpDvai72*H zIM)}wk&yH{MMqfkZNSN1^#OO7m2E^wOe*361ZnCUx15~9m{3n+01YHxbgw!=^ip~F n+@HtTiZYzd)NN(L&R&