Skip to content

Commit

Permalink
Fix store directories provided for community editions on construction.
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaDemianenko committed Aug 1, 2018
1 parent fdf5bfe commit aaaa2e1
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ public void done()
MoveAfterCopy moveAfterCopyWithLogging = ( moves, fromDirectory, toDirectory ) ->
{
userLog.info( "Copied store from master to " + fromDirectory );
msgLog.info( "Starting post copy operation to move store from " + fromDirectory + " to " + storeDir );
msgLog.info( "Starting post copy operation to move store from " + fromDirectory + " to " + toDirectory );
moveAfterCopy.move( moves, fromDirectory, toDirectory );
};
storeCopyClient.copyStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,25 @@ public class OpenEnterpriseNeoServer extends CommunityNeoServer

private static final GraphFactory HA_FACTORY = ( config, dependencies ) ->
{
File storeDir = config.get( GraphDatabaseSettings.databases_root_path ).getParentFile();
File storeDir = config.get( GraphDatabaseSettings.databases_root_path );
return new HighlyAvailableGraphDatabase( storeDir, config, dependencies );
};

private static final GraphFactory ENTERPRISE_FACTORY = ( config, dependencies ) ->
{
File storeDir = config.get( GraphDatabaseSettings.databases_root_path ).getParentFile();
File storeDir = config.get( GraphDatabaseSettings.databases_root_path );
return new EnterpriseGraphDatabase( storeDir, config, dependencies );
};

private static final GraphFactory CORE_FACTORY = ( config, dependencies ) ->
{
File storeDir = config.get( GraphDatabaseSettings.databases_root_path ).getParentFile();
File storeDir = config.get( GraphDatabaseSettings.databases_root_path );
return new CoreGraphDatabase( storeDir, config, dependencies );
};

private static final GraphFactory READ_REPLICA_FACTORY = ( config, dependencies ) ->
{
File storeDir = config.get( GraphDatabaseSettings.databases_root_path ).getParentFile();
File storeDir = config.get( GraphDatabaseSettings.databases_root_path );
return new ReadReplicaGraphDatabase( storeDir, config, dependencies );
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright (c) 2002-2018 "Neo4j,"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j Enterprise Edition. The included source
* code can be redistributed and/or modified under the terms of the
* GNU AFFERO GENERAL PUBLIC LICENSE Version 3
* (http://www.fsf.org/licensing/licenses/agpl-3.0.html) with the
* Commons Clause, as found in the associated LICENSE.txt file.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* Neo4j object code can be licensed independently from the source
* under separate terms from the AGPL. Inquiries can be directed to:
* licensing@neo4j.com
*
* More information is also available at:
* https://neo4j.com/licensing/
*/
package org.neo4j.server.enterprise;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import java.nio.file.Path;
import java.nio.file.Paths;

import org.neo4j.graphdb.facade.GraphDatabaseDependencies;
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.impl.enterprise.configuration.EnterpriseEditionSettings.Mode;
import org.neo4j.kernel.impl.factory.GraphDatabaseFacade;
import org.neo4j.logging.NullLogProvider;
import org.neo4j.test.extension.Inject;
import org.neo4j.test.extension.TestDirectoryExtension;
import org.neo4j.test.rule.TestDirectory;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.neo4j.kernel.impl.enterprise.configuration.EnterpriseEditionSettings.mode;

@ExtendWith( TestDirectoryExtension.class )
class OpenEnterpriseNeoServerTest
{
@Inject
private TestDirectory testDirectory;

@Test
void checkExpectedDatabaseDirectory()
{
Config config = Config.builder().withServerDefaults().withSetting( mode, Mode.SINGLE.name() )
.withSetting( GraphDatabaseSettings.neo4j_home, testDirectory.storeDir().getAbsolutePath() ).build();
GraphDatabaseDependencies dependencies = GraphDatabaseDependencies.newDependencies().userLogProvider( NullLogProvider.getInstance() );
OpenEnterpriseNeoServer server = new OpenEnterpriseNeoServer( config, dependencies, NullLogProvider.getInstance() );
server.start();
try
{
Path expectedPath = Paths.get( testDirectory.storeDir().getPath(), "data", "databases", "graph.db" );
GraphDatabaseFacade graph = server.getDatabase().getGraph();
assertEquals( expectedPath, graph.databaseDirectory().toPath() );
}
finally
{
server.stop();
}
}
}

0 comments on commit aaaa2e1

Please sign in to comment.