Skip to content

Commit

Permalink
Add test cases to CompositeIndexingIT for schema rules that span more…
Browse files Browse the repository at this point in the history
… than one dynamic record
  • Loading branch information
chrisvest committed Mar 9, 2017
1 parent 9a7dccb commit ab769cd
Showing 1 changed file with 13 additions and 11 deletions.
Expand Up @@ -95,7 +95,7 @@ public void setup() throws Exception
tx.success();
}

try ( Transaction tx = graphDatabaseAPI.beginTx() )
try ( Transaction ignore = graphDatabaseAPI.beginTx() )
{
while ( statement().readOperations().indexGetState( index ) != InternalIndexState.ONLINE )
{
Expand Down Expand Up @@ -137,8 +137,10 @@ public static Iterable<Object[]> parameterValues() throws IOException
return Arrays.asList( Iterators.array( NewIndexDescriptorFactory.forLabel( LABEL_ID, 1 ) ),
Iterators.array( NewIndexDescriptorFactory.forLabel( LABEL_ID, 1, 2 ) ),
Iterators.array( NewIndexDescriptorFactory.forLabel( LABEL_ID, 1, 2, 3, 4 ) ),
Iterators.array( NewIndexDescriptorFactory.forLabel( LABEL_ID, 1, 2, 3, 4, 5, 6, 7 ) ),
Iterators.array( NewIndexDescriptorFactory.uniqueForLabel( LABEL_ID, 1 ) ),
Iterators.array( NewIndexDescriptorFactory.uniqueForLabel( LABEL_ID, 1, 2 ) )
Iterators.array( NewIndexDescriptorFactory.uniqueForLabel( LABEL_ID, 1, 2 ) ),
Iterators.array( NewIndexDescriptorFactory.uniqueForLabel( LABEL_ID, 1, 2, 3, 4, 5, 6, 7 ) )
);
}

Expand All @@ -148,9 +150,9 @@ public CompositeIndexingIT( NewIndexDescriptor nodeDescriptor )
}

@Test
public void shouldSeeNodeAddedByPropertyToIndexInTransation() throws Exception
public void shouldSeeNodeAddedByPropertyToIndexInTranslation() throws Exception
{
try ( Transaction tx = graphDatabaseAPI.beginTx() )
try ( Transaction ignore = graphDatabaseAPI.beginTx() )
{
DataWriteOperations writeOperations = statement().dataWriteOperations();
long nodeID = writeOperations.nodeCreate();
Expand All @@ -168,7 +170,7 @@ public void shouldSeeNodeAddedByPropertyToIndexInTransation() throws Exception
@Test
public void shouldSeeNodeAddedToByLabelIndexInTransaction() throws Exception
{
try ( Transaction tx = graphDatabaseAPI.beginTx() )
try ( Transaction ignore = graphDatabaseAPI.beginTx() )
{
DataWriteOperations writeOperations = statement().dataWriteOperations();
long nodeID = writeOperations.nodeCreate();
Expand All @@ -187,7 +189,7 @@ public void shouldSeeNodeAddedToByLabelIndexInTransaction() throws Exception
public void shouldNotSeeNodeThatWasDeletedInTransaction() throws Exception
{
long nodeID = createNode();
try ( Transaction tx = graphDatabaseAPI.beginTx() )
try ( Transaction ignore = graphDatabaseAPI.beginTx() )
{
statement().dataWriteOperations().nodeDelete( nodeID );
assertFalse( seek().hasNext() );
Expand All @@ -198,7 +200,7 @@ public void shouldNotSeeNodeThatWasDeletedInTransaction() throws Exception
public void shouldNotSeeNodeThatHasItsLabelRemovedInTransaction() throws Exception
{
long nodeID = createNode();
try ( Transaction tx = graphDatabaseAPI.beginTx() )
try ( Transaction ignore = graphDatabaseAPI.beginTx() )
{
statement().dataWriteOperations().nodeRemoveLabel( nodeID, LABEL_ID );
assertFalse( seek().hasNext() );
Expand All @@ -209,7 +211,7 @@ public void shouldNotSeeNodeThatHasItsLabelRemovedInTransaction() throws Excepti
public void shouldNotSeeNodeThatHasAPropertyRemovedInTransaction() throws Exception
{
long nodeID = createNode();
try ( Transaction tx = graphDatabaseAPI.beginTx() )
try ( Transaction ignore = graphDatabaseAPI.beginTx() )
{
statement().dataWriteOperations().nodeRemoveProperty( nodeID, index.schema().getPropertyIds()[0] );
assertFalse( seek().hasNext() );
Expand All @@ -221,7 +223,7 @@ public void shouldSeeAllNodesAddedInTransaction() throws Exception
{
if ( index.type() != UNIQUE ) // this test does not make any sense for UNIQUE indexes
{
try ( Transaction tx = graphDatabaseAPI.beginTx() )
try ( Transaction ignore = graphDatabaseAPI.beginTx() )
{
long nodeID1 = createNode();
long nodeID2 = createNode();
Expand All @@ -241,7 +243,7 @@ public void shouldSeeAllNodesAddedBeforeTransaction() throws Exception
long nodeID1 = createNode();
long nodeID2 = createNode();
long nodeID3 = createNode();
try ( Transaction tx = graphDatabaseAPI.beginTx() )
try ( Transaction ignore = graphDatabaseAPI.beginTx() )
{
PrimitiveLongIterator resultIterator = seek();
Set<Long> result = PrimitiveLongCollections.toSet( resultIterator );
Expand All @@ -254,7 +256,7 @@ public void shouldSeeAllNodesAddedBeforeTransaction() throws Exception
public void shouldNotSeeNodesLackingOneProperty() throws Exception
{
long nodeID1 = createNode();
try ( Transaction tx = graphDatabaseAPI.beginTx() )
try ( Transaction ignore = graphDatabaseAPI.beginTx() )
{
DataWriteOperations writeOperations = statement().dataWriteOperations();
long irrelevantNodeID = writeOperations.nodeCreate();
Expand Down

0 comments on commit ab769cd

Please sign in to comment.