diff --git a/src/main/java/de/jeyp91/App.java b/src/main/java/de/jeyp91/App.java index e666efd..d4481e1 100644 --- a/src/main/java/de/jeyp91/App.java +++ b/src/main/java/de/jeyp91/App.java @@ -62,12 +62,12 @@ public class App { break; case "APIFootballUpdater": APIFootballUpdater apiFootballUpdater = new APIFootballUpdater(); - apiFootballUpdater.updateAllFixtures(); - apiFootballUpdater.updateAllRounds(); + apiFootballUpdater.updateAllFixtures(season); + apiFootballUpdater.updateAllRounds(season); break; case "MatchesListGistUpdater": - MatchesListForumUpdater matchesListForumUpdater = new MatchesListForumUpdater(); - matchesListForumUpdater.updateAllLeagues(); + MatchesListForumUpdater matchesListForumUpdater = new MatchesListForumUpdater(season); + matchesListForumUpdater.updateAllLeagues(season); break; case "PostChecksum": TippligaSQLConnector con = TippligaSQLConnector.getInstance(); diff --git a/src/main/java/de/jeyp91/ResourceProvider.java b/src/main/java/de/jeyp91/ResourceProvider.java index 309eb9b..fa1e626 100644 --- a/src/main/java/de/jeyp91/ResourceProvider.java +++ b/src/main/java/de/jeyp91/ResourceProvider.java @@ -27,8 +27,8 @@ public class ResourceProvider { return array; } - public static JSONArray getLigenConfig() { - return getJSONArrayFromResource("Tippliga/Ligen.json"); + public static JSONArray getLigenConfig(int season) { + return getJSONArrayFromResource("Tippliga/" + season + "_Ligen.json"); } public static JSONArray getTeamIDMatcherConfig() { diff --git a/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java b/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java index 85081d7..ba7db85 100644 --- a/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java +++ b/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java @@ -47,15 +47,15 @@ public class APIFootballUpdater { } } - public void updateAllFixtures() { - HashSet leagues = getLeagues(); + public void updateAllFixtures(int season) { + HashSet leagues = getLeagues(season); for (Integer league : leagues) { updateFixtures(league); } } - public void updateAllRounds() { - HashSet leagues = getLeagues(); + public void updateAllRounds(int season) { + HashSet leagues = getLeagues(season); for (Integer league : leagues) { updateRounds(league); } @@ -131,8 +131,8 @@ public class APIFootballUpdater { return result.toString(); } - public HashSet getLeagues() { - JSONArray leaguesArray = ResourceProvider.getLigenConfig(); + public HashSet getLeagues(int season) { + JSONArray leaguesArray = ResourceProvider.getLigenConfig(season); HashSet leagues = new HashSet<>(); for (Object leagueObject : leaguesArray) { JSONObject leagueJSONObject = (JSONObject) leagueObject; diff --git a/src/main/java/de/jeyp91/tippliga/TLWMatchdaysCreator.java b/src/main/java/de/jeyp91/tippliga/TLWMatchdaysCreator.java index f725243..3e6c852 100644 --- a/src/main/java/de/jeyp91/tippliga/TLWMatchdaysCreator.java +++ b/src/main/java/de/jeyp91/tippliga/TLWMatchdaysCreator.java @@ -22,7 +22,7 @@ public class TLWMatchdaysCreator { this.season = season; this.league = league; - TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(2021, 1, configPath); + TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(season, 1, configPath); this.matches = matchesCreator.getMatches(); TippligaConfigProvider prov = new TippligaConfigProvider(season); diff --git a/src/main/java/de/jeyp91/tippliga/TLWMatchesCreatorFootball.java b/src/main/java/de/jeyp91/tippliga/TLWMatchesCreatorFootball.java index 9387bbc..6a341ee 100644 --- a/src/main/java/de/jeyp91/tippliga/TLWMatchesCreatorFootball.java +++ b/src/main/java/de/jeyp91/tippliga/TLWMatchesCreatorFootball.java @@ -32,6 +32,7 @@ public class TLWMatchesCreatorFootball extends TLWMatchesCreatorBase { this.config = prov.getTippligaConfig(configFileName); this.numberOfMatchdays = ((Long) this.config.get("numberOfMatchdays")).intValue(); + this.matchesPerMatchday = ((Long) this.config.get("matchesPerMatchday")).intValue(); this.matchdayConfig = (JSONArray) this.config.get("matchdayConfig"); this.ko = ((Long) this.config.get("ko")).intValue(); String deliveryDateMode = this.config.containsKey("deliveryDateMode") ? this.config.get("deliveryDateMode").toString() : ""; @@ -46,11 +47,6 @@ public class TLWMatchesCreatorFootball extends TLWMatchesCreatorBase { JSONArray matchesConfig = (JSONArray)((JSONObject) this.matchdayConfig.get(i)).get("matchesConfig"); ArrayList apiFootballMatchesForMatchday = getAPIFootballMatchesForMatchday(matchesConfig); - int tempNumberOfMatchesBackup = this.matchesPerMatchday; - if(((JSONObject) this.matchdayConfig.get(i)).containsKey("numberOfMatches")) { - this.matchesPerMatchday = ((Long) ((JSONObject) this.matchdayConfig.get(i)).get("numberOfMatches")).intValue(); - } - int matchdayMatchCounter = 0; // Use first matchtime because API Football always returns matches sorted by date @@ -74,7 +70,15 @@ public class TLWMatchesCreatorFootball extends TLWMatchesCreatorBase { } // Add empty missing matches - for(int j = matchdayMatchCounter; j < this.matchesPerMatchday; j++) { + int matchesPerMatchdayTemp = 0; + if(this.matchesPerMatchday != 0) { + matchesPerMatchdayTemp = this.matchesPerMatchday; + } else { + if(((JSONObject) this.matchdayConfig.get(i)).containsKey("numberOfMatches")) { + matchesPerMatchdayTemp = ((Long) ((JSONObject) this.matchdayConfig.get(i)).get("numberOfMatches")).intValue(); + } + } + for(int j = matchdayMatchCounter; j < matchesPerMatchdayTemp; j++) { String matchDatetime = ""; if(apiFootballMatchesForMatchday.size() > 0) { matchDatetime = this.TLWMatches.get(this.TLWMatches.size() - 1).getMatchDateTime(); @@ -86,10 +90,6 @@ public class TLWMatchesCreatorFootball extends TLWMatchesCreatorBase { this.nextMatchNo++; this.TLWMatches.add(new TLWMatch(this.season, this.league, TLWMatchday, matchNo, matchDatetime, 0, this.ko)); } - - if(((JSONObject) this.matchdayConfig.get(i)).containsKey("numberOfMatches")) { - this.matchesPerMatchday = tempNumberOfMatchesBackup; - } } } diff --git a/src/main/java/de/jeyp91/tippliga/TLWTeamsCreator.java b/src/main/java/de/jeyp91/tippliga/TLWTeamsCreator.java index 7bc539c..3b3043a 100644 --- a/src/main/java/de/jeyp91/tippliga/TLWTeamsCreator.java +++ b/src/main/java/de/jeyp91/tippliga/TLWTeamsCreator.java @@ -65,7 +65,7 @@ public class TLWTeamsCreator { String getGroup(Integer teamId) { for(TLWMatch match: matches) { if(teamId.equals(match.getTeamIdHome()) || teamId.equals(match.getTeamIdGuest())) { - return match.getGroupId(); + return match.getGroupId() != null ? match.getGroupId() : ""; } } return ""; diff --git a/src/main/java/de/jeyp91/tippligaforum/MatchesListForumUpdater.java b/src/main/java/de/jeyp91/tippligaforum/MatchesListForumUpdater.java index bc58356..fed0e98 100644 --- a/src/main/java/de/jeyp91/tippligaforum/MatchesListForumUpdater.java +++ b/src/main/java/de/jeyp91/tippligaforum/MatchesListForumUpdater.java @@ -8,28 +8,32 @@ import java.util.HashSet; public class MatchesListForumUpdater { private HashSet leagues; - public MatchesListForumUpdater() { - this.leagues = new APIFootballUpdater().getLeagues(); + public MatchesListForumUpdater(int season) { + this.leagues = new APIFootballUpdater().getLeagues(season); } - public void updateAllLeagues() { + public void updateAllLeagues(int season) { for(Integer league : this.leagues) { - updateLeague(league); + updateLeague(season, league); } } - public void updateLeague(int league) { + public void updateLeague(int season, int league) { MatchesListCreator creator = new MatchesListCreator(league); String content = creator.getMatchesBeautiful(); String contentWithCodeBBCode = "[code]" + content + "[/code]"; - int postId = getPostId(creator.getCountry(), creator.getLeagueName()); + int postId = getPostId(season, creator.getCountry(), creator.getLeagueName()); TippligaSQLConnector con = TippligaSQLConnector.getInstance(); con.updatePost(postId, contentWithCodeBBCode); } - private Integer getPostId(String country, String league) { - String query = "SELECT post_id FROM phpbb_posts WHERE post_subject = '" + country + " " + league + "';"; + private Integer getPostId(int season, String country, String league) { TippligaSQLConnector con = TippligaSQLConnector.getInstance(); + Integer adminForumId = con.getForumId("Admin"); + Integer tippligaConfigForumId = con.getForumId("Tippliga-Config", adminForumId); + Integer seasonForumId = con.getForumId(String.valueOf(season), tippligaConfigForumId); + Integer leagueForumId = con.getForumId("Ligen", seasonForumId); + String query = "SELECT post_id FROM phpbb_posts WHERE post_subject = '" + country + " " + league + "' AND forum_id = " + leagueForumId + ";"; ResultSet rset = con.executeQuery(query); Integer postId = null; try { diff --git a/src/main/resources/Tippliga/Ligen.json b/src/main/resources/Tippliga/2021_Ligen.json similarity index 100% rename from src/main/resources/Tippliga/Ligen.json rename to src/main/resources/Tippliga/2021_Ligen.json diff --git a/src/main/resources/Tippliga/2022_Ligen.json b/src/main/resources/Tippliga/2022_Ligen.json new file mode 100644 index 0000000..3269a90 --- /dev/null +++ b/src/main/resources/Tippliga/2022_Ligen.json @@ -0,0 +1,72 @@ +[ + { + "country": "Germany", + "name": "Bundesliga 1", + "league_id": 3510 + }, + { + "country": "Germany", + "name": "Bundesliga 2", + "league_id": 3509 + }, + { + "country": "Germany", + "name": "Liga 3", + "league_id": 3520 + }, + { + "country": "Germany", + "name": "Regionalliga - SudWest", + "league_id": 3582 + }, + { + "country": "Germany", + "name": "Regionalliga - Bayern", + "league_id": 3584 + }, + { + "country": "Germany", + "name": "DFB Pokal", + "league_id": 3532 + }, + { + "country": "Germany", + "name": "U19 Bundesliga", + "league_id": 3555 + }, + { + "country": "Germany", + "name": "Women Bundesliga", + "league_id": 3541 + }, + { + "country": "England", + "name": "Premier League", + "league_id": 3456 + }, + { + "country": "Spain", + "name": "Primera Division", + "league_id": 3513 + }, + { + "country": "Italy", + "name": "Serie A", + "league_id": 3576 + }, + { + "country": "France", + "name": "Ligue 1", + "league_id": 3506 + }, + { + "country": "World", + "name": "UEFA Champions League", + "league_id": 3431 + }, + { + "country": "World", + "name": "UEFA Europa Conference League", + "league_id": 3490 + } +] \ No newline at end of file diff --git a/src/main/resources/Tippliga/Team_ID_Matcher_Config.json b/src/main/resources/Tippliga/Team_ID_Matcher_Config.json index 6481b84..7d29abf 100644 --- a/src/main/resources/Tippliga/Team_ID_Matcher_Config.json +++ b/src/main/resources/Tippliga/Team_ID_Matcher_Config.json @@ -833,5 +833,55 @@ "teamname": "Nordmazedonien", "tippligaID": 805, "apiFootballID": 1105 + }, + { + "teamname": "Wuppertaler SV", + "tippligaID": 62, + "apiFootballID": 9375 + }, + { + "teamname": "VfL Oldenburg", + "tippligaID": 630, + "apiFootballID": 12888 + }, + { + "teamname": "TuS RW Koblenz", + "tippligaID": 32, + "apiFootballID": 1657 + }, + { + "teamname": "Greifswalder FC", + "tippligaID": 631, + "apiFootballID": 16118 + }, + { + "teamname": "Bayreuth", + "tippligaID": 137, + "apiFootballID": 9325 + }, + { + "teamname": "Lokomotive Leipzig", + "tippligaID": 632, + "apiFootballID": 9355 + }, + { + "teamname": "Weiche Flensburg", + "tippligaID": 121, + "apiFootballID": 1649 + }, + { + "teamname": "Bremer Sv", + "tippligaID": 602, + "apiFootballID": 1630 + }, + { + "teamname": "FC Saarbrucken", + "tippligaID": 44, + "apiFootballID": 1639 + }, + { + "teamname": "Verl", + "tippligaID": 52, + "apiFootballID": 4265 } ] diff --git a/src/test/java/de/jeyp91/tippliga/TLWMatchdaysCreatorTest.java b/src/test/java/de/jeyp91/tippliga/TLWMatchdaysCreatorTest.java index 0d3cdfa..aa0dcf0 100644 --- a/src/test/java/de/jeyp91/tippliga/TLWMatchdaysCreatorTest.java +++ b/src/test/java/de/jeyp91/tippliga/TLWMatchdaysCreatorTest.java @@ -9,10 +9,12 @@ import static org.junit.Assert.assertEquals; public class TLWMatchdaysCreatorTest { + int season = 2022; + @Test public void getMatchdaysTippligaTest() { - TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga"); + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 1, "Tippliga"); ArrayList matchdays = matchdaysCreator.getMatchdays(); assertEquals((Integer) 1, matchdays.get(0).getMatchday()); @@ -20,7 +22,7 @@ public class TLWMatchdaysCreatorTest { @Test public void getMatchdaysWTLPokalTest() { - TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "WTL-Pokal"); + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 1, "WTL-Pokal"); ArrayList matchdays = matchdaysCreator.getMatchdays(); assertEquals((Integer) 1, matchdays.get(0).getMatchday()); @@ -29,49 +31,49 @@ public class TLWMatchdaysCreatorTest { @Test public void getMatchdaysTippliga1SqlTest() { - TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga"); + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 1, "Tippliga"); String sql = matchdaysCreator.getMatchdaysSQL(); -// System.out.println(sql); + System.out.println(sql); } @Test public void getMatchdaysTippliga2SqlTest() { - TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga"); + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 2, "Tippliga"); String sql = matchdaysCreator.getMatchdaysSQL(); -// System.out.println(sql); + System.out.println(sql); } @Test public void getMatchdaysTippliga51SqlTest() { - TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 51, "Tippliga"); + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 51, "Tippliga"); String sql = matchdaysCreator.getMatchdaysSQL(); -// System.out.println(sql); + System.out.println(sql); } @Test public void getMatchdaysTippliga52SqlTest() { - TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 52, "Tippliga"); + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 52, "Tippliga"); String sql = matchdaysCreator.getMatchdaysSQL(); -// System.out.println(sql); + System.out.println(sql); } @Test public void getMatchdaysWTLPokal48SqlTest() { - TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL-Pokal"); + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 48, "WTL-Pokal"); String sql = matchdaysCreator.getMatchdaysSQL(); -// System.out.println(sql); + System.out.println(sql); } @Test public void getMatchdaysWTLPokal98SqlTest() { - TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 98, "WTL-Pokal"); + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 98, "WTL-Pokal"); String sql = matchdaysCreator.getMatchdaysSQL(); -// System.out.println(sql); + System.out.println(sql); } @Test diff --git a/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorFootballTest.java b/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorFootballTest.java index c10ccb1..5a20b13 100644 --- a/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorFootballTest.java +++ b/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorFootballTest.java @@ -8,6 +8,8 @@ import static org.junit.Assert.assertEquals; public class TLWMatchesCreatorFootballTest { + int season = 2022; + @Test public void getMatchesTest() { TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 1, "WTL-Pokal"); @@ -19,17 +21,24 @@ public class TLWMatchesCreatorFootballTest { } @Test - public void getMatchesTippligaSqlTest() { - TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 2, "Tippliga"); + public void getMatchesTippliga1SqlTest() { + TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(season, 1, "Tippliga"); String sql = creator.getSQLInsertString(); -// System.out.println(sql); + System.out.println(sql); + } + + @Test + public void getMatchesTippliga2SqlTest() { + TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(season, 2, "Tippliga"); + String sql = creator.getSQLInsertString(); + System.out.println(sql); } @Test public void getMatchesWTLPokalSqlTest() { - TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 48, "WTL-Pokal"); + TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(season, 48, "WTL-Pokal"); String sql = creator.getSQLInsertString(); -// System.out.println(sql); + System.out.println(sql); } @Test diff --git a/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorTipperPokalTest.java b/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorTipperPokalTest.java index 77a560a..f74e12e 100644 --- a/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorTipperPokalTest.java +++ b/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorTipperPokalTest.java @@ -2,17 +2,15 @@ package de.jeyp91.tippliga; import org.junit.Test; -import java.text.ParseException; - public class TLWMatchesCreatorTipperPokalTest { @Test - public void getMatchesWTLPokalTest() throws ParseException { - TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL-Pokal"); + public void getMatchesWTLPokalTest() { + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2022, 48, "WTL-Pokal"); - TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(2021, 98, "WTL-Pokal Tipper", matchdaysCreator.getMatchdays()); + TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(2022, 98, "WTL-Pokal Tipper", matchdaysCreator.getMatchdays()); String sql = creator.getSQLInsertString(); -// System.out.println(sql); + System.out.println(sql); } } diff --git a/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorTipperTest.java b/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorTipperTest.java index 09480a6..f38e695 100644 --- a/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorTipperTest.java +++ b/src/test/java/de/jeyp91/tippliga/TLWMatchesCreatorTipperTest.java @@ -8,13 +8,25 @@ import static org.junit.Assert.assertEquals; public class TLWMatchesCreatorTipperTest { - @Test - public void getMatchesTippligaTest() throws ParseException { - TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga"); + int season = 2022; - TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 52, "2. Tippliga Tipper", matchdaysCreator.getMatchdays()); + @Test + public void getMatchesTippliga1Test() { + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 1, "Tippliga"); + + TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(season, 51, "1. Tippliga Tipper", matchdaysCreator.getMatchdays()); String sql = creator.getSQLInsertString(); -// System.out.println(sql); + System.out.println(sql); + } + + @Test + public void getMatchesTippliga2Test() { + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 2, "Tippliga"); + + TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(season, 52, "2. Tippliga Tipper", matchdaysCreator.getMatchdays()); + + String sql = creator.getSQLInsertString(); + System.out.println(sql); } } diff --git a/src/test/java/de/jeyp91/tippliga/TLWTeamsCreatorTest.java b/src/test/java/de/jeyp91/tippliga/TLWTeamsCreatorTest.java index 049da54..b37fa8c 100644 --- a/src/test/java/de/jeyp91/tippliga/TLWTeamsCreatorTest.java +++ b/src/test/java/de/jeyp91/tippliga/TLWTeamsCreatorTest.java @@ -8,14 +8,37 @@ import java.util.ArrayList; import static org.junit.Assert.assertEquals; public class TLWTeamsCreatorTest { + + int season = 2022; + @Test public void getTeamsTippligaFootball1Test() { - TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(2021, 1, "Tippliga"); + TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(season, 1, "Tippliga"); ArrayList matches = matchesCreator.getMatches(); - TLWTeamsCreator teamCreator = new TLWTeamsCreator(2021, 1, matches); + TLWTeamsCreator teamCreator = new TLWTeamsCreator(season, 1, matches); String sql = teamCreator.getSql(); -// System.out.println(sql); + System.out.println(sql); + } + + @Test + public void getTeamsTippligaFootball2Test() { + TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(season, 2, "Tippliga"); + ArrayList matches = matchesCreator.getMatches(); + + TLWTeamsCreator teamCreator = new TLWTeamsCreator(season, 2, matches); + String sql = teamCreator.getSql(); + System.out.println(sql); + } + + @Test + public void getTeamsWTLPokalTest() { + TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(season, 48, "WTL-Pokal"); + ArrayList matches = matchesCreator.getMatches(); + + TLWTeamsCreator teamCreator = new TLWTeamsCreator(season, 48, matches); + String sql = teamCreator.getSql(); + System.out.println(sql); } @Test @@ -30,40 +53,40 @@ public class TLWTeamsCreatorTest { @Test public void getTeamsTipper1TLTest() throws ParseException { - TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga"); + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 1, "Tippliga"); - TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 51, "1. Tippliga Tipper", matchdaysCreator.getMatchdays()); + TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(season, 51, "1. Tippliga Tipper", matchdaysCreator.getMatchdays()); ArrayList matches = creator.getMatches(); - TLWTeamsCreator teamCreator = new TLWTeamsCreator(2021, 51, matches); + TLWTeamsCreator teamCreator = new TLWTeamsCreator(season, 51, matches); String sql = teamCreator.getSql(); -// System.out.println(sql); + System.out.println(sql); } @Test public void getTeamsTipper2TLTest() throws ParseException { - TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga"); + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 2, "Tippliga"); - TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 52, "2. Tippliga Tipper", matchdaysCreator.getMatchdays()); + TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(season, 52, "2. Tippliga Tipper", matchdaysCreator.getMatchdays()); ArrayList matches = creator.getMatches(); - TLWTeamsCreator teamCreator = new TLWTeamsCreator(2021, 52, matches); + TLWTeamsCreator teamCreator = new TLWTeamsCreator(season, 52, matches); String sql = teamCreator.getSql(); -// System.out.println(sql); + System.out.println(sql); } @Test public void getTeamsTipperWTLTest() throws ParseException { - TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL-Pokal"); + TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(season, 48, "WTL-Pokal"); - TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(2021, 98, "WTL-Pokal Tipper", matchdaysCreator.getMatchdays()); + TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(season, 98, "WTL-Pokal Tipper", matchdaysCreator.getMatchdays()); ArrayList matches = creator.getMatches(); - TLWTeamsCreator teamCreator = new TLWTeamsCreator(2021, 98, matches); + TLWTeamsCreator teamCreator = new TLWTeamsCreator(season, 98, matches); String sql = teamCreator.getSql(); -// System.out.println(sql); + System.out.println(sql); } } diff --git a/src/test/java/de/jeyp91/tippligaforum/MatchesListForumUpdaterTest.java b/src/test/java/de/jeyp91/tippligaforum/MatchesListForumUpdaterTest.java index fbc85d7..ca5b14c 100644 --- a/src/test/java/de/jeyp91/tippligaforum/MatchesListForumUpdaterTest.java +++ b/src/test/java/de/jeyp91/tippligaforum/MatchesListForumUpdaterTest.java @@ -1,21 +1,18 @@ package de.jeyp91.tippligaforum; -import de.jeyp91.tippligaforum.MatchesListForumUpdater; import org.junit.Test; -import java.io.UnsupportedEncodingException; - public class MatchesListForumUpdaterTest { @Test public void updateAllLeaguesTest() { - MatchesListForumUpdater updater = new MatchesListForumUpdater(); -// updater.updateAllLeagues(); + MatchesListForumUpdater updater = new MatchesListForumUpdater(2022); +// updater.updateAllLeagues(2022); } @Test public void updateLeagueTest() { - MatchesListForumUpdater updater = new MatchesListForumUpdater(); - updater.updateLeague(2743); + MatchesListForumUpdater updater = new MatchesListForumUpdater(2022); + updater.updateLeague(2022, 3509); } }