in AmbrosiaTest/AmbrosiaTest/Utilities.cs [944:1074]
public void CallAMB(AMB_Settings AMBSettings, string testOutputLogFile, AMB_ModeConsts AMBMode)
{
// Launch the AMB process with these values
string currentDir = Directory.GetCurrentDirectory();
string workingDir = currentDir + "\\" + NetFramework + "\\";
string fileNameExe = "Ambrosia.exe";
if (NetFrameworkTestRun == false)
{
workingDir = currentDir + "\\" + NetCoreFramework + "\\";
fileNameExe = "Ambrosia.dll";
}
string argString = "none";
// Set up args for the proper mode
switch (AMBMode)
{
case AMB_ModeConsts.RegisterInstance:
argString = "RegisterInstance " + "-i=" + AMBSettings.AMB_ServiceName
+ " -rp=" + AMBSettings.AMB_PortAppReceives + " -sp=" + AMBSettings.AMB_PortAMBSends;
// add pause at start
if (AMBSettings.AMB_PauseAtStart != null && AMBSettings.AMB_PauseAtStart != "N")
argString = argString + " -ps";
// add Create Service
if (AMBSettings.AMB_CreateService != null)
argString = argString + " -cs=" + AMBSettings.AMB_CreateService;
// add Service log path
if (AMBSettings.AMB_ServiceLogPath != null)
argString = argString + " -l=" + AMBSettings.AMB_ServiceLogPath;
// add no persist logs at start
if (AMBSettings.AMB_PersistLogs != null && AMBSettings.AMB_PersistLogs != "Y")
argString = argString + " -npl";
// add active active
if (AMBSettings.AMB_ActiveActive != null && AMBSettings.AMB_ActiveActive != "N")
argString = argString + " -aa";
// add upgrade version if it exists
if (AMBSettings.AMB_UpgradeToVersion != null)
argString = argString + " -uv=" + AMBSettings.AMB_UpgradeToVersion;
// add current version if it exists
if (AMBSettings.AMB_Version != null)
argString = argString + " -cv=" + AMBSettings.AMB_Version;
// add new log trigger size if it exists
if (AMBSettings.AMB_NewLogTriggerSize != null)
argString = argString + " -lts=" + AMBSettings.AMB_NewLogTriggerSize;
break;
case AMB_ModeConsts.AddReplica:
argString = "AddReplica " + "-r=" + AMBSettings.AMB_ReplicaNumber + " -i=" + AMBSettings.AMB_ServiceName
+ " -rp=" + AMBSettings.AMB_PortAppReceives + " -sp=" + AMBSettings.AMB_PortAMBSends;
// add Service log path
if (AMBSettings.AMB_ServiceLogPath != null)
argString = argString + " -l=" + AMBSettings.AMB_ServiceLogPath;
// add Create Service
if (AMBSettings.AMB_CreateService != null)
argString = argString + " -cs=" + AMBSettings.AMB_CreateService;
// add pause at start
if (AMBSettings.AMB_PauseAtStart != null && AMBSettings.AMB_PauseAtStart != "N")
argString = argString + " -ps";
// add no persist logs at start
if (AMBSettings.AMB_PersistLogs != null && AMBSettings.AMB_PersistLogs != "Y")
argString = argString + " -npl";
// add new log trigger size if it exists
if (AMBSettings.AMB_NewLogTriggerSize != null)
argString = argString + " -lts=" + AMBSettings.AMB_NewLogTriggerSize;
// add active active
if (AMBSettings.AMB_ActiveActive != null && AMBSettings.AMB_ActiveActive != "N")
argString = argString + " -aa";
// add current version if it exists
if (AMBSettings.AMB_Version != null)
argString = argString + " -cv=" + AMBSettings.AMB_Version;
// add upgrade version if it exists
if (AMBSettings.AMB_UpgradeToVersion != null)
argString = argString + " -uv=" + AMBSettings.AMB_UpgradeToVersion;
break;
case AMB_ModeConsts.DebugInstance:
argString = "DebugInstance " + "-i=" + AMBSettings.AMB_ServiceName + " -rp=" + AMBSettings.AMB_PortAppReceives
+ " -sp=" + AMBSettings.AMB_PortAMBSends;
// add Service log path
if (AMBSettings.AMB_ServiceLogPath != null)
argString = argString + " -l=" + AMBSettings.AMB_ServiceLogPath;
// add Check point
if (AMBSettings.AMB_StartingCheckPointNum != null)
argString = argString + " -c=" + AMBSettings.AMB_StartingCheckPointNum;
// add version
if (AMBSettings.AMB_Version != null)
argString = argString + " -cv=" + AMBSettings.AMB_Version;
// testing upgrade
if (AMBSettings.AMB_TestingUpgrade != null && AMBSettings.AMB_TestingUpgrade != "N")
argString = argString + " -tu";
break;
}
int processID = LaunchProcess(workingDir, fileNameExe, argString, false, testOutputLogFile);
if (processID <= 0)
{
FailureSupport("");
Assert.Fail("<CallAMB> AMB was not started. ProcessID <=0 ");
}
// Give it a bit to start
Thread.Sleep(5000);
Application.DoEvents(); // if don't do this ... system sees thread as blocked thread and throws message.
}