我试图在PowerShell脚本中绑定一个地址

时间:2016-10-11 09:05:34

标签: java powershell powershell-v2.0 powershell-v3.0 wiremock

我试图在PowerShell脚本中绑定一个地址,以便我的测试人员可以运行线程,并在运行时自动指向正确的环境。

echo "Running WireMock"

$WiremockFileName = "wiremock-standalone-2.1.12.jar"
$Port = 8050
$Address = "my.integration.address"

if (-not(Test-Path "./$WiremockFileName")) {
    echo "Going to download wiremock";
    Invoke-WebRequest "http://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-standalone/2.1.12/$WiremockFileName" -OutFile $WiremockFileName
    echo "Finished"
}

echo "Looking for JRE"
$JAVA = ""

if ($JAVA -eq "") {
    # In case a specific version of Java is in the path already
    $JavaExe = Get-Command "java" -ErrorAction SilentlyContinue
    if ($JavaExe) {
        $JAVA = JavaExe.Definition
    }
}

if ($JAVA -eq "") {
    # This seems to work on RBI machines
    $jre7Path = "C:\Program Files (x86)\Java\jre7\bin\java.exe"
    $testJre7 = Test-Path $jre7Path -ErrorAction SilentlyContinue
    if ($testJre7) {
        $JAVA = $jre7Path
    }
}

if ($JAVA -eq "") {
    # Nope - I give up
    echo "I give up! I can't find JAVA anywhere"
    echo "Put it in your path and stop giving me a hard time or send a pull request"

    exit 1
    # echo "Press any key to continue"
    # $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
}

& $JAVA -jar $WiremockFileName --bind-address $Address --https-port $Port --verbose
exit $LASTEXITCODE

我试图让这部分工作:

& $JAVA -jar $WiremockFileName --bind-address $Address --https-port $Port --verbose

--bind-address $Address似乎不起作用。

1 个答案:

答案 0 :(得分:0)

在地址绑定旁边...在第20行我很确定它应该是

mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); mWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { mCurrentUrl = url; // If we don't return false then any redirect (like redirecting to the mobile // version of the page) or any link click will open the web browser (like an // implicit intent). return false; } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); ... } }); mWebView.loadUrl(mInitialUrl);

而不是

$JAVA = $JavaExe.Definition