From 81e91ba916da2af06ca3a39d92128b15873264fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Finn=C3=A9?= Date: Tue, 30 Jan 2018 16:18:14 +0100 Subject: [PATCH] String IndexPopulator tests working --- .../impl/index/schema/LayoutTestUtil.java | 2 +- ...tiveNonUniqueSchemaIndexPopulatorTest.java | 109 ++++++++++++++++ .../schema/NativeSchemaIndexAccessorTest.java | 10 +- .../NativeUniqueSchemaIndexPopulatorTest.java | 116 ++++++++++++++++++ ...mberNonUniqueSchemaIndexPopulatorTest.java | 79 +----------- .../NumberUniqueSchemaIndexPopulatorTest.java | 92 +------------- .../index/schema/StringLayoutTestUtil.java | 2 +- ...ringNonUniqueSchemaIndexPopulatorTest.java | 43 +++++++ .../schema/StringUniqueLayoutTestUtil.java | 2 +- .../StringUniqueSchemaIndexPopulatorTest.java | 43 +++++++ 10 files changed, 321 insertions(+), 177 deletions(-) create mode 100644 community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NativeNonUniqueSchemaIndexPopulatorTest.java create mode 100644 community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NativeUniqueSchemaIndexPopulatorTest.java create mode 100644 community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringNonUniqueSchemaIndexPopulatorTest.java create mode 100644 community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringUniqueSchemaIndexPopulatorTest.java diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/LayoutTestUtil.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/LayoutTestUtil.java index 01fe1e5d231fa..2f18f879adbef 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/LayoutTestUtil.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/LayoutTestUtil.java @@ -160,7 +160,7 @@ static int countUniqueValues( IndexEntryUpdate[] updates ) return Stream.of( updates ).map( update -> update.values()[0] ).collect( Collectors.toSet() ).size(); } - static int countUniqueValues( Number[] updates ) + static int countUniqueValues( Object[] updates ) { return Stream.of( updates ).collect( Collectors.toSet() ).size(); } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NativeNonUniqueSchemaIndexPopulatorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NativeNonUniqueSchemaIndexPopulatorTest.java new file mode 100644 index 0000000000000..fcd2a95536bef --- /dev/null +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NativeNonUniqueSchemaIndexPopulatorTest.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2002-2018 "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.kernel.impl.index.schema; + +import org.junit.Test; + +import java.util.Arrays; +import java.util.Iterator; + +import org.neo4j.kernel.api.index.IndexEntryUpdate; +import org.neo4j.kernel.api.index.IndexUpdater; +import org.neo4j.kernel.api.schema.index.IndexDescriptor; +import org.neo4j.storageengine.api.schema.IndexSample; +import org.neo4j.values.storable.Values; + +import static org.junit.Assert.assertEquals; + +import static org.neo4j.kernel.impl.index.schema.LayoutTestUtil.countUniqueValues; + +public abstract class NativeNonUniqueSchemaIndexPopulatorTest + extends NativeSchemaIndexPopulatorTest +{ + @Test + public void addShouldApplyDuplicateValues() throws Exception + { + // given + populator.create(); + IndexEntryUpdate[] updates = layoutUtil.someUpdatesWithDuplicateValues(); + + // when + populator.add( Arrays.asList( updates ) ); + + // then + populator.close( true ); + verifyUpdates( updates ); + } + + @Test + public void updaterShouldApplyDuplicateValues() throws Exception + { + // given + populator.create(); + IndexEntryUpdate[] updates = layoutUtil.someUpdatesWithDuplicateValues(); + try ( IndexUpdater updater = populator.newPopulatingUpdater( null_property_accessor ) ) + { + // when + for ( IndexEntryUpdate update : updates ) + { + updater.process( update ); + } + } + + // then + populator.close( true ); + verifyUpdates( updates ); + } + + @Test + public void shouldSampleUpdatesIfConfiguredForOnlineSampling() throws Exception + { + // GIVEN + populator.create(); + IndexEntryUpdate[] scanUpdates = layoutUtil.someUpdates(); + populator.add( Arrays.asList( scanUpdates ) ); + Iterator> generator = layoutUtil.randomUpdateGenerator( random ); + Object[] updates = new Object[5]; + updates[0] = generator.next().values()[0].asObject(); + updates[1] = generator.next().values()[0].asObject(); + updates[2] = updates[1]; + updates[3] = generator.next().values()[0].asObject(); + updates[4] = updates[3]; + try ( IndexUpdater updater = populator.newPopulatingUpdater( null_property_accessor ) ) + { + long nodeId = 1000; + for ( Object value : updates ) + { + IndexEntryUpdate update = layoutUtil.add( nodeId++, Values.of( value ) ); + updater.process( update ); + populator.includeSample( update ); + } + } + + // WHEN + IndexSample sample = populator.sampleResult(); + + // THEN + assertEquals( updates.length, sample.sampleSize() ); + assertEquals( countUniqueValues( updates ), sample.uniqueValues() ); + assertEquals( updates.length, sample.indexSize() ); + populator.close( true ); + } +} diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NativeSchemaIndexAccessorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NativeSchemaIndexAccessorTest.java index 674df1088b300..b0581cbaac53e 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NativeSchemaIndexAccessorTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NativeSchemaIndexAccessorTest.java @@ -347,7 +347,7 @@ public void shouldReturnNoEntriesForMismatchingExactPredicate() throws Exception public void shouldReturnMatchingEntriesForRangePredicateWithInclusiveStartAndExclusiveEnd() throws Exception { // given - IndexEntryUpdate[] updates = layoutUtil.someUpdates(); + IndexEntryUpdate[] updates = layoutUtil.someUpdatesNoDuplicateValues(); processAll( updates ); layoutUtil.sort( updates ); @@ -362,7 +362,7 @@ public void shouldReturnMatchingEntriesForRangePredicateWithInclusiveStartAndExc public void shouldReturnMatchingEntriesForRangePredicateWithInclusiveStartAndInclusiveEnd() throws Exception { // given - IndexEntryUpdate[] updates = layoutUtil.someUpdates(); + IndexEntryUpdate[] updates = layoutUtil.someUpdatesNoDuplicateValues(); processAll( updates ); layoutUtil.sort( updates ); @@ -377,7 +377,7 @@ public void shouldReturnMatchingEntriesForRangePredicateWithInclusiveStartAndInc public void shouldReturnMatchingEntriesForRangePredicateWithExclusiveStartAndExclusiveEnd() throws Exception { // given - IndexEntryUpdate[] updates = layoutUtil.someUpdates(); + IndexEntryUpdate[] updates = layoutUtil.someUpdatesNoDuplicateValues(); processAll( updates ); layoutUtil.sort( updates ); @@ -392,7 +392,7 @@ public void shouldReturnMatchingEntriesForRangePredicateWithExclusiveStartAndExc public void shouldReturnMatchingEntriesForRangePredicateWithExclusiveStartAndInclusiveEnd() throws Exception { // given - IndexEntryUpdate[] updates = layoutUtil.someUpdates(); + IndexEntryUpdate[] updates = layoutUtil.someUpdatesNoDuplicateValues(); processAll( updates ); layoutUtil.sort( updates ); @@ -688,7 +688,7 @@ public void shouldSeeNoEntriesInAllEntriesReaderOnEmptyIndex() public void shouldNotSeeFilteredEntries() throws Exception { // given - IndexEntryUpdate[] updates = layoutUtil.someUpdates(); + IndexEntryUpdate[] updates = layoutUtil.someUpdatesNoDuplicateValues(); processAll( updates ); layoutUtil.sort( updates ); IndexReader reader = accessor.newReader(); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NativeUniqueSchemaIndexPopulatorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NativeUniqueSchemaIndexPopulatorTest.java new file mode 100644 index 0000000000000..82058db2e6041 --- /dev/null +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NativeUniqueSchemaIndexPopulatorTest.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2002-2018 "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.kernel.impl.index.schema; + +import org.junit.Test; + +import java.util.Arrays; + +import org.neo4j.helpers.Exceptions; +import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException; +import org.neo4j.kernel.api.index.IndexEntryUpdate; +import org.neo4j.kernel.api.index.IndexUpdater; +import org.neo4j.kernel.api.schema.index.IndexDescriptor; +import org.neo4j.storageengine.api.schema.IndexSample; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import static java.util.Arrays.asList; + +public abstract class NativeUniqueSchemaIndexPopulatorTest + extends NativeSchemaIndexPopulatorTest +{ + @Test + public void addShouldThrowOnDuplicateValues() throws Exception + { + // given + populator.create(); + IndexEntryUpdate[] updates = layoutUtil.someUpdatesWithDuplicateValues(); + + // when + try + { + populator.add( Arrays.asList( updates ) ); + fail( "Updates should have conflicted" ); + } + catch ( Exception e ) + { + // then + assertTrue( Exceptions.contains( e, IndexEntryConflictException.class ) ); + } + finally + { + populator.close( true ); + } + } + + @Test + public void updaterShouldThrowOnDuplicateValues() throws Exception + { + // given + populator.create(); + IndexEntryUpdate[] updates = layoutUtil.someUpdatesWithDuplicateValues(); + IndexUpdater updater = populator.newPopulatingUpdater( null_property_accessor ); + + // when + for ( IndexEntryUpdate update : updates ) + { + updater.process( update ); + } + try + { + updater.close(); + fail( "Updates should have conflicted" ); + } + catch ( Exception e ) + { + // then + assertTrue( e.getMessage(), Exceptions.contains( e, IndexEntryConflictException.class ) ); + } + finally + { + populator.close( true ); + } + } + + @Test + public void shouldSampleUpdates() throws Exception + { + // GIVEN + populator.create(); + IndexEntryUpdate[] updates = layoutUtil.someUpdates(); + + // WHEN + populator.add( asList( updates ) ); + for ( IndexEntryUpdate update : updates ) + { + populator.includeSample( update ); + } + IndexSample sample = populator.sampleResult(); + + // THEN + assertEquals( updates.length, sample.sampleSize() ); + assertEquals( updates.length, sample.uniqueValues() ); + assertEquals( updates.length, sample.indexSize() ); + populator.close( true ); + } +} diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NumberNonUniqueSchemaIndexPopulatorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NumberNonUniqueSchemaIndexPopulatorTest.java index 7895755d4c672..f91d03dafb564 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NumberNonUniqueSchemaIndexPopulatorTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NumberNonUniqueSchemaIndexPopulatorTest.java @@ -19,26 +19,13 @@ */ package org.neo4j.kernel.impl.index.schema; -import org.junit.Test; - import java.io.File; -import java.util.Arrays; - import org.neo4j.index.internal.gbptree.Layout; import org.neo4j.io.fs.FileSystemAbstraction; import org.neo4j.io.pagecache.PageCache; -import org.neo4j.kernel.api.index.IndexEntryUpdate; -import org.neo4j.kernel.api.index.IndexUpdater; -import org.neo4j.kernel.api.schema.index.IndexDescriptor; import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig; -import org.neo4j.storageengine.api.schema.IndexSample; -import org.neo4j.values.storable.Values; - -import static org.junit.Assert.assertEquals; -import static org.neo4j.helpers.ArrayUtil.array; -import static org.neo4j.kernel.impl.index.schema.LayoutTestUtil.countUniqueValues; -public class NumberNonUniqueSchemaIndexPopulatorTest extends NativeSchemaIndexPopulatorTest +public class NumberNonUniqueSchemaIndexPopulatorTest extends NativeNonUniqueSchemaIndexPopulatorTest { @Override NativeSchemaIndexPopulator createPopulator( PageCache pageCache, FileSystemAbstraction fs, @@ -48,70 +35,6 @@ NativeSchemaIndexPopulator createPopulator( P indexId ); } - @Test - public void addShouldApplyDuplicateValues() throws Exception - { - // given - populator.create(); - IndexEntryUpdate[] updates = layoutUtil.someUpdatesWithDuplicateValues(); - - // when - populator.add( Arrays.asList( updates ) ); - - // then - populator.close( true ); - verifyUpdates( updates ); - } - - @Test - public void updaterShouldApplyDuplicateValues() throws Exception - { - // given - populator.create(); - IndexEntryUpdate[] updates = layoutUtil.someUpdatesWithDuplicateValues(); - try ( IndexUpdater updater = populator.newPopulatingUpdater( null_property_accessor ) ) - { - // when - for ( IndexEntryUpdate update : updates ) - { - updater.process( update ); - } - } - - // then - populator.close( true ); - verifyUpdates( updates ); - } - - @Test - public void shouldSampleUpdatesIfConfiguredForOnlineSampling() throws Exception - { - // GIVEN - populator.create(); - IndexEntryUpdate[] scanUpdates = layoutUtil.someUpdates(); - populator.add( Arrays.asList( scanUpdates ) ); - Number[] updates = array( 101, 102, 102, 103, 103 ); - try ( IndexUpdater updater = populator.newPopulatingUpdater( null_property_accessor ) ) - { - long nodeId = 1000; - for ( Number number : updates ) - { - IndexEntryUpdate update = layoutUtil.add( nodeId++, Values.of( number ) ); - updater.process( update ); - populator.includeSample( update ); - } - } - - // WHEN - IndexSample sample = populator.sampleResult(); - - // THEN - assertEquals( updates.length, sample.sampleSize() ); - assertEquals( countUniqueValues( updates ), sample.uniqueValues() ); - assertEquals( updates.length, sample.indexSize() ); - populator.close( true ); - } - @Override protected LayoutTestUtil createLayoutTestUtil() { diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NumberUniqueSchemaIndexPopulatorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NumberUniqueSchemaIndexPopulatorTest.java index ef60da8095929..22a95cf1c25d5 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NumberUniqueSchemaIndexPopulatorTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/NumberUniqueSchemaIndexPopulatorTest.java @@ -19,28 +19,13 @@ */ package org.neo4j.kernel.impl.index.schema; -import org.junit.Test; - import java.io.File; -import java.util.Arrays; - -import org.neo4j.helpers.Exceptions; import org.neo4j.index.internal.gbptree.Layout; import org.neo4j.io.fs.FileSystemAbstraction; import org.neo4j.io.pagecache.PageCache; -import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException; -import org.neo4j.kernel.api.index.IndexEntryUpdate; -import org.neo4j.kernel.api.index.IndexUpdater; -import org.neo4j.kernel.api.schema.index.IndexDescriptor; import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig; -import org.neo4j.storageengine.api.schema.IndexSample; -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -public class NumberUniqueSchemaIndexPopulatorTest extends NativeSchemaIndexPopulatorTest +public class NumberUniqueSchemaIndexPopulatorTest extends NativeUniqueSchemaIndexPopulatorTest { @Override NativeSchemaIndexPopulator createPopulator( @@ -55,79 +40,4 @@ protected LayoutTestUtil createLayoutTestUtil { return new NumberUniqueLayoutTestUtil(); } - - @Test - public void addShouldThrowOnDuplicateValues() throws Exception - { - // given - populator.create(); - IndexEntryUpdate[] updates = layoutUtil.someUpdatesWithDuplicateValues(); - - // when - try - { - populator.add( Arrays.asList( updates ) ); - fail( "Updates should have conflicted" ); - } - catch ( Throwable e ) - { - // then - assertTrue( Exceptions.contains( e, IndexEntryConflictException.class ) ); - } - finally - { - populator.close( true ); - } - } - - @Test - public void updaterShouldThrowOnDuplicateValues() throws Exception - { - // given - populator.create(); - IndexEntryUpdate[] updates = layoutUtil.someUpdatesWithDuplicateValues(); - IndexUpdater updater = populator.newPopulatingUpdater( null_property_accessor ); - - // when - for ( IndexEntryUpdate update : updates ) - { - updater.process( update ); - } - try - { - updater.close(); - fail( "Updates should have conflicted" ); - } - catch ( Throwable e ) - { - // then - assertTrue( e.getMessage(), Exceptions.contains( e, IndexEntryConflictException.class ) ); - } - finally - { - populator.close( true ); - } - } - - @Test - public void shouldSampleUpdates() throws Exception - { - // GIVEN - populator.create(); - IndexEntryUpdate[] updates = layoutUtil.someUpdates(); - - // WHEN - populator.add( asList( updates ) ); - for ( IndexEntryUpdate update : updates ) - { - populator.includeSample( update ); - } - IndexSample sample = populator.sampleResult(); - - // THEN - assertEquals( updates.length, sample.sampleSize() ); - assertEquals( updates.length, sample.uniqueValues() ); - assertEquals( updates.length, sample.indexSize() ); - populator.close( true ); - } } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringLayoutTestUtil.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringLayoutTestUtil.java index b3aba8d22d125..086c177a211b0 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringLayoutTestUtil.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringLayoutTestUtil.java @@ -73,7 +73,7 @@ IndexEntryUpdate[] someUpdatesWithDuplicateValues() { Collection duplicates = new ArrayList<>( asList( STRINGS ) ); duplicates.addAll( asList( STRINGS ) ); - return generateAddUpdatesFor( STRINGS ); + return generateAddUpdatesFor( duplicates.toArray() ); } @Override diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringNonUniqueSchemaIndexPopulatorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringNonUniqueSchemaIndexPopulatorTest.java new file mode 100644 index 0000000000000..2bc0f0c0d1c79 --- /dev/null +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringNonUniqueSchemaIndexPopulatorTest.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2018 "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.kernel.impl.index.schema; + +import java.io.File; +import org.neo4j.index.internal.gbptree.Layout; +import org.neo4j.io.fs.FileSystemAbstraction; +import org.neo4j.io.pagecache.PageCache; +import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig; + +public class StringNonUniqueSchemaIndexPopulatorTest extends NativeNonUniqueSchemaIndexPopulatorTest +{ + @Override + NativeSchemaIndexPopulator createPopulator( PageCache pageCache, FileSystemAbstraction fs, + File indexFile, Layout layout, IndexSamplingConfig samplingConfig ) + { + return new NativeNonUniqueSchemaIndexPopulator<>( pageCache, fs, indexFile, layout, samplingConfig, monitor, indexDescriptor, + indexId ); + } + + @Override + protected LayoutTestUtil createLayoutTestUtil() + { + return new StringNonUniqueLayoutTestUtil(); + } +} diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringUniqueLayoutTestUtil.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringUniqueLayoutTestUtil.java index 24a8b9b31cdb9..771c3df05fe1d 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringUniqueLayoutTestUtil.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringUniqueLayoutTestUtil.java @@ -34,7 +34,7 @@ class StringUniqueLayoutTestUtil extends StringLayoutTestUtil @Override Layout createLayout() { - return new StringLayoutNonUnique(); + return new StringLayoutUnique(); } @Override diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringUniqueSchemaIndexPopulatorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringUniqueSchemaIndexPopulatorTest.java new file mode 100644 index 0000000000000..df1de3a9555b4 --- /dev/null +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/index/schema/StringUniqueSchemaIndexPopulatorTest.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2002-2018 "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.kernel.impl.index.schema; + +import java.io.File; +import org.neo4j.index.internal.gbptree.Layout; +import org.neo4j.io.fs.FileSystemAbstraction; +import org.neo4j.io.pagecache.PageCache; +import org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig; + +public class StringUniqueSchemaIndexPopulatorTest extends NativeUniqueSchemaIndexPopulatorTest +{ + @Override + NativeSchemaIndexPopulator createPopulator( + PageCache pageCache, FileSystemAbstraction fs, File indexFile, + Layout layout, IndexSamplingConfig samplingConfig ) + { + return new NativeUniqueSchemaIndexPopulator<>( pageCache, fs, indexFile, layout, monitor, indexDescriptor, indexId ); + } + + @Override + protected LayoutTestUtil createLayoutTestUtil() + { + return new StringUniqueLayoutTestUtil(); + } +}