A proposition for an hexagonal architecture implementation#29
A proposition for an hexagonal architecture implementation#29aminx4 wants to merge 2 commits intoswcraftlyon:masterfrom
Conversation
…agerEvent service and MangoDB persistance
|
Ce qui aurait été pas mal, ça aurait été d'aller un cran plus loin et de faire un module gradle par adapter, donc un pour l'adapter MongoDB, un pour la partie métier. L'intérêt de cette solution, c'est de mieux gérer les classes et dépendances. La module mongo dépends du module domain (et pas inversement). Les repositories sont déclarés dans la partie domain et leur implémentation dans la partie mongo. Impossible alors d'utiliser des dépendances mongo dans le module domain. |
|
|
||
| apply plugin: 'java' | ||
|
|
||
| sourceCompatibility = 1.8 |
There was a problem hiding this comment.
pourquoi avoir enlevé cette ligne ?
There was a problem hiding this comment.
J'ai enlevé car mon IDE m'a indiqué que la variable en question n'était pas utilisé
|
Globalement :
|
| public class MangoEventDao implements IEventDAO { | ||
|
|
||
| public static final String EVENT_DB = "EventDB"; | ||
| public static final String MONGODB_LOCALHOST_27017 = "mongodb://localhost:27017"; |
There was a problem hiding this comment.
mauvais nommage de la constante
There was a problem hiding this comment.
Écrit en dur car il n ya pas de fichier de conf pour l'instant.
Tu proposes quoi comme nommage ?
There was a problem hiding this comment.
when you will have a conf file you probably won't expose it to you application anyway, I'll abstract it into a config class. So you can put your hardcoded url into a config class right now, it will be easy to evolve configuration system later.
There was a problem hiding this comment.
You mean that i create a ApplicationConfig.java that contains constants of my mongodb server parameters ? then i call this class in my dao ? i will create a dependency between my DAO and my ApplicationConfig ? Do you have any suggestions please ?
There was a problem hiding this comment.
You got the idea I guess. If ApplicationConfig is too broad a dependency, you can have a MongoConfig.
|
First of all, it seems that people are shy and then they didn't congratulate you @aminx4. Thank you for your PR and for moving this thing forward. |
|
Thank you. I will try. But i think that i need more details to do it perfectly. Thank's for your help. |
|
|
||
| @Test | ||
| public void shouldPersistInDataBase() throws Exception { | ||
| MongoDatabase mongoDatabase = MangoEventDao.getDataBase(); |
There was a problem hiding this comment.
You don't really test anything related to MongoEventDao, do you ?
There was a problem hiding this comment.
Oupps !! Sorry ! i test that i can insert something in db but not MongoEventDao. i will do it.
PlannerRepository.java : Delete the index id append PlannerRepository.java : rename persist to save PlannerRepository.java : delete empty lignes FacebookAdapter.java : Delete the class MongoConfiguration.java : Create a mongoConfiguration class for externelize database parameters MongoEventDao.java : change the signature of the constructor to get a MongoDatabase MongoEventDao.java : Delete empty lines MongoLauncher.java : create a MongoLuancher class EventDAO.java : rename an EventDAO from IEventDAO EventDAO.java : rename persist to save add find and findByKey methods Delete ApplicationConfig.java EventManagerTest.java : Delete static import of AssertJ and remplace it with Junit Asset Create FongoLauncher for portable mongodb PlannerRepositoryTest : rename method test Add FakeMongo dependency and changing naming format
Proposition for an hexagonal architecture implementation with a managerEvent service and MongoDB persistence.