Return-Path: X-Original-To: apmail-jakarta-dev-archive@minotaur.apache.org Delivered-To: apmail-jakarta-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9A0EB7CF7 for ; Wed, 9 Nov 2011 08:23:04 +0000 (UTC) Received: (qmail 59175 invoked by uid 500); 9 Nov 2011 08:23:04 -0000 Delivered-To: apmail-jakarta-dev-archive@jakarta.apache.org Received: (qmail 59021 invoked by uid 500); 9 Nov 2011 08:23:01 -0000 Mailing-List: contact dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jakarta.apache.org Delivered-To: mailing list dev@jakarta.apache.org Received: (qmail 59013 invoked by uid 99); 9 Nov 2011 08:23:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2011 08:23:00 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of stephane.hoblingre@gmail.com designates 74.125.82.172 as permitted sender) Received: from [74.125.82.172] (HELO mail-wy0-f172.google.com) (74.125.82.172) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2011 08:22:55 +0000 Received: by wyg30 with SMTP id 30so1583625wyg.31 for ; Wed, 09 Nov 2011 00:22:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=TEHveheP6kp4tdmgHxcbWuCDTDOZ0yIBUhNWkNFNpH0=; b=f1anwfCQPYzDKk9vK3vRzOMyAdWQbNEAhu57QUwM7JPSeW0ij99ZuVtwsia886hbpi U5fYghfNra8QINe9KNGsTDISXQsXUr3HpJCxCF+qe04A7H8KhkfWNeMQo6quRaItLHAu 4Pf1ZacLpHzShmN3MtJ4kmTas3v8QnrGKGm5A= MIME-Version: 1.0 Received: by 10.180.75.204 with SMTP id e12mr1384857wiw.61.1320826953934; Wed, 09 Nov 2011 00:22:33 -0800 (PST) Received: by 10.180.81.197 with HTTP; Wed, 9 Nov 2011 00:22:33 -0800 (PST) In-Reply-To: References: Date: Wed, 9 Nov 2011 13:52:33 +0530 Message-ID: Subject: Re: [JMeter] evolution request - handle BeanDescriptor.hidden flag in JMeter From: =?ISO-8859-1?Q?St=E9phane_Hoblingre?= To: dev@jakarta.apache.org Cc: Andrey Pohilko Content-Type: multipart/alternative; boundary=f46d043895676628e304b148fdb6 --f46d043895676628e304b148fdb6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi again, In addition to this, could it be possible to add this method in org.apache.jmeter.util.NameUpdater.java : public static Object setProperty(String key, String value) { return nameMap.setProperty(String key, String value); } This would allow plugins to add their own translation rules, without having to modify the properties file. Thanks and Regards, Stef 2011/11/9 St=E9phane Hoblingre > Thank you Sebb for your quick response! > > I know about not_in_menu configuration, but we would like to avoid JMeter > users to edit propertie file from JMeter to install the plugins. So this = is > why we would like to do it from the plugin code itself. I did the > modification in MenuFactory.java from trunk (r1199633), please find > attached the patch / file. > > The modification is very light (in bold): > > if (name.endsWith("JMeterTreeNode") // $NON-NLS-1$ > || name.endsWith("TestBeanGUI")) {// $NON-NLS-1$ > continue;// Don't try to instantiate these > } > > *>//Handle BeanDescriptor hidden property > >boolean isHiddenBean =3D false;* > > JMeterGUIComponent item; > try { > Class c =3D Class.forName(name); > if (TestBean.class.isAssignableFrom(c)) { > item =3D new TestBeanGUI(c); > *> try { > > isHiddenBean =3D > Introspector.getBeanInfo(c).getBeanDescriptor().isHidden(); > > } catch (IntrospectionException e) { > > log.warn("Cannot get bean info from class " + name + "."); > > }* > > } else { > item =3D (JMeterGUIComponent) c.newInstance(); > } > } catch (NoClassDefFoundError e) { > log.warn("Missing jar? Could not create " + name + ". " + e); > continue; > } catch (Throwable e) { > log.warn("Could not instantiate " + name, e); > if (e instanceof Error){ > throw (Error) e; > } > if (e instanceof RuntimeException){ > throw (RuntimeException) e; > } > continue; > } > *>* if (elementsToSkip.contains(name) || > elementsToSkip.contains(item.getStaticLabel()) *|| isHiddenBean*) { > log.info("Skipping " + name); > continue; > } > > Could this be added in the next version of JMeter? > > Thanks, > > Stef > > > On Wed, Nov 9, 2011 at 12:06 AM, sebb wrote: > >> 2011/11/8 St=E9phane Hoblingre : >> > Dear JMeter dev team, >> > >> > I have an evolution request for JMeter which will help plugin >> developers. >> > In our plugins, we implemented one component using TestBeans. We have >> now >> > rewrote this component and use regular test elements, so we need to hi= de >> > the previous one from jmeter add menus (backward jmx compatibility). T= he >> > only way I found is very dirty, that is setting its name to null. But = in >> >> You can also edit the JMeter property: >> >> not_in_menu >> >> see jmeter.properties. >> >> You might also be able to make use of upgrade.properties and dispense >> with the old class altogether. >> >> > BeanDescriptor class, there is one attribute: >> > >> > isHidden >> > public boolean isHidden() >> > The "hidden" flag is used to identify features that are intended on= ly >> > for tool use, and which should not be exposed to humans. >> > >> > While building the add component menu, could you check the hidden flag >> and >> > if true not add it in the menu? That would allow to plugin developers = to >> > hide properly it. >> > >> > Is it possible? Do you want me to open a bug for it? >> >> If it can be done without affecting the existing API, then I suppose >> it would be possible to interpret the isHidden() status as meaning >> that the TestBean is not added to the display. >> >> If you provide a patch as a Bugzilla enhancement we will take a look. >> >> > Thanks, >> > >> > Stef >> > JMeter Plugins - http://code.google.com/p/jmeter-plugins >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscribe@jakarta.apache.org >> For additional commands, e-mail: dev-help@jakarta.apache.org >> >> > --f46d043895676628e304b148fdb6--