@BMUnitConfig
starksm64 Jan 18, 2011 4:25 PMHello,
I just started playing around with byteman today after seeing the new bmunit contribution, and jumped into testing some things using that. One thing I immeaditely wanted was to configure some of the byteman Installer system properties from an annotation on the unit test class rather than having to set this up inside of the ide junit configuration. Properties like:
org.jboss.byteman.contrib.bmunit.script.directory
org.jboss.byteman.contrib.bmunit.agent.port
org.jboss.byteman.contrib.bmunit.agent.host
org.jboss.byteman.contrib.bmunit.verbose
org.jboss.byteman.verbose
org.jboss.byteman.debug
org.jboss.byteman.home
were those that first came to mind as I needed to search the code to see what things I could set to debug what was going on with bmunit/byteman itself. Something like the following class level annotation that would be used in the BMUnit class when it calls to the Installer:
/* * JBoss, Home of Professional Open Source * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors * as indicated by the @authors tag. All rights reserved. * See the copyright.txt in the distribution for a * full listing of individual contributors. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU Lesser General Public License, v. 2.1. * This program is distributed in the hope that it will be useful, but WITHOUT A * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License, * v.2.1 along with this distribution; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ package org.jboss.byteman.contrib.bmunit; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Unit test level configuration of byteman properties * * @author Scott stark (sstark@redhat.com) (C) 2010 Red Hat Inc. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) public @interface BMUnitConfig { /** * org.jboss.byteman.home * System property used to idenitfy the location of the installed byteman release. */ String bytemanHome() default ""; /** * org.jboss.byteman.contrib.bmunit.script.directory * property which identifies the directory from which to start searching * for rule script. If unset the current working directory of the test is used. */ String scriptDirectory() default ""; /** * org.jboss.byteman.contrib.bmunit.agent.port ... */ int agentPort() default -1; /** * org.jboss.byteman.contrib.bmunit.agent.host */ String agentHost() default ""; /** * org.jboss.byteman.contrib.bmunit.verbose */ boolean isBmunitVerbose() default false; /** * org.jboss.byteman.verbose */ boolean isBytemanVerbose() default false; /** * org.jboss.byteman.debug */ boolean isBytemanDebug() default false; }
If that sounds like a good idea, I'll create an issue and attach a patch to it for these changes.