Remove Gist

This commit is contained in:
2020-11-08 23:04:32 +01:00
parent 5862a99d73
commit 8cfb2a325a
48 changed files with 2792 additions and 668 deletions

View File

@@ -0,0 +1,13 @@
package de.jeyp91;
import org.junit.Test;
public class S3ProviderTest {
@Test
public void getFixturesFromS3Test() {
S3Provider prov = new S3Provider();
String rounds = prov.getFixturesStringFromS3(1240);
System.out.println(rounds);
}
}

View File

@@ -1,5 +1,6 @@
package de.jeyp91;
import de.jeyp91.apifootball.APIFootballMatch;
import de.jeyp91.teamidmatcher.TeamIDMatcher;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
@@ -46,7 +47,7 @@ public class TeamIDMatcherTest {
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);

View File

@@ -2,25 +2,23 @@ package de.jeyp91.apifootball;
import org.junit.Test;
import java.io.IOException;
public class APIFootballUpdaterTest {
@Test
public void updateFixturesTest() throws IOException {
APIFootballUpdater updater = new APIFootballUpdater(2021);
// updater.updateFixtures(2692);
public void updateFixturesTest() {
APIFootballUpdater updater = new APIFootballUpdater();
updater.updateFixtures(1240);
}
@Test
public void updateAllFixturesTest() throws IOException {
APIFootballUpdater updater = new APIFootballUpdater(2021);
// updater.updateAllFixtures();
public void updateAllFixturesTest() {
APIFootballUpdater updater = new APIFootballUpdater();
updater.updateAllFixtures();
}
@Test
public void updateAllRoundsTest() throws IOException {
APIFootballUpdater updater = new APIFootballUpdater(2021);
// updater.updateAllRounds();
public void updateAllRoundsTest() {
APIFootballUpdater updater = new APIFootballUpdater();
updater.updateAllRounds();
}
}

View File

@@ -1,55 +0,0 @@
package de.jeyp91.gists;
import com.google.api.client.util.DateTime;
import de.jeyp91.apifootball.APIFootballUpdater;
import org.json.simple.JSONArray;
import org.junit.Test;
import java.io.UnsupportedEncodingException;
public class GistProviderTest {
@Test
public void listAllGistsTest() {
GistProvider prov = GistProvider.getInstance();
JSONArray gists = prov.listAllGists();
// System.out.println(gists);
}
@Test
public void getFileTest() {
GistProvider prov = GistProvider.getInstance();
String file = prov.getFileFromGist("Team_ID_Matcher.json");
// System.out.println(file);
}
@Test
public void getTeamIdMatcherTest() {
GistProvider prov = GistProvider.getInstance();
JSONArray matcher = prov.getTeamIdMatcher();
// System.out.println(matcher);
}
@Test
public void getGistUpdatedTimestampTest() {
GistProvider prov = GistProvider.getInstance();
DateTime date = prov.getGistUpdatedTimestamp("Matches");
// System.out.println(date);
}
@Test
public void getGistIDTest() {
GistProvider prov = GistProvider.getInstance();
String id = prov.getGistID("Matches");
// System.out.println(id);
}
@Test
public void updateGistTest() throws UnsupportedEncodingException {
GistProvider prov = GistProvider.getInstance();
APIFootballUpdater updater = new APIFootballUpdater(2021);
// String body = updater.getRawData("https://v2.api-football.com/fixtures/league/2738?timezone=Europe/Berlin");
// String content = prov.updateGist("6ec51d59cac70c9f4c040eeea1c0cdd9", "matches_league_2738.json", body);
// System.out.println(content);
}
}

View File

@@ -1,14 +0,0 @@
package de.jeyp91.gists;
import org.junit.Test;
import java.io.UnsupportedEncodingException;
public class MatchesListGistUpdaterTest {
@Test
public void updateAllLeaguesTest() throws UnsupportedEncodingException {
MatchesListGistUpdater updater = new MatchesListGistUpdater();
updater.updateAllLeagues();
}
}

View File

@@ -1,5 +1,6 @@
package de.jeyp91.gists;
package de.jeyp91.teamidmatcher;
import de.jeyp91.teamidmatcher.TeamIDMatcherTemplateCreator;
import org.junit.Test;
public class TeamIDMatcherTemplateCreatorTest {

View File

@@ -6,7 +6,7 @@ public class TLWMatchdayUpdaterTest {
@Test
public void getUpdateSqlTest1() throws Exception {
TLWMatchdaysUpdater matchdaysUpdater = new TLWMatchdaysUpdater(2021, 1, "Tippliga.json");
TLWMatchdaysUpdater matchdaysUpdater = new TLWMatchdaysUpdater(2021, 1, "Tippliga");
String sql = matchdaysUpdater.getUpdateSql();
@@ -16,7 +16,7 @@ public class TLWMatchdayUpdaterTest {
@Test
public void getUpdateSqlTest2() throws Exception {
TLWMatchdaysUpdater matchdaysUpdater = new TLWMatchdaysUpdater(2021, 2, "Tippliga.json");
TLWMatchdaysUpdater matchdaysUpdater = new TLWMatchdaysUpdater(2021, 2, "Tippliga");
String sql = matchdaysUpdater.getUpdateSql();

View File

@@ -12,7 +12,7 @@ public class TLWMatchdaysCreatorTest {
@Test
public void getMatchdaysTippligaTest() throws ParseException {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga.json");
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga");
ArrayList<TLWMatchday> matchdays = matchdaysCreator.getMatchdays();
assertEquals((Integer) 1, matchdays.get(0).getMatchday());
@@ -20,7 +20,7 @@ public class TLWMatchdaysCreatorTest {
@Test
public void getMatchdaysWTLPokalTest() throws ParseException {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "WTL_Pokal.json");
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "WTL-Pokal");
ArrayList<TLWMatchday> matchdays = matchdaysCreator.getMatchdays();
assertEquals((Integer) 1, matchdays.get(0).getMatchday());
@@ -29,7 +29,7 @@ public class TLWMatchdaysCreatorTest {
@Test
public void getMatchdaysTippliga1SqlTest() throws ParseException {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga.json");
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga");
String sql = matchdaysCreator.getMatchdaysSQL();
// System.out.println(sql);
}
@@ -37,7 +37,7 @@ public class TLWMatchdaysCreatorTest {
@Test
public void getMatchdaysTippliga2SqlTest() throws ParseException {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga.json");
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga");
String sql = matchdaysCreator.getMatchdaysSQL();
// System.out.println(sql);
}
@@ -45,7 +45,7 @@ public class TLWMatchdaysCreatorTest {
@Test
public void getMatchdaysTippliga51SqlTest() throws ParseException {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 51, "Tippliga.json");
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 51, "Tippliga");
String sql = matchdaysCreator.getMatchdaysSQL();
// System.out.println(sql);
}
@@ -53,7 +53,7 @@ public class TLWMatchdaysCreatorTest {
@Test
public void getMatchdaysTippliga52SqlTest() throws ParseException {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 52, "Tippliga.json");
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 52, "Tippliga");
String sql = matchdaysCreator.getMatchdaysSQL();
// System.out.println(sql);
}
@@ -61,7 +61,7 @@ public class TLWMatchdaysCreatorTest {
@Test
public void getMatchdaysWTLPokal48SqlTest() throws ParseException {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL_Pokal.json");
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL-Pokal");
String sql = matchdaysCreator.getMatchdaysSQL();
// System.out.println(sql);
}
@@ -69,7 +69,7 @@ public class TLWMatchdaysCreatorTest {
@Test
public void getMatchdaysWTLPokal98SqlTest() throws ParseException {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 98, "WTL_Pokal.json");
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 98, "WTL-Pokal");
String sql = matchdaysCreator.getMatchdaysSQL();
// System.out.println(sql);
}

View File

@@ -10,7 +10,7 @@ public class TLWMatchesCreatorFootballTest {
@Test
public void getMatchesTest() {
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 1, "WTL_Pokal.json");
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 1, "WTL-Pokal");
ArrayList<TLWMatch> matches = creator.getMatches();
assertEquals((Integer) 1, matches.get(0).getMatchNo());
@@ -20,14 +20,14 @@ public class TLWMatchesCreatorFootballTest {
@Test
public void getMatchesTippligaSqlTest() {
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 2, "Tippliga.json");
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 2, "Tippliga");
String sql = creator.getSQLInsertString();
// System.out.println(sql);
}
@Test
public void getMatchesWTLPokalSqlTest() {
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 48, "WTL_Pokal.json");
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 48, "WTL-Pokal");
String sql = creator.getSQLInsertString();
// System.out.println(sql);
}

View File

@@ -8,9 +8,9 @@ public class TLWMatchesCreatorTipperPokalTest {
@Test
public void getMatchesWTLPokalTest() throws ParseException {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL_Pokal.json");
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL-Pokal");
TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(2021, 98, "WTL_Tipper.json", matchdaysCreator.getMatchdays());
TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(2021, 98, "WTL-Pokal Tipper", matchdaysCreator.getMatchdays());
String sql = creator.getSQLInsertString();
// System.out.println(sql);

View File

@@ -10,9 +10,9 @@ public class TLWMatchesCreatorTipperTest {
@Test
public void getMatchesTippligaTest() throws ParseException {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga.json");
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga");
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 52, "2TL_Tipper.json", matchdaysCreator.getMatchdays());
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 52, "2. Tippliga Tipper", matchdaysCreator.getMatchdays());
String sql = creator.getSQLInsertString();
// System.out.println(sql);

View File

@@ -6,7 +6,7 @@ public class TLWMatchesUpdaterFootballTest {
@Test
public void getUpdateSqlTest1() {
TLWMatchesUpdaterFootball updater = new TLWMatchesUpdaterFootball(2021, 1, "Tippliga.json");
TLWMatchesUpdaterFootball updater = new TLWMatchesUpdaterFootball(2021, 1, "Tippliga");
String sql = updater.getUpdateSQL();
// System.out.println(sql);
@@ -15,7 +15,7 @@ public class TLWMatchesUpdaterFootballTest {
@Test
public void getUpdateSqlTest2() {
TLWMatchesUpdaterFootball updater = new TLWMatchesUpdaterFootball(2021, 2, "Tippliga.json");
TLWMatchesUpdaterFootball updater = new TLWMatchesUpdaterFootball(2021, 2, "Tippliga");
String sql = updater.getUpdateSQL();
// System.out.println(sql);
@@ -24,7 +24,7 @@ public class TLWMatchesUpdaterFootballTest {
@Test
public void getUpdateSqlTest48() {
TLWMatchesUpdaterFootball updater = new TLWMatchesUpdaterFootball(2021, 48, "WTL_Pokal.json");
TLWMatchesUpdaterFootball updater = new TLWMatchesUpdaterFootball(2021, 48, "WTL-Pokal");
String sql = updater.getUpdateSQL();
// System.out.println(sql);

View File

@@ -10,7 +10,7 @@ import static org.junit.Assert.assertEquals;
public class TLWTeamsCreatorTest {
@Test
public void getTeamsTippligaFootball1Test() {
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(2021, 1, "Tippliga.json");
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(2021, 1, "Tippliga");
ArrayList<TLWMatch> matches = matchesCreator.getMatches();
TLWTeamsCreator teamCreator = new TLWTeamsCreator(2021, 1, matches);
@@ -20,9 +20,9 @@ public class TLWTeamsCreatorTest {
@Test
public void getTeamsTipper1TLTest() throws ParseException {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga.json");
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga");
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 51, "1TL_Tipper.json", matchdaysCreator.getMatchdays());
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 51, "1. Tippliga Tipper", matchdaysCreator.getMatchdays());
ArrayList<TLWMatch> matches = creator.getMatches();
@@ -33,9 +33,9 @@ public class TLWTeamsCreatorTest {
@Test
public void getTeamsTipper2TLTest() throws ParseException {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga.json");
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga");
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 52, "2TL_Tipper.json", matchdaysCreator.getMatchdays());
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 52, "2. Tippliga Tipper", matchdaysCreator.getMatchdays());
ArrayList<TLWMatch> matches = creator.getMatches();
@@ -46,9 +46,9 @@ public class TLWTeamsCreatorTest {
@Test
public void getTeamsTipperWTLTest() throws ParseException {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL_Pokal.json");
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL-Pokal");
TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(2021, 98, "WTL_Tipper.json", matchdaysCreator.getMatchdays());
TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(2021, 98, "WTL-Pokal Tipper", matchdaysCreator.getMatchdays());
ArrayList<TLWMatch> matches = creator.getMatches();

View File

@@ -6,21 +6,21 @@ public class TLWTeamsUpdaterTest {
@Test
public void getInsertSQLTest1() throws Exception {
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(2021, 1, "Tippliga.json");
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(2021, 1, "Tippliga");
String sql = teamsUpdater.getInsertSQL();
// System.out.println(sql);
}
@Test
public void getInsertSQLTest2() throws Exception {
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(2021, 2, "Tippliga.json");
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(2021, 2, "Tippliga");
String sql = teamsUpdater.getInsertSQL();
// System.out.println(sql);
}
@Test
public void getInsertSQLTest48() throws Exception {
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(2021, 48, "WTL_Pokal.json");
TLWTeamsUpdater teamsUpdater = new TLWTeamsUpdater(2021, 48, "WTL-Pokal");
String sql = teamsUpdater.getInsertSQL();
// System.out.println(sql);
}

View File

@@ -0,0 +1,14 @@
package de.jeyp91.tippliga;
import de.jeyp91.tippligaforum.TippligaConfigProvider;
import org.json.simple.JSONObject;
import org.junit.Test;
public class TippligaConfigProviderTest {
@Test
public void getTippligaConfigTest() {
TippligaConfigProvider prov = new TippligaConfigProvider(2021);
JSONObject config = prov.getTippligaConfig("Tippliga");
}
}

View File

@@ -1,5 +1,6 @@
package de.jeyp91.tippliga;
import de.jeyp91.tippligaforum.TippligaSQLConnector;
import org.junit.Before;
import org.junit.Test;
@@ -9,16 +10,16 @@ import static org.junit.Assert.assertEquals;
public class TippligaSQLConnectorTest {
TippligaSQLConnector tl;
TippligaSQLConnector con;
@Before
public void setup() {
tl = new TippligaSQLConnector();
con = TippligaSQLConnector.getInstance();
}
@Test
public void getTeamsBySeasonAndLeagueTest() {
ArrayList<TLWTeam> teams = tl.getTeams("2020", "1");
ArrayList<TLWTeam> teams = con.getTeams("2020", "1");
assertEquals(84, teams.size());
@@ -34,7 +35,7 @@ public class TippligaSQLConnectorTest {
@Test
public void getTeamsByIdTest() {
ArrayList<TLWTeam> teams = tl.getTeams("1");
ArrayList<TLWTeam> teams = con.getTeams("1");
assertEquals(2021, teams.get(0).getSeason());
assertEquals(1, teams.get(0).getLeague());
@@ -48,7 +49,7 @@ public class TippligaSQLConnectorTest {
@Test
public void getMatchesBySeasonAndLeague() {
ArrayList<TLWMatch> matches = tl.getMatches("2020", "1");
ArrayList<TLWMatch> matches = con.getMatches("2020", "1");
assertEquals(468, matches.size());
@@ -63,4 +64,38 @@ public class TippligaSQLConnectorTest {
assertEquals((Integer) 2, matches.get(0).getGoalsHome());
assertEquals((Integer) 1, matches.get(0).getGoalsGuest());
}
@Test
public void replaceXmlMetacharactersTest() {
String post = "[code]\n" +
"{\"a\"}\n" +
"[/code]";
String replacement = con.replaceXmlMetacharacters(post);
System.out.println(replacement);
}
@Test
public void getChecksumTest() {
String post = "[code]\n" +
"{\"a\"}\n" +
"[/code]";
String md5 = con.getChecksum(post);
System.out.println(md5);
}
@Test
public void getPostUpdateQueryTest() {
int postId = 582;
String postText = "[code]\n" +
"{\"a\"}\n" +
"[/code]";
String postTextClean = con.replaceXmlMetacharacters(postText);
String postChecksum = con.getChecksum(postText);
long postEditTime = 1604691314;
String postEditReason = "Update by tool.";
int postEditUser = 2;
String query = con.getPostUpdateQuery(postId, postTextClean, postChecksum, postEditTime, postEditReason, postEditUser);
System.out.println(query);
}
}

View File

@@ -1,5 +1,6 @@
package de.jeyp91.gists;
package de.jeyp91.tippligaforum;
import de.jeyp91.tippligaforum.MatchesListCreator;
import org.junit.Test;
public class MatchesListCreatorTest {
@@ -7,35 +8,35 @@ public class MatchesListCreatorTest {
@Test
public void getMatchesTest2664() {
MatchesListCreator creator = new MatchesListCreator(2664);
String matches = creator.getMatchesBeautful();
// System.out.println(matches);
String matches = creator.getMatchesBeautiful();
System.out.println(matches);
}
@Test
public void getMatchesTest2743() {
MatchesListCreator creator = new MatchesListCreator(2743);
String matches = creator.getMatchesBeautful();
String matches = creator.getMatchesBeautiful();
// System.out.println(matches);
}
@Test
public void getMatchesTest2755() {
MatchesListCreator creator = new MatchesListCreator(2755);
String matches = creator.getMatchesBeautful();
String matches = creator.getMatchesBeautiful();
// System.out.println(matches);
}
@Test
public void getMatchesTest2790() {
MatchesListCreator creator = new MatchesListCreator(2790);
String matches = creator.getMatchesBeautful();
String matches = creator.getMatchesBeautiful();
// System.out.println(matches);
}
@Test
public void getMatchesTest2795() {
MatchesListCreator creator = new MatchesListCreator(2795);
String matches = creator.getMatchesBeautful();
String matches = creator.getMatchesBeautiful();
// System.out.println(matches);
}
}

View File

@@ -0,0 +1,21 @@
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();
}
@Test
public void updateLeagueTest() {
MatchesListForumUpdater updater = new MatchesListForumUpdater();
updater.updateLeague(2755);
}
}