public Instrumentor(String address, int port) throws RemoteException { this(new Submit(address, port), BytemanTestHelper.DEFAULT_RMI_PORT); }
public Instrumentor() throws RemoteException { this(new Submit(), BytemanTestHelper.DEFAULT_RMI_PORT); }
public Instrumentor(String address, int port, int rmiPort) throws RemoteException { this(new Submit(address, port), rmiPort); }
public void run() { try { Submit frame = new Submit(); frame.setVisible(true); } catch (Exception e) {
/** * loads a script from the load directory using the name of a unit test as the root name for the script * file and ".btm" or, failing that, ".txt" for the file extension * @param clazz the test class * @param testName the test name * @throws Exception if the script cannot be unloaded */ public static void unloadScriptFile(Class<?> clazz, String testName) throws Exception { String className = clazz.getName(); if (testName == null) { testName = ""; } String key = className + "#" + testName; String filename = fileTable.remove(key); if (filename == null) { throw new FileNotFoundException("Rule file not found for Byteman test case " + key); } Submit submit = new Submit(getHost(), getPort()); List<String> files = new ArrayList<String>(); files.add(filename); if (isBMUnitVerbose()) { System.out.println("BMUnit : unloading file script = " + filename); } submit.deleteRulesFromFiles(files); }
/** * unloads a script previously supplied as a text String * @param clazz the test class * @param testName the test name * @throws Exception if the script text cannot be unloaded */ public static void unloadScriptText(Class<?> clazz, String testName) throws Exception { String className = clazz.getName(); if (testName == null) { testName = ""; } String key = className + "+" + testName; String scriptText = fileTable.remove(key); if (scriptText == null) { throw new Exception("Rule script not found " + key); } Submit submit = new Submit(getHost(), getPort()); if (isBMUnitVerbose()) { System.out.println("BMUnit : unloading text script = " + key); } List<ScriptText> scripts = new ArrayList<ScriptText>(); ScriptText script = new ScriptText(key, scriptText); scripts.add(script); submit.deleteScripts(scripts); }
/** * loads a script supplied as a text String rather than via a file on disk * @param clazz the test class * @param testname the test name * @param scriptText the text of the rule or rules contained in the script * @throws Exception if the script text cannot be loaded */ public static void loadScriptText(Class<?> clazz, String testname, String scriptText) throws Exception { if (BMUnitConfigState.getCurrentConfigState() == null) { throw new Exception("BMUnit : load script file requested with no current configuration " + clazz.getName() + (testname != null ? " " + testname : "")); } String className = clazz.getName(); if (testname == null) { testname = ""; } String key = className + "+" + testname; fileTable.put(key, scriptText); Submit submit = new Submit(getHost(), getPort()); if (isBMUnitVerbose()) { System.out.println("BMUnit : loading text script = " + key); // System.out.println(scriptText); } List<ScriptText> scripts = new ArrayList<ScriptText>(); ScriptText script = new ScriptText(key, scriptText); scripts.add(script); submit.addScripts(scripts); }
Submit submit = new Submit(getHost(), getPort()); List<String> files = new ArrayList<String>(); files.add(filename);
private static void uploadAgentProperties() throws Exception { // if any Byteman config changes have been requested and // are allowed upload all reconfigured system property // settings to the agent. BMUnitConfigState previousConfigState = currentConfigState.previous; if (needPropertyReset(currentConfigState, previousConfigState)) { Submit submit = new Submit(currentConfigState.getHost(), currentConfigState.getPort()); Properties properties = new Properties(); if (configurePropertyReset(currentConfigState, previousConfigState, properties)) { submit.setSystemProperties(properties); } } }
Submit client = new Submit(hostname, port, out); String results = null; List<String> argsList = null;
private static void resetAgentProperties() throws Exception { // if we uploaded any reconfigured system property settings // to the agent then revert them BMUnitConfigState previousConfigState = currentConfigState.previous; if (previousConfigState != null && previousConfigState.isAllowConfigUpdate()) { if (needPropertyReset(previousConfigState, currentConfigState)) { Submit submit = new Submit(currentConfigState.getHost(), currentConfigState.getPort()); Properties properties = new Properties(); if (configurePropertyReset(previousConfigState, currentConfigState, properties)) { submit.setSystemProperties(properties); } } } }