Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
davidegrohmann committed Aug 4, 2015
1 parent ee1ed6f commit 3b57dd2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 41 deletions.
Expand Up @@ -33,7 +33,6 @@
import org.neo4j.io.fs.DefaultFileSystemAbstraction;
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.kernel.GraphDatabaseAPI;
import org.neo4j.kernel.KernelHealth;
import org.neo4j.kernel.api.ReadOperations;
import org.neo4j.kernel.api.direct.DirectStoreAccess;
import org.neo4j.kernel.api.exceptions.TransactionFailureException;
Expand All @@ -59,7 +58,6 @@
import org.neo4j.kernel.impl.transaction.TransactionRepresentation;
import org.neo4j.kernel.impl.transaction.log.TransactionAppender;
import org.neo4j.kernel.impl.transaction.log.TransactionIdStore;
import org.neo4j.kernel.impl.transaction.state.NeoStoreSupplier;
import org.neo4j.kernel.impl.transaction.tracing.CommitEvent;
import org.neo4j.logging.FormattedLogProvider;
import org.neo4j.test.PageCacheRule;
Expand Down Expand Up @@ -353,8 +351,6 @@ protected void applyTransaction( Transaction transaction ) throws TransactionFai
TransactionRepresentationCommitProcess commitProcess =
new TransactionRepresentationCommitProcess(
dependencyResolver.resolveDependency( TransactionAppender.class ),
dependencyResolver.resolveDependency( KernelHealth.class ),
dependencyResolver.resolveDependency( NeoStoreSupplier.class ).get(),
dependencyResolver.resolveDependency( TransactionRepresentationStoreApplier.class ),
dependencyResolver.resolveDependency( IndexUpdatesValidator.class ) );
TransactionIdStore transactionIdStore = database.getDependencyResolver().resolveDependency(
Expand Down
Expand Up @@ -19,15 +19,13 @@
*/
package org.neo4j.kernel.impl.api;

import org.neo4j.kernel.KernelHealth;
import org.neo4j.kernel.api.exceptions.TransactionFailureException;
import org.neo4j.kernel.impl.api.index.IndexUpdatesValidator;
import org.neo4j.kernel.impl.api.index.ValidatedIndexUpdates;
import org.neo4j.kernel.impl.locking.LockGroup;
import org.neo4j.kernel.impl.transaction.TransactionRepresentation;
import org.neo4j.kernel.impl.transaction.log.Commitment;
import org.neo4j.kernel.impl.transaction.log.TransactionAppender;
import org.neo4j.kernel.impl.transaction.log.TransactionIdStore;
import org.neo4j.kernel.impl.transaction.tracing.CommitEvent;
import org.neo4j.kernel.impl.transaction.tracing.LogAppendEvent;
import org.neo4j.kernel.impl.transaction.tracing.StoreApplyEvent;
Expand All @@ -39,25 +37,20 @@
public class TransactionRepresentationCommitProcess implements TransactionCommitProcess
{
private final TransactionAppender appender;
private final KernelHealth kernelHealth;
private final TransactionIdStore transactionIdStore;
private final TransactionRepresentationStoreApplier storeApplier;
private final IndexUpdatesValidator indexUpdatesValidator;

public TransactionRepresentationCommitProcess(TransactionAppender appender, KernelHealth kernelHealth,
TransactionIdStore transactionIdStore, TransactionRepresentationStoreApplier storeApplier,
IndexUpdatesValidator indexUpdatesValidator )
public TransactionRepresentationCommitProcess( TransactionAppender appender,
TransactionRepresentationStoreApplier storeApplier, IndexUpdatesValidator indexUpdatesValidator )
{
this.appender = appender;
this.transactionIdStore = transactionIdStore;
this.kernelHealth = kernelHealth;
this.storeApplier = storeApplier;
this.indexUpdatesValidator = indexUpdatesValidator;
}

@Override
public long commit( TransactionRepresentation transaction, LockGroup locks, CommitEvent commitEvent,
TransactionApplicationMode mode ) throws TransactionFailureException
TransactionApplicationMode mode ) throws TransactionFailureException
{
try ( ValidatedIndexUpdates indexUpdates = validateIndexUpdates( transaction, mode ) )
{
Expand All @@ -68,8 +61,7 @@ public long commit( TransactionRepresentation transaction, LockGroup locks, Comm
}

private ValidatedIndexUpdates validateIndexUpdates( TransactionRepresentation transaction,
TransactionApplicationMode mode)
throws TransactionFailureException
TransactionApplicationMode mode ) throws TransactionFailureException
{
try
{
Expand Down
Expand Up @@ -166,8 +166,7 @@ public TransactionCommitProcess create( TransactionAppender appender,
}
else
{
return new TransactionRepresentationCommitProcess( appender, kernelHealth,
neoStore, storeApplier, indexUpdatesValidator );
return new TransactionRepresentationCommitProcess( appender, storeApplier, indexUpdatesValidator );
}
}
};
Expand Down
Expand Up @@ -136,7 +136,7 @@ public void extractCommands( Collection<Command> commands ) throws TransactionFa
for ( RecordProxy<Integer, LabelTokenRecord, Void> record : context.getLabelTokenRecords().changes() )
{
Command.LabelTokenCommand command = new Command.LabelTokenCommand();
command.init( record.forReadingLinkage() );
command.init( record.forReadingLinkage() );
commands.add( command );
}
for ( RecordProxy<Integer, RelationshipTypeTokenRecord, Void> record : context.getRelationshipTypeTokenRecords().changes() )
Expand All @@ -147,8 +147,7 @@ public void extractCommands( Collection<Command> commands ) throws TransactionFa
}
for ( RecordProxy<Integer, PropertyKeyTokenRecord, Void> record : context.getPropertyKeyTokenRecords().changes() )
{
Command.PropertyKeyTokenCommand command =
new Command.PropertyKeyTokenCommand();
Command.PropertyKeyTokenCommand command = new Command.PropertyKeyTokenCommand();
command.init( record.forReadingLinkage() );
commands.add( command );
}
Expand All @@ -169,7 +168,7 @@ public void extractCommands( Collection<Command> commands ) throws TransactionFa
for ( RecordProxy<Long, RelationshipRecord, Void> record : context.getRelRecords().changes() )
{
Command.RelationshipCommand command = new Command.RelationshipCommand();
command.init( record.forReadingLinkage() );
command.init( record.forReadingLinkage() );
relCommands.add( command );
}
Collections.sort( relCommands, COMMAND_SORTER );
Expand Down
Expand Up @@ -23,7 +23,6 @@

import java.io.IOException;

import org.neo4j.kernel.KernelHealth;
import org.neo4j.kernel.api.exceptions.Status;
import org.neo4j.kernel.api.exceptions.TransactionFailureException;
import org.neo4j.kernel.api.exceptions.index.IndexCapacityExceededException;
Expand Down Expand Up @@ -52,7 +51,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

import static org.neo4j.helpers.Exceptions.contains;
import static org.neo4j.kernel.impl.api.TransactionApplicationMode.INTERNAL;

Expand All @@ -69,11 +67,10 @@ public void shouldNotIncrementLastCommittedTxIdIfAppendFails() throws Exception
IOException rootCause = new IOException( "Mock exception" );
doThrow( new IOException( rootCause ) ).when( appender ).append( any( TransactionRepresentation.class ),
any( LogAppendEvent.class ) );
KernelHealth kernelHealth = mock( KernelHealth.class );
TransactionIdStore transactionIdStore = mock( TransactionIdStore.class );
TransactionRepresentationStoreApplier storeApplier = mock( TransactionRepresentationStoreApplier.class );
TransactionCommitProcess commitProcess = new TransactionRepresentationCommitProcess( appender,
kernelHealth, transactionIdStore, storeApplier, mockedIndexUpdatesValidator() );
TransactionCommitProcess commitProcess = new TransactionRepresentationCommitProcess( appender, storeApplier,
mockedIndexUpdatesValidator() );

// WHEN
try ( LockGroup locks = new LockGroup() )
Expand All @@ -100,12 +97,11 @@ public void shouldCloseTransactionRegardlessOfWhetherOrNotItAppliedCorrectly() t
when( appender.append( any( TransactionRepresentation.class ), any( LogAppendEvent.class ) ) )
.thenReturn( new FakeCommitment( txId, transactionIdStore ) );
IOException rootCause = new IOException( "Mock exception" );
KernelHealth kernelHealth = mock( KernelHealth.class );
TransactionRepresentationStoreApplier storeApplier = mock( TransactionRepresentationStoreApplier.class );
doThrow( new IOException( rootCause ) ).when( storeApplier ).apply( any( TransactionRepresentation.class ),
any( ValidatedIndexUpdates.class ), any( LockGroup.class ), eq( txId ), eq( INTERNAL ) );
TransactionCommitProcess commitProcess = new TransactionRepresentationCommitProcess( appender,
kernelHealth, transactionIdStore, storeApplier, mockedIndexUpdatesValidator() );
TransactionCommitProcess commitProcess = new TransactionRepresentationCommitProcess( appender, storeApplier,
mockedIndexUpdatesValidator() );
TransactionRepresentation transaction = mockedTransaction();

// WHEN
Expand Down Expand Up @@ -135,8 +131,8 @@ public void shouldThrowWhenIndexUpdatesValidationFails() throws IOException
.thenThrow( error );

TransactionRepresentationCommitProcess commitProcess = new TransactionRepresentationCommitProcess(
mock( TransactionAppender.class ), mock( KernelHealth.class ), mock( TransactionIdStore.class ),
mock( TransactionRepresentationStoreApplier.class ), indexUpdatesValidator );
mock( TransactionAppender.class ), mock( TransactionRepresentationStoreApplier.class ),
indexUpdatesValidator );

