Skip to content

Commit

Permalink
More fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaDemianenko committed Aug 21, 2018
1 parent f634326 commit 48abee2
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
Expand Up @@ -92,7 +92,7 @@ private static class TestBackDependencies implements OnlineBackupExtensionFactor
@Override
public Config getConfig()
{
return null;
return Config.defaults();
}

@Override
Expand Down
Expand Up @@ -28,6 +28,7 @@
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.helpers.Exceptions;
import org.neo4j.io.fs.FileUtils;
import org.neo4j.io.layout.DatabaseLayout;
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.configuration.Settings;
Expand Down Expand Up @@ -62,7 +63,7 @@ public synchronized void shutdown()
shutdown = true;
}

public synchronized void recoverCopiedStore( File tempStore ) throws DatabaseShutdownException
public synchronized void recoverCopiedStore( DatabaseLayout databaseLayout ) throws DatabaseShutdownException
{
if ( shutdown )
{
Expand All @@ -71,10 +72,10 @@ public synchronized void recoverCopiedStore( File tempStore ) throws DatabaseShu

try
{
GraphDatabaseService graphDatabaseService = newTempDatabase( tempStore );
GraphDatabaseService graphDatabaseService = newTempDatabase( databaseLayout.databaseDirectory() );
graphDatabaseService.shutdown();
// as soon as recovery will be extracted we will not gonna need this
File lockFile = new File( tempStore, StoreLocker.STORE_LOCK_FILENAME );
File lockFile = new File( databaseLayout.getDatabasesDirectory(), StoreLocker.STORE_LOCK_FILENAME );
if ( lockFile.exists() )
{
FileUtils.deleteFile( lockFile );
Expand Down
Expand Up @@ -58,7 +58,7 @@ public void replaceWithStoreFrom( CatchupAddressProvider addressProvider, StoreI
{
remoteStore.copy( addressProvider, expectedStoreId, tempStore.databaseLayout(),
false );
copiedStoreRecovery.recoverCopiedStore( tempStore.storeDir() );
copiedStoreRecovery.recoverCopiedStore( tempStore.databaseLayout() );
localDatabase.replaceWith( tempStore.databaseLayout().databaseDirectory() );
}
log.info( "Replaced store successfully" );
Expand Down
Expand Up @@ -96,7 +96,7 @@ public class CatchupServerIT
public void startDb() throws Throwable
{
temporaryDirectory = testDirectory.directory( "temp" );
graphDb = (GraphDatabaseAPI) new TestGraphDatabaseFactory().setFileSystem( fsa ).newEmbeddedDatabase( testDirectory.storeDir() );
graphDb = (GraphDatabaseAPI) new TestGraphDatabaseFactory().setFileSystem( fsa ).newEmbeddedDatabase( testDirectory.databaseDir() );
createLegacyIndex();
createPropertyIndex();
addData( graphDb );
Expand Down
Expand Up @@ -27,6 +27,7 @@
import java.io.File;

import org.neo4j.helpers.collection.Iterables;
import org.neo4j.io.layout.DatabaseLayout;
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.kernel.configuration.Config;

Expand All @@ -47,7 +48,7 @@ public void shouldThrowIfAlreadyShutdown()
try
{
// when
copiedStoreRecovery.recoverCopiedStore( new File( "nowhere" ) );
copiedStoreRecovery.recoverCopiedStore( new DatabaseLayout( new File( "nowhere" ) ) );
fail( "should have thrown" );
}
catch ( DatabaseShutdownException ex )
Expand Down
Expand Up @@ -41,6 +41,7 @@
import org.neo4j.helpers.progress.ProgressMonitorFactory;
import org.neo4j.io.fs.DefaultFileSystemAbstraction;
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.io.layout.DatabaseLayout;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.logging.NullLogProvider;
import org.neo4j.storageengine.api.lock.AcquireLockTimeoutException;
Expand Down Expand Up @@ -171,7 +172,7 @@ public void readReplicaTest() throws Exception
for ( CoreClusterMember core : cluster.coreMembers() )
{
ConsistencyCheckService.Result result = new ConsistencyCheckService()
.runFullConsistencyCheck( core.database().databaseLayout(), Config.defaults(), ProgressMonitorFactory.NONE,
.runFullConsistencyCheck( new DatabaseLayout( core.databaseDirectory() ), Config.defaults(), ProgressMonitorFactory.NONE,
NullLogProvider.getInstance(), fileSystem, false,
new ConsistencyFlags( true, true, true, false ) );
assertTrue( "Inconsistent: " + core, result.isSuccessful() );
Expand All @@ -180,7 +181,7 @@ public void readReplicaTest() throws Exception
for ( ReadReplica readReplica : cluster.readReplicas() )
{
ConsistencyCheckService.Result result = new ConsistencyCheckService()
.runFullConsistencyCheck( readReplica.database().databaseLayout(), Config.defaults(), ProgressMonitorFactory.NONE,
.runFullConsistencyCheck( new DatabaseLayout( readReplica.databaseDirectory() ), Config.defaults(), ProgressMonitorFactory.NONE,
NullLogProvider.getInstance(), fileSystem, false,
new ConsistencyFlags( true, true, true, false ) );
assertTrue( "Inconsistent: " + readReplica, result.isSuccessful() );
Expand Down
Expand Up @@ -73,7 +73,7 @@ private void assertStoreConsistent( File storeDir )
{
fs.copyRecursively( storeDir, storeDirectory.storeDir() );
new CopiedStoreRecovery( Config.defaults(), GraphDatabaseDependencies.newDependencies().kernelExtensions(), pageCache )
.recoverCopiedStore( storeDirectory.storeDir() );
.recoverCopiedStore( storeDirectory.databaseLayout() );
ConsistencyCheckService.Result result = runConsistencyCheckTool( new String[]{storeDir.getAbsolutePath()},
new PrintStream( NULL_OUTPUT_STREAM ), new PrintStream( NULL_OUTPUT_STREAM ) );
if ( !result.isSuccessful() )
Expand Down
Expand Up @@ -73,7 +73,7 @@ private void assertStoreConsistent( File storeDir )
{
fs.copyRecursively( storeDir, storeDirectory.storeDir() );
new CopiedStoreRecovery( Config.defaults(), GraphDatabaseDependencies.newDependencies().kernelExtensions(), pageCache )
.recoverCopiedStore( storeDirectory.storeDir() );
.recoverCopiedStore( storeDirectory.databaseLayout() );
ConsistencyCheckService.Result result = runConsistencyCheckTool( new String[]{storeDir.getAbsolutePath()},
new PrintStream( NULL_OUTPUT_STREAM ), new PrintStream( NULL_OUTPUT_STREAM ) );
if ( !result.isSuccessful() )
Expand Down

0 comments on commit 48abee2

Please sign in to comment.