diff --git a/community/consistency-check/src/test/java/org/neo4j/consistency/checking/GraphStoreFixture.java b/community/consistency-check/src/test/java/org/neo4j/consistency/checking/GraphStoreFixture.java index 1b20f7ad64f7e..ccb44dfa5425b 100644 --- a/community/consistency-check/src/test/java/org/neo4j/consistency/checking/GraphStoreFixture.java +++ b/community/consistency-check/src/test/java/org/neo4j/consistency/checking/GraphStoreFixture.java @@ -34,6 +34,7 @@ import org.neo4j.graphdb.DependencyResolver; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.factory.GraphDatabaseBuilder; +import org.neo4j.graphdb.factory.GraphDatabaseSettings; import org.neo4j.index.lucene.LuceneLabelScanStoreBuilder; import org.neo4j.io.fs.DefaultFileSystemAbstraction; import org.neo4j.io.fs.FileSystemAbstraction; @@ -432,7 +433,12 @@ protected void applyTransaction( Transaction transaction ) throws TransactionFai private void generateInitialData() { GraphDatabaseBuilder builder = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder( directory ); - GraphDatabaseAPI graphDb = (GraphDatabaseAPI) builder.newGraphDatabase(); + GraphDatabaseAPI graphDb = (GraphDatabaseAPI) builder + // Some tests using this fixture were written when the label_block_size was 60 and so hardcoded + // tests and records around that. Those tests could change, but the simpler option is to just + // keep the block size to 60 and let them be. + .setConfig( GraphDatabaseSettings.label_block_size, "60" ) + .newGraphDatabase(); try { generateInitialData( graphDb ); diff --git a/community/consistency-check/src/test/java/org/neo4j/consistency/checking/full/NodeInUseWithCorrectLabelsCheckTest.java b/community/consistency-check/src/test/java/org/neo4j/consistency/checking/full/NodeInUseWithCorrectLabelsCheckTest.java index 9b1a9f299660c..1b748ff89e517 100644 --- a/community/consistency-check/src/test/java/org/neo4j/consistency/checking/full/NodeInUseWithCorrectLabelsCheckTest.java +++ b/community/consistency-check/src/test/java/org/neo4j/consistency/checking/full/NodeInUseWithCorrectLabelsCheckTest.java @@ -152,7 +152,6 @@ private NodeRecord withDynamicLabels( RecordAccessStub recordAccess, NodeRecord return nodeRecord; } - @SuppressWarnings("unchecked") private Engine engineFor( ConsistencyReport.LabelScanConsistencyReport report ) { Engine engine = mock( Engine.class ); @@ -162,7 +161,7 @@ private Engine engineFor( ConsistencyReport.LabelScanConsistencyReport report ) private NodeInUseWithCorrectLabelsCheck checker( long[] expectedLabels ) { - return new NodeInUseWithCorrectLabelsCheck( expectedLabels ); + return new NodeInUseWithCorrectLabelsCheck<>( expectedLabels ); } interface Engine extends CheckerEngine diff --git a/community/neo4j/src/test/java/db/DatabaseStartupTest.java b/community/neo4j/src/test/java/db/DatabaseStartupTest.java index 81b1b2288a7a3..785334bb6849f 100644 --- a/community/neo4j/src/test/java/db/DatabaseStartupTest.java +++ b/community/neo4j/src/test/java/db/DatabaseStartupTest.java @@ -101,10 +101,11 @@ public void startTheDatabaseWithWrongVersionShouldFailAlsoWhenUpgradeIsAllowed() db.shutdown(); // mess up the version in the metadatastore - try ( PageCache pageCache = StandalonePageCacheFactory.createPageCache( new DefaultFileSystemAbstraction() )) + String badStoreVersion = "bad"; + try ( PageCache pageCache = StandalonePageCacheFactory.createPageCache( new DefaultFileSystemAbstraction() ) ) { MetaDataStore.setRecord( pageCache, new File(storeDir, MetaDataStore.DEFAULT_NAME ), - MetaDataStore.Position.STORE_VERSION, MetaDataStore.versionStringToLong( "bad" )); + MetaDataStore.Position.STORE_VERSION, MetaDataStore.versionStringToLong( badStoreVersion ) ); } // when @@ -120,7 +121,7 @@ public void startTheDatabaseWithWrongVersionShouldFailAlsoWhenUpgradeIsAllowed() assertTrue( ex.getCause() instanceof LifecycleException ); assertTrue( ex.getCause().getCause() instanceof StoreUpgrader.UnexpectedUpgradingStoreVersionException ); assertThat( ex.getCause().getCause().getMessage(), - containsString( "has a store version number that we cannot upgrade from." ) ); + containsString( "has a store version '" + badStoreVersion + "' that we cannot upgrade from." ) ); } } } diff --git a/community/server/src/test/java/org/neo4j/server/helpers/CommunityServerBuilder.java b/community/server/src/test/java/org/neo4j/server/helpers/CommunityServerBuilder.java index 47ba3e0c07e5b..0d1543d9a93f0 100644 --- a/community/server/src/test/java/org/neo4j/server/helpers/CommunityServerBuilder.java +++ b/community/server/src/test/java/org/neo4j/server/helpers/CommunityServerBuilder.java @@ -77,7 +77,7 @@ public class CommunityServerBuilder protected Clock clock = null; private String[] autoIndexedNodeKeys = null; - private String[] autoIndexedRelationshipKeys = null; + private final String[] autoIndexedRelationshipKeys = null; private String host = null; private String[] securityRuleClassNames; public boolean persistent; @@ -117,7 +117,7 @@ protected CommunityNeoServer build( File configFile, Config config, public File createConfigFiles() throws IOException { File temporaryConfigFile = ServerTestUtils.createTempConfigFile(); - File temporaryFolder = temporaryConfigFile.getParentFile(); + File temporaryFolder = ServerTestUtils.createTempDir(); ServerTestUtils.writeConfigToFile( createConfiguration( temporaryFolder ), temporaryConfigFile );