I think there is a misunderstanding on what I have meant by DI in this case.
OSGi addresses runtime wiring of components. What I mean by DI here is its application as a design pattern[1]. This is not about unit testing the DAO itself. Its about unit testing other components that use the DAO. You dont need any frameworks for doing DI actually because its a design pattern. We are currently doing it by hand. A framework would just make it slightly easier to manage but its not essential. If we are serious about testing we need to take DI into consideration when designing our classes. [1] http://martinfowler.com/articles/dipInTheWild.html On 1 November 2016 at 18:42, Ruwan Abeykoon <[email protected]> wrote: > Hi All, > If this is about unit testing on DAO, we are also experimenting with > simple JDBC approach[1]. No Dependency Injection. > We could test the DAO, the SQL correctness etc. because there is no Mock > objects. > > I am not in favor of DI on developing a platform as we have no control > over which get wired at the runtime. OSGI is already a kind of "dependency > injection" and we have more than enough issues with that. > > [1] https://github.com/wso2/carbon-identity-providers/ > blob/master/components/identity-provider/org.wso2. > carbon.identity.provider/src/test/java/org/wso2/carbon/ > identity/provider/dao/IdentityProviderDAOTest.java > > Cheers, > Ruwan > > > On Tue, Nov 1, 2016 at 4:10 PM, Manuranga Perera <[email protected]> wrote: > >> I like Guice as well, but since we already have OSGi, (if we do have >> OSGi) shouldn't we leverage that ? >> >> On Tue, Nov 1, 2016 at 5:37 AM, Uvindra Dias Jayasinha <[email protected]> >> wrote: >> >>> >>> >>>> Spring too supports dependency injection (since its first release in >>>> early 2000s), anyone knows the differences between Spring and Guice? >>>> >>>> >>>> I checked up on this, mainly Spring was the alternative to the bloated >>> JavaEE. So its a fully featured framework with lots of stuff including the >>> ability to do dependency injection. >>> >>> Guice is a light weight library that only focuses on DI. So if you want >>> just DI, Guice is nice and simple as opposed to a heavier framework like >>> Spring that has a lot more in it. >>> >>> -- >>> Regards, >>> Uvindra >>> >>> Mobile: 777733962 >>> >>> _______________________________________________ >>> Architecture mailing list >>> [email protected] >>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >>> >>> >> >> >> -- >> With regards, >> *Manu*ranga Perera. >> >> phone : 071 7 70 20 50 >> mail : [email protected] >> >> _______________________________________________ >> Architecture mailing list >> [email protected] >> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >> >> > > > > _______________________________________________ > Architecture mailing list > [email protected] > https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture > > -- Regards, Uvindra Mobile: 777733962
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
