Skip to content

Commit

Permalink
Remove different Unique and NonUnique implementations of StringLayout…
Browse files Browse the repository at this point in the history
…TestUtil and NumberLayoutTestUtil

Instead when needing unique layout, wrap layout in UniqueLayoutTestUtil like we do for temporal layouts.
  • Loading branch information
burqen committed Oct 3, 2018
1 parent 46ea5b6 commit 74b7bc8
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 184 deletions.
Expand Up @@ -51,11 +51,11 @@ public static Collection<Object[]> data()
return Arrays.asList( new Object[][]{
{"Number",
numberAccessorFactory(),
(LayoutTestUtilFactory) NumberNonUniqueLayoutTestUtil::new
(LayoutTestUtilFactory) () -> new NumberLayoutTestUtil( descriptor )
},
{"String",
stringAccessorFactory(),
(LayoutTestUtilFactory) StringNonUniqueLayoutTestUtil::new
(LayoutTestUtilFactory) () -> new StringLayoutTestUtil( descriptor )
},
{"Date",
temporalAccessorFactory( ValueGroup.DATE ),
Expand Down
Expand Up @@ -26,11 +26,11 @@ public static Collection<Object[]> data()
return Arrays.asList( new Object[][]{
{"Number",
numberPopulatorFactory(),
(LayoutTestUtilFactory) NumberUniqueLayoutTestUtil::new
(LayoutTestUtilFactory) () -> new UniqueLayoutTestUtil<>( new NumberLayoutTestUtil( descriptor ) )
},
{"String",
(PopulatorFactory) StringIndexPopulator::new,
(LayoutTestUtilFactory) StringUniqueLayoutTestUtil::new
(LayoutTestUtilFactory) () -> new UniqueLayoutTestUtil<>( new StringLayoutTestUtil( descriptor ) )
},
{"Date",
temporalPopulatorFactory( ValueGroup.DATE ),
Expand Down
Expand Up @@ -26,6 +26,7 @@
import org.neo4j.index.internal.gbptree.GBPTree;
import org.neo4j.index.internal.gbptree.Writer;
import org.neo4j.io.pagecache.IOLimiter;
import org.neo4j.kernel.api.schema.index.TestIndexDescriptorFactory;
import org.neo4j.storageengine.api.schema.IndexSample;
import org.neo4j.values.storable.NumberValue;
import org.neo4j.values.storable.RandomValues;
Expand Down Expand Up @@ -97,6 +98,6 @@ private void buildTree( Value[] values ) throws IOException
@Override
protected LayoutTestUtil<NumberIndexKey,NativeIndexValue> createLayoutTestUtil()
{
return new NumberNonUniqueLayoutTestUtil();
return new NumberLayoutTestUtil( TestIndexDescriptorFactory.forLabel( 42, 666 ) );
}
}
Expand Up @@ -26,7 +26,7 @@
import org.neo4j.values.storable.RandomValues;
import org.neo4j.values.storable.ValueGroup;

abstract class NumberLayoutTestUtil extends LayoutTestUtil<NumberIndexKey,NativeIndexValue>
class NumberLayoutTestUtil extends LayoutTestUtil<NumberIndexKey,NativeIndexValue>
{
private static final Number[] ALL_EXTREME_VALUES = new Number[]
{
Expand Down Expand Up @@ -55,6 +55,18 @@ abstract class NumberLayoutTestUtil extends LayoutTestUtil<NumberIndexKey,Native
super( indexDescriptor.withId( 0 ) );
}

@Override
IndexLayout<NumberIndexKey,NativeIndexValue> createLayout()
{
return new NumberLayoutNonUnique();
}

@Override
IndexEntryUpdate<IndexDescriptor>[] someUpdates()
{
return someUpdatesWithDuplicateValues();
}

@Override
RandomValues.Type[] supportedTypes()
{
Expand Down
Expand Up @@ -19,6 +19,8 @@
*/
package org.neo4j.kernel.impl.index.schema;

import org.neo4j.kernel.api.schema.index.TestIndexDescriptorFactory;

public class NumberNonUniqueIndexPopulatorTest extends NativeNonUniqueIndexPopulatorTest<NumberIndexKey,NativeIndexValue>
{
@Override
Expand All @@ -30,6 +32,6 @@ NativeIndexPopulator<NumberIndexKey,NativeIndexValue> createPopulator()
@Override
protected LayoutTestUtil<NumberIndexKey,NativeIndexValue> createLayoutTestUtil()
{
return new NumberNonUniqueLayoutTestUtil();
return new NumberLayoutTestUtil( TestIndexDescriptorFactory.forLabel( 42, 666 ) );
}
}

This file was deleted.

This file was deleted.

Expand Up @@ -19,6 +19,8 @@
*/
package org.neo4j.kernel.impl.index.schema;

import org.neo4j.kernel.api.schema.index.TestIndexDescriptorFactory;

public class StringNonUniqueIndexPopulatorTest extends NativeNonUniqueIndexPopulatorTest<StringIndexKey,NativeIndexValue>
{
@Override
Expand All @@ -30,6 +32,6 @@ NativeIndexPopulator<StringIndexKey,NativeIndexValue> createPopulator()
@Override
protected LayoutTestUtil<StringIndexKey,NativeIndexValue> createLayoutTestUtil()
{
return new StringNonUniqueLayoutTestUtil();
return new StringLayoutTestUtil( TestIndexDescriptorFactory.forLabel( 42, 666 ) );
}
}

This file was deleted.

This file was deleted.

0 comments on commit 74b7bc8

Please sign in to comment.