Hello everyone, I've spend some time thinking about how to make it easier to test Freenet's different subsystems, especially without having to instantiate the whole Freenet Node class for almost every test. One possibly helpful idea that came to my mind is to decouple classes by using a publish-subscribe mechanism, where each instance can subscribe to events (e.g. received a new announcement request) and publish other events together with corresponding data (e.g. the message and the neighbor node where the request came from). This way, many subsystems could then trigger methods in other subsystems without having to know them directly and also might not need a reference to the Node class anymore, making them much easier to test.
I've integrated some examples within the NodeDispatcher-class and pushed it into my Github repository [1]. Due to its rather high level of abstraction, the publish-subscribe mechanism handles all attached data just as objects, which is not nice regarding type safety. However, I haven't yet found a better solution since I don't have much experience with Java and I first want to hear your opinion about this approach. Martin [1] https://github.com/yadevel/fred/commit/f4ce1b066ad673b995ea2a729ba21b2a7e932e5b _______________________________________________ Devl mailing list [email protected] https://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
