reloading cached bean

17 views
Skip to first unread message

dustin.c

unread,
Jun 22, 2010, 3:57:25 PM6/22/10
to ColdSpring-Users
I am using ColdSpring to get beans in my MXUnit tests. I am using
MXUnit's injectMethod() in some of my tests which I believe persists
in the CS's cache and rolls down to following tests. Is there a way
to delete one bean from the cache or reload it?

Hem Talreja

unread,
Jun 22, 2010, 4:24:19 PM6/22/10
to coldspri...@googlegroups.com
Dustin,

You could use the singleton property of the bean to request mxunit to recreate the bean for each test.

-Hem


--
You received this message because you are subscribed to the Google Groups "ColdSpring-Users" group.
To post to this group, send email to coldspri...@googlegroups.com.
To unsubscribe from this group, send email to coldspring-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/coldspring-users?hl=en.


Brian Kotek

unread,
Jun 22, 2010, 4:30:20 PM6/22/10
to coldspri...@googlegroups.com
No, you can't recreate just one bean, because that would mean traversing its entire dependency graph and recreating anything that depends on that bean, and anything that depends on those, etc. You'll want to reinitialize ColdSpring for each test case (which you probably should be doing anyway, to maintain the integrity of each test).

HTH,

Brian


dustin.c

unread,
Jun 23, 2010, 2:47:34 PM6/23/10
to ColdSpring-Users
Oh those are both good suggestions. I had not thought about
reinitializing after each test and the cfc's general integrity after
any test. It does take some time to refresh this and will add a lot
of time to my unit tests. I suppose there is not really a way around
it though.

On Jun 22, 1:30 pm, Brian Kotek <brian...@gmail.com> wrote:
> No, you can't recreate just one bean, because that would mean traversing its
> entire dependency graph and recreating anything that depends on that bean,
> and anything that depends on those, etc. You'll want to reinitialize
> ColdSpring for each test case (which you probably should be doing anyway, to
> maintain the integrity of each test).
>
> HTH,
>
> Brian
>
> On Tue, Jun 22, 2010 at 3:57 PM, dustin.c <dustin.chester...@gmail.com>wrote:
>
> > I am using ColdSpring to get beans in my MXUnit tests.  I am using
> > MXUnit's injectMethod() in some of my tests which I believe persists
> > in the CS's cache and rolls down to following tests.  Is there a way
> > to delete one bean from the cache or reload it?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "ColdSpring-Users" group.
> > To post to this group, send email to coldspri...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > coldspring-use...@googlegroups.com<coldspring-users%2Bunsu...@googlegroups.com>
> > .

Brian Kotek

unread,
Jun 23, 2010, 3:01:10 PM6/23/10
to coldspri...@googlegroups.com
Why does it take a long time to refresh it after each test? Are you creating a lot of beans that don't have anything to do with that particular test case?

Another option would be to reinitialize ColdSpring only at the end of the tests that do the inject method, to minimize the number of times it is recreated.

To unsubscribe from this group, send email to coldspring-use...@googlegroups.com.

dustin.c

unread,
Jun 24, 2010, 3:50:48 PM6/24/10
to ColdSpring-Users
Well that's a whole other problem that we have not been able to
address yet, but some of the core beans that are widely used parse
these huge config XML files that are used throughout the application.
Fixing that methodology would be ideal but it's some serious legacy
stuff and we can't tackle it yet. I think I might just reload for
ones that use injectMethod() for now and hopefully we can fix our
initialization issues sooner rather than later.

Thanks for all the suggestions!

On Jun 23, 12:01 pm, Brian Kotek <brian...@gmail.com> wrote:
> Why does it take a long time to refresh it after each test? Are you creating
> a lot of beans that don't have anything to do with that particular test
> case?
>
> Another option would be to reinitialize ColdSpring only at the end of the
> tests that do the inject method, to minimize the number of times it is
> recreated.
>
> > <coldspring-users%2Bunsu...@googlegroups.com<coldspring-users%252Buns...@googlegroups.com>
Reply all
Reply to author
Forward
0 new messages