|
| 1 | +package com.arangodb.springframework.testdata.chess; |
| 2 | + |
| 3 | +import com.arangodb.springframework.AbstractArangoTest; |
| 4 | +import com.arangodb.springframework.core.ArangoOperations; |
| 5 | +import com.arangodb.springframework.testdata.chess.entity.Player; |
| 6 | +import com.arangodb.springframework.testdata.chess.entity.Score; |
| 7 | +import com.arangodb.springframework.testdata.chess.entity.Tournament; |
| 8 | +import org.junit.jupiter.api.BeforeEach; |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; |
| 10 | +import org.springframework.data.geo.Point; |
| 11 | + |
| 12 | +import java.time.LocalDate; |
| 13 | +import java.util.List; |
| 14 | + |
| 15 | +abstract class AbstractRepositoryTest extends AbstractArangoTest { |
| 16 | + |
| 17 | + @Autowired |
| 18 | + private ArangoOperations ops; |
| 19 | + |
| 20 | + protected List<Player> players = List.of( |
| 21 | + new Player("Magnus Carlsen", 2830, "Norway"), |
| 22 | + new Player("Fabiano Caruana", 2803, "US"), |
| 23 | + new Player("Maxime Vachier-Lagrave", 2732, "France"), |
| 24 | + new Player("Hikaru Nakamura", 2789, "US"), |
| 25 | + new Player("Ding Liren", 2762, "China"), |
| 26 | + new Player("Wesley So", 2757, "US"), |
| 27 | + new Player("Alireza Firouzja", 2760, "France"), |
| 28 | + new Player("Anish Giri", 2745, "Netherlands"), |
| 29 | + new Player("Ian Nepomniachtchi", 2758, "Russia") |
| 30 | + ); |
| 31 | + |
| 32 | + protected List<Tournament> tournaments = List.of( |
| 33 | + new Tournament( |
| 34 | + "Tata Steel 2023", |
| 35 | + LocalDate.of(2023, 1, 13), |
| 36 | + "Wijk aan Zee", |
| 37 | + new Point(4.6, 52.5) |
| 38 | + ), |
| 39 | + new Tournament( |
| 40 | + "World Chess Championship 2023", |
| 41 | + LocalDate.of(2023, 4, 9), |
| 42 | + "Astana", |
| 43 | + new Point(71.422222, 51.147222) |
| 44 | + ), |
| 45 | + new Tournament( |
| 46 | + "Norway Chess 2023", |
| 47 | + LocalDate.of(2023, 5, 30), |
| 48 | + "Stavanger", |
| 49 | + new Point(5.731389, 58.97) |
| 50 | + ) |
| 51 | + ); |
| 52 | + |
| 53 | + protected List<Score> scores = List.of( |
| 54 | + new Score(players.get(7), tournaments.get(0), 1), |
| 55 | + new Score(players.get(0), tournaments.get(0), 3), |
| 56 | + new Score(players.get(5), tournaments.get(0), 4), |
| 57 | + new Score(players.get(1), tournaments.get(0), 5), |
| 58 | + new Score(players.get(4), tournaments.get(1), 1), |
| 59 | + new Score(players.get(8), tournaments.get(1), 2), |
| 60 | + new Score(players.get(3), tournaments.get(1), 4), |
| 61 | + new Score(players.get(1), tournaments.get(1), 5), |
| 62 | + new Score(players.get(6), tournaments.get(1), 6), |
| 63 | + new Score(players.get(3), tournaments.get(2), 1), |
| 64 | + new Score(players.get(1), tournaments.get(2), 2), |
| 65 | + new Score(players.get(7), tournaments.get(2), 4), |
| 66 | + new Score(players.get(5), tournaments.get(2), 5), |
| 67 | + new Score(players.get(0), tournaments.get(2), 6) |
| 68 | + ); |
| 69 | + |
| 70 | + protected AbstractRepositoryTest() { |
| 71 | + super(Player.class, Score.class, Tournament.class); |
| 72 | + } |
| 73 | + |
| 74 | + @BeforeEach |
| 75 | + void importData() { |
| 76 | + ops.insertAll(players, Player.class); |
| 77 | + ops.insertAll(tournaments, Tournament.class); |
| 78 | + ops.insertAll(scores, Score.class); |
| 79 | + } |
| 80 | + |
| 81 | +} |
0 commit comments