Skip to content

Commit bed777d

Browse files
committed
Clean appserver path
1 parent df4f671 commit bed777d

File tree

2 files changed

+12
-41
lines changed

2 files changed

+12
-41
lines changed

dotnet/test/common/Environment/TestWebServer.cs

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class TestWebServer
3333
{
3434
private Process webserverProcess;
3535

36-
private string standaloneTestJar = @"_main/java/test/org/openqa/selenium/environment/appserver";
36+
private string standaloneAppserverPath;
3737
private string projectRootPath;
3838
private bool captureWebServerOutput;
3939
private bool hideCommandPrompt;
@@ -58,73 +58,44 @@ public async Task StartAsync()
5858
try
5959
{
6060
var runfiles = Runfiles.Create();
61-
standaloneTestJar = runfiles.Rlocation(standaloneTestJar);
61+
standaloneAppserverPath = runfiles.Rlocation(standaloneAppserverPath);
6262
}
6363
catch (FileNotFoundException)
6464
{
6565
var baseDirectory = AppContext.BaseDirectory;
66-
standaloneTestJar = Path.Combine(baseDirectory, "../../../../../../bazel-bin/java/test/org/openqa/selenium/environment/appserver");
66+
standaloneAppserverPath = Path.Combine(baseDirectory, "../../../../../../bazel-bin/java/test/org/openqa/selenium/environment/appserver");
6767
}
6868

6969
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
7070
{
71-
standaloneTestJar += ".exe";
71+
standaloneAppserverPath += ".exe";
7272
}
7373

74-
Console.Write("Standalone jar is " + standaloneTestJar);
74+
Console.Write("Test Appserver is " + standaloneAppserverPath);
7575

76-
if (!File.Exists(standaloneTestJar))
76+
if (!File.Exists(standaloneAppserverPath))
7777
{
7878
throw new FileNotFoundException(
7979
string.Format(
80-
"Test webserver jar at {0} didn't exist. Project root is {2}. Please build it using something like {1}.",
81-
standaloneTestJar,
82-
"bazel build //java/test/org/openqa/selenium/environment:appserver_deploy.jar",
80+
"Test Appserver at {0} didn't exist. Project root is {2}. Please build it using something like {1}.",
81+
standaloneAppserverPath,
82+
"bazel build //java/test/org/openqa/selenium/environment:appserver",
8383
projectRootPath));
8484
}
8585

86-
//List<string> javaSystemProperties = new List<string>();
87-
8886
StringBuilder processArgsBuilder = new StringBuilder();
89-
// foreach (string systemProperty in javaSystemProperties)
90-
// {
91-
// if (processArgsBuilder.Length > 0)
92-
// {
93-
// processArgsBuilder.Append(" ");
94-
// }
95-
//
96-
// processArgsBuilder.AppendFormat("-D{0}", systemProperty);
97-
// }
98-
//
99-
// if (processArgsBuilder.Length > 0)
100-
// {
101-
// processArgsBuilder.Append(" ");
102-
// }
103-
//
104-
// processArgsBuilder.AppendFormat("-jar {0}", standaloneTestJar);
87+
10588
processArgsBuilder.AppendFormat(" {0}", this.port);
10689

10790
Console.Write(processArgsBuilder.ToString());
10891

10992
webserverProcess = new Process();
110-
webserverProcess.StartInfo.FileName = standaloneTestJar;
111-
// if (!string.IsNullOrEmpty(javaExecutablePath))
112-
// {
113-
// webserverProcess.StartInfo.FileName = Path.Combine(javaExecutablePath, javaExecutableName);
114-
// }
115-
// else
116-
// {
117-
// webserverProcess.StartInfo.FileName = javaExecutableName;
118-
// }
93+
webserverProcess.StartInfo.FileName = standaloneAppserverPath;
11994

12095
webserverProcess.StartInfo.Arguments = processArgsBuilder.ToString();
12196
webserverProcess.StartInfo.WorkingDirectory = projectRootPath;
12297
webserverProcess.StartInfo.UseShellExecute = !(hideCommandPrompt || captureWebServerOutput);
12398
webserverProcess.StartInfo.CreateNoWindow = hideCommandPrompt;
124-
if (!string.IsNullOrEmpty(this.javaHomeDirectory))
125-
{
126-
webserverProcess.StartInfo.EnvironmentVariables["JAVA_HOME"] = this.javaHomeDirectory;
127-
}
12899

129100
captureWebServerOutput = true;
130101

dotnet/test/common/WebDriver.Common.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</ItemGroup>
3535

3636
<Target Name="BuildTestWebServer" AfterTargets="AfterBuild">
37-
<Exec Command="bazel build //java/test/org/openqa/selenium/environment:appserver_deploy.jar" WorkingDirectory="../../.." />
37+
<Exec Command="bazel build //java/test/org/openqa/selenium/environment:appserver" WorkingDirectory="../../.." />
3838
</Target>
3939

4040
<!-- It is automatically imported when Selenium.WebDriver consumed via nuget package -->

0 commit comments

Comments
 (0)