public class Instrumentor extends Object
Constructor | Description |
---|---|
Instrumentor() |
|
Instrumentor(String address,
int port) |
|
Instrumentor(String address,
int port,
int rmiPort) |
|
Instrumentor(Submit submit,
int rmiRegistryPort) |
Modifier and Type | Method | Description |
---|---|---|
void |
crashAtMethod(String className,
String methodName,
String atInjection) |
Inject a Rule to kill the target JVM at a given point within the specified Class.method()
|
void |
crashAtMethodEntry(Class clazz,
String methodName) |
Inject a Rule to kill the target JVM upon entry to the specified Class.method()
|
void |
crashAtMethodEntry(String className,
String methodName) |
Inject a Rule to kill the target JVM upon entry to the specified Class.method()
|
void |
crashAtMethodExit(Class clazz,
String methodName) |
Inject a Rule to kill the target JVM upon exit of the specified Class.method()
|
void |
crashAtMethodExit(String className,
String methodName) |
Inject a Rule to kill the target JVM upon exit of the specified Class.method()
|
Class<?> |
getHelperClass() |
Returns a helper class which this
Instrumentor instance defines
as parameter of HELPER clause. |
File |
getRedirectedSubmissionsFile() |
Returns the file to which Rule submission is currently redirected
|
void |
injectFault(Class clazz,
String methodName,
Class<? extends Throwable> fault,
Object[] faultArgs) |
Inject a fault (i.e.
|
void |
injectOnCall(Class clazz,
String methodName,
String action) |
Inject an action to take place upon the invocation of the specified class.method
|
void |
injectOnCall(String className,
String methodName,
String action) |
Inject an action to take place upon the invocation of the specified class.method
|
void |
injectOnExit(Class clazz,
String methodName,
String action) |
Inject an action to take place upon exit of the specified class.method
|
void |
injectOnExit(String className,
String methodName,
String action) |
Inject an action to take place upon exit of the specified class.method
|
void |
injectOnMethod(Class clazz,
String methodName,
String condition,
String action,
String atInjection) |
Inject an action to take place at a given point within the specified class.method
|
void |
injectOnMethod(String className,
String methodName,
String condition,
String action,
String atInjection) |
Inject an action to take place at a given point within the specified class.method
|
void |
injectOnMethodWhere(Class clazz,
String methodName,
String condition,
String action,
String where) |
Inject an action to take place at a given point within the specified class.method
|
void |
injectOnMethodWhere(String className,
String methodName,
String condition,
String action,
String where) |
Inject an action to take place at a given point within the specified class.method
|
void |
installHelperJar(String path) |
Add the specified jar to the remote app's system classpath.
|
String |
installRule(RuleConstructor builder) |
Installing rule based on definition available by building
RuleConstructor . |
void |
installScript(String scriptName,
String scriptString) |
Pass the assembled script to the remote JVM, either via.
|
InstrumentedClass |
instrumentClass(Class clazz) |
Add method tracing rules to the specified class.
|
InstrumentedClass |
instrumentClass(Class clazz,
String... methodNames) |
|
InstrumentedClass |
instrumentClass(Class clazz,
Set<String> methodNames) |
Add method tracing rules to the specified class.
|
InstrumentedClass |
instrumentClass(String className,
String... methodNames) |
|
InstrumentedClass |
instrumentClass(String className,
Set<String> methodNames) |
Add method tracing rules to the specified class name.
If a null set of method names is supplied, NullPointerException is thrown. |
void |
removeAllInstrumentation() |
Flush any instrumentation for the given class in the remote system and clean up the local cache.
|
void |
removeLocalState() |
Flush the local cache of scripts and proxies to remote instrumented classes.
|
void |
removeRule(RuleConstructor builder) |
Removing particular script installed as a rule by
RuleConstructor . |
void |
removeScript(String scriptName) |
Removing particular script from the remote byteman agent.
|
void |
setHelperClass(Class<?> helperClass) |
Redefine a helper class which is used as parameter of
HELPER clause
by this instance of Instrumentor |
void |
setRedirectedSubmissionsFile(File redirectedSubmissionsFile) |
Sets the file to which Rule submissions should be redirected.
|
public Instrumentor(Submit submit, int rmiRegistryPort) throws RemoteException
RemoteException
public Instrumentor() throws RemoteException
RemoteException
public Instrumentor(String address, int port) throws RemoteException
RemoteException
public Instrumentor(String address, int port, int rmiPort) throws RemoteException
RemoteException
public File getRedirectedSubmissionsFile()
public void setRedirectedSubmissionsFile(File redirectedSubmissionsFile)
redirectedSubmissionsFile
- a file, or null to cancel any existing redirection.public Class<?> getHelperClass()
Instrumentor
instance defines
as parameter of HELPER
clause.public void setHelperClass(Class<?> helperClass)
Redefine a helper class which is used as parameter of HELPER
clause
by this instance of Instrumentor
When setting you will probably create your own byteman helper class which extends the default
one BytemanTestHelper
.
You need to know what you are doing when setting this parameter different from default helper
implementation as it provides core functionality for dtest
library.
helperClass
- the new helper classpublic void installHelperJar(String path) throws Exception
path
- the absolute path to the .jar file.Exception
- in case of failure.public InstrumentedClass instrumentClass(Class clazz) throws Exception
clazz
- the Class to instrument.Exception
- in case of failure.public InstrumentedClass instrumentClass(Class clazz, String... methodNames) throws Exception
Exception
public InstrumentedClass instrumentClass(Class clazz, Set<String> methodNames) throws Exception
clazz
- the Class to instrument.methodNames
- the selection of methods to instrument.Exception
- in case of failure.public InstrumentedClass instrumentClass(String className, String... methodNames) throws Exception
className
- the class name to instrument.methodNames
- the selection of methods to instrument.Exception
- in case of failure.public InstrumentedClass instrumentClass(String className, Set<String> methodNames) throws Exception
NullPointerException
is thrown.className
- the class name to instrument.methodNames
- the selection of methods to instrument.NullPointerException
- in case of methodNames parameter is nullException
- in case of failure.public void injectOnCall(Class clazz, String methodName, String action) throws Exception
clazz
- The Class in which the injection point resides.methodName
- The method which should be intercepted.action
- The action that should take place upon invocation of the method.Exception
- in case of failure.public void injectOnCall(String className, String methodName, String action) throws Exception
className
- The name of the Class in which the injection point resides.methodName
- The method which should be intercepted.action
- The action that should take place upon invocation of the method.Exception
- in case of failure.public void injectOnExit(Class clazz, String methodName, String action) throws Exception
clazz
- The Class in which the injection point resides.methodName
- The method which should be intercepted.action
- The action that should take place upon invocation of the method.Exception
- in case of failure.public void injectOnExit(String className, String methodName, String action) throws Exception
className
- The name of the Class in which the injection point resides.methodName
- The method which should be intercepted.action
- The action that should take place upon invocation of the method.Exception
- in case of failure.public void injectOnMethod(Class clazz, String methodName, String condition, String action, String atInjection) throws Exception
clazz
- The Class in which the injection point resides.methodName
- The method which should be intercepted.action
- The action that should take place upon invocation of the method.atInjection
- the injection point e.g. "ENTRY".condition
- the rule conditionException
- in case of failure.public void injectOnMethod(String className, String methodName, String condition, String action, String atInjection) throws Exception
className
- The name of the Class in which the injection point resides.methodName
- The method which should be intercepted.action
- The action that should take place upon invocation of the method.atInjection
- the injection point e.g. "ENTRY".condition
- the rule conditionException
- in case of failure.public void injectOnMethodWhere(Class clazz, String methodName, String condition, String action, String where) throws Exception
Inject an action to take place at a given point within the specified class.method
Difference to injectOnMethod(Class, String, String, String, String)
resides at
injection definition. The prior one expects "AT" injection point. This one expects the whole
location qualifier.
clazz
- The Class in which the injection point resides.methodName
- The method which should be intercepted.action
- The action that should take place upon invocation of the method.where
- the injection definition e.g. "AT ENTRY" or "AFTER SYNCHRONIZATION".condition
- the rule conditionException
- in case of failure.public void injectOnMethodWhere(String className, String methodName, String condition, String action, String where) throws Exception
Inject an action to take place at a given point within the specified class.method
Difference to injectOnMethod(String, String, String, String, String)
resides at
injection definition. The prior one expects "AT" injection point. This one expects the whole
location qualifier.
className
- The name of the Class in which the injection point resides.methodName
- The method which should be intercepted.action
- The action that should take place upon invocation of the method.where
- the injection definition e.g. "AT ENTRY" or "AFTER SYNCHRONIZATION".condition
- the rule conditionException
- in case of failure.public void injectFault(Class clazz, String methodName, Class<? extends Throwable> fault, Object[] faultArgs) throws Exception
clazz
- The Class in which the injection point resides.methodName
- The method which should be intercepted.fault
- The type of Exception to be throw. If a checked exception, must be declared thrown by the specified method.faultArgs
- Optional constructor arguments for the Exception.Exception
- in case of failure.public void crashAtMethodExit(Class clazz, String methodName) throws Exception
clazz
- The Class in which the injection point resides.methodName
- The method which should be intercepted.Exception
- in case of failure.public void crashAtMethodExit(String className, String methodName) throws Exception
className
- The name of the Class in which the injection point resides.methodName
- The method which should be intercepted.Exception
- in case of failure.public void crashAtMethodEntry(Class clazz, String methodName) throws Exception
clazz
- The Class in which the injection point resides.methodName
- The method which should be intercepted.Exception
- in case of failure.public void crashAtMethodEntry(String className, String methodName) throws Exception
className
- The name of the Class in which the injection point resides.methodName
- The method which should be intercepted.Exception
- in case of failure.public void crashAtMethod(String className, String methodName, String atInjection) throws Exception
className
- The name of the Class in which the injection point resides.methodName
- The method which should be intercepted.atInjection
- the injection point e.g. "ENTRY".Exception
- in case of failure.public void installScript(String scriptName, String scriptString) throws Exception
scriptName
- The name of the script. Should be unique.scriptString
- The text of the script i.e. one or more Rules.Exception
- in case of failure.public String installRule(RuleConstructor builder) throws Exception
RuleConstructor
.builder
- rule builder with a rule definition to be installed as scriptException
- in case of failurepublic void removeScript(String scriptName) throws Exception
Removing particular script from the remote byteman agent.
If you submitted a rule directly to remote JVM then the scriptName is the name under the script was installed.
If you used setRedirectedSubmissionsFile(File)
to define
a file where the rule will be written then this method won't work
and you will get an IllegalStateException
.
scriptName
- name of script that should be removedException
- in case that script can't be removedpublic void removeRule(RuleConstructor builder) throws Exception
RuleConstructor
.builder
- a rule defining a script to be removedException
- in case of failurepublic void removeLocalState() throws Exception
Exception
- in case of failure.Copyright © 2018. All rights reserved.