Created
September 28, 2010 10:13
-
-
Save chilversc/600749 to your computer and use it in GitHub Desktop.
Grinder Powershell module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This program is free software. It comes without any warranty, to | |
# the extent permitted by applicable law. You can redistribute it | |
# and/or modify it under the terms of the Do What The Fuck You Want | |
# To Public License, Version 2, as published by Sam Hocevar. See | |
# http://sam.zoy.org/wtfpl/COPYING for more details. | |
$script:GrinderPath = Resolve-Path (Join-Path $PSScriptRoot ../engine/grinder-3.4) | |
$script:ClassPath = (Join-Path $script:GrinderPath lib/grinder.jar) + ";$env:classpath" | |
$script:JavaHome = $env:java_home | |
$script:Java = Join-Path $script:JavaHome bin/java.exe | |
$script:JavaW = Join-Path $script:JavaHome bin/javaw.exe | |
function Start-GrinderConsole { | |
[CmdletBinding()] | |
param () | |
&$script:JavaW -cp $script:ClassPath net.grinder.Console | |
} | |
function Start-GrinderAgent { | |
[CmdletBinding()] | |
param ( | |
$PropertiesFile = (Resolve-Path (Join-Path $PSScriptRoot ../etc/grinder.properties)) | |
) | |
&$script:Java -cp $script:ClassPath net.grinder.Grinder $PropertiesFile | |
} | |
function Start-TCPProxy { | |
[CmdletBinding()] | |
param ( | |
[string] $LocalHost, | |
[int] $LocalPort, | |
[switch] $Colour, | |
[switch] $Console, | |
[switch] $Http | |
) | |
$cmdargs = @(); | |
if ($Colour) { $cmdargs += "-colour" } | |
if ($Console) { $cmdargs += "-console" } | |
if ($Http) { $cmdargs += "-http" } | |
if ($LocalHost) { $cmdargs += "-localhost", "$LocalHost" } | |
if ($LocalPort) { $cmdargs += "-localport", "$LocalPort" } | |
&$script:Java -cp $script:ClassPath net.grinder.TCPProxy $cmdargs | |
} | |
Export-ModuleMember Start-GrinderConsole, Start-GrinderAgent, Start-TCPProxy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment