Skip to content

Commit

Permalink
Modify Windows scripts to conform to path handling conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
benbc committed Mar 22, 2016
1 parent e902dc4 commit d28b303
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Function Get-Java
$ShellArgs += "-XX:NumberOfGCLogFiles=5"
}
}
$ShellArgs += @("-Dfile.encoding=UTF-8",$serverMainClass)
$ShellArgs += @("-Dfile.encoding=UTF-8",$serverMainClass,"--config-dir=$($Neo4jServer.ConfDir)")
}

# Shell arguments for the utility classes e.g. Import, Shell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Function Get-Neo4jPrunsrv
$PrunArgs += @('--StartMode=jvm',
'--StartMethod=start',
"`"--StartPath=$($Neo4jServer.Home)`"",
"`"--StartParams=--config-dir=$($Neo4jServer.ConfDir)`"",
'--StopMode=jvm',
'--StopMethod=stop',
"`"--StopPath=$($Neo4jServer.Home)`"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,16 @@ Function Get-Neo4jServer
$Neo4jDir = Get-Item $Neo4jHome
$Neo4jHome = $Neo4jDir.FullName.TrimEnd('\')

$ConfDir = Get-Neo4jEnv 'NEO4J_CONF'
if ($ConfDir -eq $null)
{
$ConfDir = (Join-Path -Path $Neo4jHome -ChildPath 'conf')
}

# Get the information about the server
$serverProperties = @{
'Home' = $Neo4jHome;
'ConfDir' = $ConfDir;
'ServerVersion' = '';
'ServerType' = 'Community';
'DatabaseMode' = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Function Get-Neo4jSetting
$ConfigurationFile | ForEach-Object -Process `
{
$filename = $_
$filePath = Join-Path -Path $Neo4jServer.Home -ChildPath "conf\$filename"
$filePath = Join-Path -Path $Neo4jServer.ConfDir -ChildPath $filename
if (Test-Path -Path $filePath)
{
$keyPairsFromFile = Get-KeyValuePairsFromConfFile -filename $filePath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,26 @@ InModuleScope Neo4j-Management {
$neoServer.Home | Should Be $Neo4jDir
}
}

Context "No explicit location for config directory is provided" {
global:New-MockNeo4jInstall -RootDir 'TestDrive:\neo4j'
$Neo4jDir = (Get-Item 'TestDrive:\neo4j').FullName.TrimEnd('\')

It "Defaults config path to $Neo4jDir\conf" {
$neoServer = Get-Neo4jServer -Neo4jHome 'TestDrive:\neo4j\' -ErrorAction Stop
$neoServer.ConfDir | Should Be (Join-Path -Path $Neo4jDir -ChildPath 'conf')
}
}

Context "NEO4J_CONF environment variable is set" {
global:New-MockNeo4jInstall -RootDir 'TestDrive:\neo4j'
$Neo4jDir = (Get-Item 'TestDrive:\neo4j').FullName.TrimEnd('\')
[Environment]::SetEnvironmentVariable('NEO4J_CONF','', 'TestDrive:\neo4j-conf')

It "Defaults config path to $Neo4jDir\conf" {
$neoServer = Get-Neo4jServer -Neo4jHome 'TestDrive:\neo4j\' -ErrorAction Stop
$neoServer.ConfDir | Should Be 'TestDrive:\neo4j-conf'
}
}
}
}

0 comments on commit d28b303

Please sign in to comment.