@Test public void testPrependVMArguments() { AgentConfigs agentConfigs = new AgentConfigs(); assertEquals("-javaagent:/tmp/foo=", agentConfigs.prependVMArguments("-javaagent:/tmp/foo=", new File("/tmp/foo"))); assertEquals("-javaagent:/tmp/foo= -cp .:/tmp/", agentConfigs.prependVMArguments("-cp .:/tmp/", new File("/tmp/foo"))); }
public String prependVMArguments(final String arguments, final File agentJarFile) { final List<String> args = CommandLineSupport.split(arguments); final String plainAgent = format("-javaagent:%s", agentJarFile); for (final Iterator<String> i = args.iterator(); i.hasNext();) { if (i.next().startsWith(plainAgent)) { i.remove(); } } args.add(0, getVMArgument(agentJarFile)); return CommandLineSupport.quote(args); }
AgentConfigs { public String prependVMArguments(final String arguments, final File agentJarFile) { final List<String> args = CommandLineSupport.split(arguments); final String plainAgent = format("-javaagent:%s", agentJarFile); for (final Iterator<String> i = args.iterator(); i.hasNext();) { if (i.next().startsWith(plainAgent)) { i.remove(); } } args.add(0, getVMArgument(agentJarFile)); return CommandLineSupport.quote(args); } }
AgentConfigs { public String prependVMArguments(final String arguments, final File agentJarFile) { final List<String> args = CommandLineSupport.split(arguments); final String plainAgent = format("-javaagent:%s", agentJarFile); for (final Iterator<String> i = args.iterator(); i.hasNext();) { if (i.next().startsWith(plainAgent)) { i.remove(); } } args.add(0, getVMArgument(agentJarFile)); return CommandLineSupport.quote(args); } AgentConfigs();  AgentConfigs(final String agentConfigs);  AgentConfigs(final Properties properties); }
AgentConfigs { public String prependVMArguments(final String arguments, final File agentJarFile) { final List<String> args = CommandLineSupport.split(arguments); final String plainAgent = format("-javaagent:%s", agentJarFile); for (final Iterator<String> i = args.iterator(); i.hasNext();) { if (i.next().startsWith(plainAgent)) { i.remove(); } } args.add(0, getVMArgument(agentJarFile)); return CommandLineSupport.quote(args); } AgentConfigs();  AgentConfigs(final String agentConfigs);  AgentConfigs(final Properties properties); String getBuildLocation(); void setBuildLocation(final String buildLocation); String getDestfile(); void setDestfile(final String destfile); String getIncludes(); void setIncludes(final String includes); String getExcludes(); void setExcludes(final String excludes); String getExclClassloader(); void setExclClassloader(final String expression); boolean getInclNoLocationClasses(); void setInclNoLocationClasses(final boolean include); AgentOutput getOutput(); void setOutput(final String output); void setOutput(final AgentOutput output); GranularityLevel getGranularity(); void setGranularity(final String granularity); void setGranularity(final GranularityLevel granularity); Boolean getInclPublicMethods(); void setInclPublicMethods(final boolean inclPublicMethods); Boolean getInclStaticConstructors(); void setInclStaticConstructors(final boolean inclStaticConstructors); Boolean getInclDeprecatedMethods(); void setInclDeprecatedMethods(final boolean inclDeprecatedMethods); InstrumentationLevel getInstrumentationLevel(); void setInstrumentationLevel(final String instrumentationLevel); void setInstrumentationLevel(final InstrumentationLevel instrumentationLevel); String getVMArgument(final File agentJarFile); String getQuotedVMArgument(final File agentJarFile); String prependVMArguments(final String arguments, final File agentJarFile); @Override String toString(); }
AgentConfigs { public String prependVMArguments(final String arguments, final File agentJarFile) { final List<String> args = CommandLineSupport.split(arguments); final String plainAgent = format("-javaagent:%s", agentJarFile); for (final Iterator<String> i = args.iterator(); i.hasNext();) { if (i.next().startsWith(plainAgent)) { i.remove(); } } args.add(0, getVMArgument(agentJarFile)); return CommandLineSupport.quote(args); } AgentConfigs();  AgentConfigs(final String agentConfigs);  AgentConfigs(final Properties properties); String getBuildLocation(); void setBuildLocation(final String buildLocation); String getDestfile(); void setDestfile(final String destfile); String getIncludes(); void setIncludes(final String includes); String getExcludes(); void setExcludes(final String excludes); String getExclClassloader(); void setExclClassloader(final String expression); boolean getInclNoLocationClasses(); void setInclNoLocationClasses(final boolean include); AgentOutput getOutput(); void setOutput(final String output); void setOutput(final AgentOutput output); GranularityLevel getGranularity(); void setGranularity(final String granularity); void setGranularity(final GranularityLevel granularity); Boolean getInclPublicMethods(); void setInclPublicMethods(final boolean inclPublicMethods); Boolean getInclStaticConstructors(); void setInclStaticConstructors(final boolean inclStaticConstructors); Boolean getInclDeprecatedMethods(); void setInclDeprecatedMethods(final boolean inclDeprecatedMethods); InstrumentationLevel getInstrumentationLevel(); void setInstrumentationLevel(final String instrumentationLevel); void setInstrumentationLevel(final InstrumentationLevel instrumentationLevel); String getVMArgument(final File agentJarFile); String getQuotedVMArgument(final File agentJarFile); String prependVMArguments(final String arguments, final File agentJarFile); @Override String toString(); static final String BUILDLOCATION_KEY; static final String DEFAULT_BUILDLOCATION; static final String DESTFILE_KEY; static final String DEFAULT_DESTFILE; static final String INCLUDES_KEY; static final String DEFAULT_INCLUDES; static final String EXCLUDES_KEY; static final String DEFAULT_EXCLUDES; static final String EXCLCLASSLOADER_KEY; static final String DEFAULT_EXCLCLASSLOADER; static final String INCLNOLOCATIONCLASSES_KEY; static final boolean DEFAULT_INCLNOLOCATIONCLASSES; static final String OUTPUT_KEY; static final AgentOutput DEFAULT_OUTPUT; static final String GRANULARITY_KEY; static final GranularityLevel DEFAULT_GRANULARITY; static final String INCLPUBLICMETHODS_KEY; static final boolean DEFAULT_INCLPUBLICMETHODS; static final String INCLSTATICCONSTRUCTORS_KEY; static final boolean DEFAULT_INCLSTATICCONSTRUCTORS; static final String INCLDEPRECATEDMETHODS_KEY; static final boolean DEFAULT_INCLDEPRECATEDMETHODS; static final String INSTRUMENTATION_LEVEL_KEY; static final InstrumentationLevel DEFAULT_INSTRUMENTATION_LEVEL; }