try ( LockGroup lockGroup = new LockGroup() )
{
Expand Down
Expand Up @@ -50,7 +50,6 @@
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.kernel.DefaultIdGeneratorFactory;
import org.neo4j.kernel.IdType;
import org.neo4j.kernel.KernelHealth;
import org.neo4j.kernel.api.TokenNameLookup;
import org.neo4j.kernel.api.exceptions.TransactionFailureException;
import org.neo4j.kernel.api.index.NodePropertyUpdate;
Expand Down Expand Up @@ -108,6 +107,7 @@
import org.neo4j.test.PageCacheRule;
import org.neo4j.unsafe.batchinsert.LabelScanWriter;

import static java.lang.Integer.parseInt;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand All @@ -126,9 +126,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

import static java.lang.Integer.parseInt;

import static org.neo4j.graphdb.Direction.INCOMING;
import static org.neo4j.graphdb.Direction.OUTGOING;
import static org.neo4j.helpers.collection.Iterables.count;
Expand All @@ -144,8 +141,8 @@
import static org.neo4j.kernel.api.index.SchemaIndexProvider.NO_INDEX_PROVIDER;
import static org.neo4j.kernel.impl.api.TransactionApplicationMode.INTERNAL;
import static org.neo4j.kernel.impl.api.index.TestSchemaIndexProviderDescriptor.PROVIDER_DESCRIPTOR;
import static org.neo4j.kernel.impl.store.record.UniquePropertyConstraintRule.uniquenessConstraintRule;
import static org.neo4j.kernel.impl.store.record.IndexRule.indexRule;
import static org.neo4j.kernel.impl.store.record.UniquePropertyConstraintRule.uniquenessConstraintRule;
import static org.neo4j.kernel.impl.transaction.log.TransactionIdStore.BASE_TX_ID;

public class NeoStoreTransactionTest
Expand Down Expand Up @@ -1497,8 +1494,8 @@ private TransactionRepresentationCommitProcess commitProcess( IndexingService in

PropertyLoader propertyLoader = new PropertyLoader( neoStore );

return new TransactionRepresentationCommitProcess( appenderMock, mock( KernelHealth.class ),
neoStore, applier, new IndexUpdatesValidator( neoStore, null, propertyLoader, indexing ) );
return new TransactionRepresentationCommitProcess( appenderMock, applier,
new IndexUpdatesValidator( neoStore, null, propertyLoader, indexing ) );
}

@After
Expand Down
Expand Up @@ -612,8 +612,8 @@ public TransactionCommitProcess create( TransactionAppender appender,
}
else
{
TransactionCommitProcess inner = new TransactionRepresentationCommitProcess( appender, kernelHealth,
neoStore, storeApplier, indexUpdatesValidator );
TransactionCommitProcess inner = new TransactionRepresentationCommitProcess( appender, storeApplier,
indexUpdatesValidator );
new CommitProcessSwitcher( pusher, master, commitProcessDelegate, requestContextFactory,
memberStateMachine, txValidator, inner );

Expand Down

0 comments on commit 3b57dd2

Please sign in to comment.