Skip to content

Commit

Permalink
Renamed EnvironmentVariableNames into ENVIRONMENT_VARIABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
rdagumampan committed Feb 1, 2020
1 parent 1cb3808 commit 70cf519
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Yuniql.PlatformTests
{
public class EnvironmentVariableNames
public class ENVIRONMENT_VARIABLE
{
public const string YUNIQL_PLUGINS = "YUNIQL_PLUGINS";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public class StartupInfrastructure
[AssemblyInitialize]
public static void SetupInfrastrucuture(TestContext testContext)
{
var testAgentHost = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_HOST);
var targetPlatform = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_TARGET_PLATFORM);
var testAgentHost = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_HOST);
var targetPlatform = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_TARGET_PLATFORM);

if (string.IsNullOrEmpty(testAgentHost) || string.IsNullOrWhiteSpace(testAgentHost) || testAgentHost.ToUpper().Equals("LOCAL"))
{
Expand Down Expand Up @@ -44,8 +44,8 @@ public static void SetupInfrastrucuture(TestContext testContext)
[AssemblyCleanup]
public static void TearDownInfrastructure()
{
var testAgentHost = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_HOST);
var targetPlatform = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_TARGET_PLATFORM);
var testAgentHost = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_HOST);
var targetPlatform = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_TARGET_PLATFORM);

if (string.IsNullOrEmpty(testAgentHost) || string.IsNullOrWhiteSpace(testAgentHost) || testAgentHost.ToUpper().Equals("LOCAL"))
{
Expand Down
22 changes: 11 additions & 11 deletions yuniql-tests/platform-tests/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public string CreateEmptyWorkspace()

public string CloneSampleWorkspace(string workingPath)
{
var source = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_SAMPLEDB);
var source = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_SAMPLEDB);
var destination = workingPath;

foreach (string dirPath in Directory.GetDirectories(source, "*", SearchOption.AllDirectories))
Expand All @@ -43,18 +43,18 @@ public TestConfiguration ConfigureWithEmptyWorkspace()
var databaseName = new DirectoryInfo(workspacePath).Name;

//prepare a unique connection string for each test case
var connectionString = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_CONNECTION_STRING);
var connectionString = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_CONNECTION_STRING);
connectionString = connectionString.Replace("yuniqldb", databaseName);

return new TestConfiguration
{
Platform = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_TARGET_PLATFORM),
Platform = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_TARGET_PLATFORM),
ConnectionString = connectionString,
DatabaseName = databaseName,
WorkspacePath = workspacePath,
CliProcessPath = GetCliProcessFile(),
PluginsPath = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_PLUGINS),
TestAgentHost = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_HOST)
PluginsPath = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_PLUGINS),
TestAgentHost = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_HOST)
};
}

Expand All @@ -68,29 +68,29 @@ public TestConfiguration ConfigureWorkspaceWithSampleDb()
CloneSampleWorkspace(workspacePath);

//prepare a unique connection string for each test case
var connectionString = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_CONNECTION_STRING);
var connectionString = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_CONNECTION_STRING);
connectionString = connectionString.Replace("yuniqldb", databaseName);

return new TestConfiguration
{
Platform = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_TARGET_PLATFORM),
Platform = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_TARGET_PLATFORM),
ConnectionString = connectionString,
DatabaseName = databaseName,
WorkspacePath = workspacePath,
CliProcessPath = GetCliProcessFile(),
PluginsPath = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_PLUGINS),
TestAgentHost = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_HOST)
PluginsPath = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_PLUGINS),
TestAgentHost = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_HOST)
};
}

private string GetCliProcessFile()
{
//handle environment where tests are executed
var isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;
var cliProcessFile = Path.Combine(EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_CLI), "yuniql.exe");
var cliProcessFile = Path.Combine(EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_CLI), "yuniql.exe");
if (!isWindows)
{
cliProcessFile = Path.Combine(EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_CLI), "yuniql");
cliProcessFile = Path.Combine(EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_CLI), "yuniql");
}

return cliProcessFile;
Expand Down
2 changes: 1 addition & 1 deletion yuniql-tests/platform-tests/TestMethodExAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class TestMethodExAttribute : TestMethodAttribute

public override TestResult[] Execute(ITestMethod testMethod)
{
var platform = EnvironmentHelper.GetEnvironmentVariable(EnvironmentVariableNames.YUNIQL_TEST_TARGET_PLATFORM);
var platform = EnvironmentHelper.GetEnvironmentVariable(ENVIRONMENT_VARIABLE.YUNIQL_TEST_TARGET_PLATFORM);
var testDataServiceFactory = new TestDataServiceFactory();
var testDataService = testDataServiceFactory.Create(platform);

Expand Down

0 comments on commit 70cf519

Please sign in to comment.