diff --git a/community/lucene-index/src/test/java/org/neo4j/graphdb/LuceneLabelScanStoreIT.java b/community/kernel/src/test/java/org/neo4j/graphdb/LabelScanStoreStartupIT.java similarity index 92% rename from community/lucene-index/src/test/java/org/neo4j/graphdb/LuceneLabelScanStoreIT.java rename to community/kernel/src/test/java/org/neo4j/graphdb/LabelScanStoreStartupIT.java index 7139f207f62be..d5ed832989277 100644 --- a/community/lucene-index/src/test/java/org/neo4j/graphdb/LuceneLabelScanStoreIT.java +++ b/community/kernel/src/test/java/org/neo4j/graphdb/LabelScanStoreStartupIT.java @@ -45,7 +45,7 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; -public class LuceneLabelScanStoreIT +public abstract class LabelScanStoreStartupIT { @Rule public final DatabaseRule dbRule = new EmbeddedDatabaseRule( getClass() ); @@ -54,7 +54,7 @@ public class LuceneLabelScanStoreIT public void scanStoreStartWithoutExistentIndex() throws IOException { NeoStoreDataSource dataSource = getDataSource(); - LabelScanStore labelScanStore = getLabelScanStore(); + LabelScanStore labelScanStore = getLabelScanStore( dbRule ); labelScanStore.shutdown(); File labelScanStoreDirectory = getLabelScanStoreDirectory( dataSource ); @@ -70,7 +70,7 @@ public void scanStoreStartWithoutExistentIndex() throws IOException public void scanStoreRecreateCorruptedIndexOnStartup() throws IOException { NeoStoreDataSource dataSource = getDataSource(); - LabelScanStore labelScanStore = getLabelScanStore(); + LabelScanStore labelScanStore = getLabelScanStore( dbRule ); Node node = createTestNode(); long[] labels = readNodeLabels( labelScanStore, node ); @@ -97,7 +97,7 @@ private long[] readNodeLabels( LabelScanStore labelScanStore, Node node ) private Node createTestNode() { - Node node = null; + Node node; try (Transaction transaction = dbRule.beginTx()) { node = dbRule.createNode( Label.label( "testLabel" )); @@ -132,11 +132,7 @@ private NeoStoreDataSource getDataSource() return dataSourceManager.getDataSource(); } - private LabelScanStore getLabelScanStore() - { - DependencyResolver dependencyResolver = dbRule.getDependencyResolver(); - return dependencyResolver.resolveDependency( LabelScanStore.class ); - } + protected abstract LabelScanStore getLabelScanStore( DatabaseRule dbRule ); private void checkLabelScanStoreAccessible( LabelScanStore labelScanStore ) throws IOException { diff --git a/community/kernel/src/test/java/org/neo4j/graphdb/LabelScanStoreIT.java b/community/kernel/src/test/java/org/neo4j/graphdb/LabelScanStoreUpdateIT.java similarity index 99% rename from community/kernel/src/test/java/org/neo4j/graphdb/LabelScanStoreIT.java rename to community/kernel/src/test/java/org/neo4j/graphdb/LabelScanStoreUpdateIT.java index 4918956b5cea5..d38ba49459f22 100644 --- a/community/kernel/src/test/java/org/neo4j/graphdb/LabelScanStoreIT.java +++ b/community/kernel/src/test/java/org/neo4j/graphdb/LabelScanStoreUpdateIT.java @@ -43,7 +43,7 @@ import static org.neo4j.helpers.collection.Iterators.emptySetOf; import static org.neo4j.helpers.collection.Iterators.single; -public class LabelScanStoreIT +public class LabelScanStoreUpdateIT { @ClassRule public static final DatabaseRule dbRule = new ImpermanentDatabaseRule(); diff --git a/community/lucene-index/src/test/java/org/neo4j/graphdb/LuceneLabelScanStoreStartupIT.java b/community/lucene-index/src/test/java/org/neo4j/graphdb/LuceneLabelScanStoreStartupIT.java new file mode 100644 index 0000000000000..866a8c96c924d --- /dev/null +++ b/community/lucene-index/src/test/java/org/neo4j/graphdb/LuceneLabelScanStoreStartupIT.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-2016 "Neo Technology," + * Network Engine for Objects in Lund AB [http://neotechnology.com] + * + * This file is part of Neo4j. + * + * Neo4j is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.neo4j.graphdb; + +import org.neo4j.kernel.api.impl.labelscan.LuceneLabelScanStore; +import org.neo4j.kernel.api.labelscan.LabelScanStore; +import org.neo4j.test.rule.DatabaseRule; + +import static org.hamcrest.Matchers.instanceOf; +import static org.junit.Assert.assertThat; + +public class LuceneLabelScanStoreStartupIT extends LabelScanStoreStartupIT +{ + @Override + protected LabelScanStore getLabelScanStore( DatabaseRule dbRule ) + { + DependencyResolver dependencyResolver = dbRule.getDependencyResolver(); + LabelScanStore labelScanStore = dependencyResolver.resolveDependency( LabelScanStore.class ); + assertThat( labelScanStore, instanceOf( LuceneLabelScanStore.class ) ); + return labelScanStore; + } +}