Skip to content

Commit

Permalink
close #4 Use cache on SQL PlayerRaceRepository
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent committed Jan 12, 2018
1 parent e000007 commit 316bab5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import fr.quatrevieux.araknemu.core.di.ContainerConfigurator;
import fr.quatrevieux.araknemu.core.di.ContainerModule;
import fr.quatrevieux.araknemu.data.transformer.ImmutableCharacteristicsTransformer;
import fr.quatrevieux.araknemu.data.world.repository.implementation.local.PlayerRaceRepositoryCache;
import fr.quatrevieux.araknemu.data.world.transformer.MapCellTransformer;

/**
Expand All @@ -20,9 +21,11 @@ public WorldRepositoriesModule(ConnectionPool connection) {
public void configure(ContainerConfigurator configurator) {
configurator.persist(
fr.quatrevieux.araknemu.data.world.repository.character.PlayerRaceRepository.class,
container -> new PlayerRaceRepository(
connection,
container.get(ImmutableCharacteristicsTransformer.class)
container -> new PlayerRaceRepositoryCache(
new PlayerRaceRepository(
connection,
container.get(ImmutableCharacteristicsTransformer.class)
)
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import fr.quatrevieux.araknemu.core.di.Container;
import fr.quatrevieux.araknemu.core.di.ContainerException;
import fr.quatrevieux.araknemu.core.di.ItemPoolContainer;
import fr.quatrevieux.araknemu.data.world.repository.implementation.local.PlayerRaceRepositoryCache;
import fr.quatrevieux.araknemu.game.GameBaseCase;
import org.junit.jupiter.api.Test;

Expand All @@ -19,7 +20,7 @@ void instances() throws SQLException, ContainerException {
app.database().get("game")
));

assertInstanceOf(PlayerRaceRepository.class, container.get(fr.quatrevieux.araknemu.data.world.repository.character.PlayerRaceRepository.class));
assertInstanceOf(PlayerRaceRepositoryCache.class, container.get(fr.quatrevieux.araknemu.data.world.repository.character.PlayerRaceRepository.class));
assertInstanceOf(MapTemplateRepository.class, container.get(fr.quatrevieux.araknemu.data.world.repository.environment.MapTemplateRepository.class));
}

Expand Down

0 comments on commit 316bab5

Please sign in to comment.