geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <d...@coredevelopers.net>
Subject Re: Questions about GBeanMBeanAttribute tests
Date Mon, 01 Mar 2004 17:47:02 GMT
On Mar 1, 2004, at 9:38 AM, Jacek Laskowski wrote:

> Hey,
>
> I'm trying to crack it down and keep failing :( I can't figure out how 
> to get at GBeanMBeanAttribute once GBean is registered to Kernel.
>
> Here's a snippet I'm working on:
>
>   // create a MBean of GBean
>   GBeanMBean gbean = new GBeanMBean(MockGBean.getGBeanInfo());
>   // assign a value to an attribute of the GBean
>   gbean.setAttribute(attributeName, attributeValue);
>   // load the GBean
>   kernel.loadGBean(objectName, gbean);
>   // start it up
>   kernel.startGBean(objectName);
>
> At that point I can't access the GBean attributes other than via 
> Kernel accessors (setter and getter) or directly via MBeanServer ones, 
> which actually do nothing more than return or set an attribute's 
> value.
>
> I'd like to retrieve instances of GBeanMBeanAttribute and test it out.
>
> Is the only approach to test the class to conduct it indirectly via 
> Kernel or MBeanServer?

I see I have done my job correctly :)

You're not never supposed to be able to have access to a 
GBeanMBeanAttribute instance directly.  It is an abstraction internal 
to the GBeanMBean implementation.  The only way to perform an 
integration test should be through the public interface on GBeanMBean.

-dain


Mime
View raw message