use of org.neo4j.kernel.impl.transaction.command.Command.NodeCommand in project neo4j by neo4j.
the class BatchingTransactionAppenderTest method singleCreateNodeCommand.
private Collection<StorageCommand> singleCreateNodeCommand(long id) {
Collection<StorageCommand> commands = new ArrayList<>();
NodeRecord before = new NodeRecord(id);
NodeRecord after = new NodeRecord(id);
after.setInUse(true);
commands.add(new NodeCommand(before, after));
return commands;
}
use of org.neo4j.kernel.impl.transaction.command.Command.NodeCommand in project neo4j by neo4j.
the class ApplyRecoveredTransactionsTest method shouldSetCorrectHighIdWhenApplyingExternalTransactions.
@Test
public void shouldSetCorrectHighIdWhenApplyingExternalTransactions() throws Exception {
// WHEN recovering a transaction that creates some data
long nodeId = neoStores.getNodeStore().nextId();
long relationshipId = neoStores.getRelationshipStore().nextId();
int type = 1;
applyExternalTransaction(1, new NodeCommand(new NodeRecord(nodeId), inUse(created(new NodeRecord(nodeId)))), new RelationshipCommand(null, inUse(created(with(new RelationshipRecord(relationshipId), nodeId, nodeId, type)))));
// and when, later on, recovering a transaction deleting some of those
applyExternalTransaction(2, new NodeCommand(inUse(created(new NodeRecord(nodeId))), new NodeRecord(nodeId)), new RelationshipCommand(null, new RelationshipRecord(relationshipId)));
// THEN that should be possible and the high ids should be correct, i.e. highest applied + 1
assertEquals(nodeId + 1, neoStores.getNodeStore().getHighId());
assertEquals(relationshipId + 1, neoStores.getRelationshipStore().getHighId());
}
use of org.neo4j.kernel.impl.transaction.command.Command.NodeCommand in project neo4j by neo4j.
the class MadeUpServerImplementation method transaction.
private TransactionRepresentation transaction(long txId) {
Collection<StorageCommand> commands = new ArrayList<>();
NodeRecord node = new NodeRecord(txId);
node.setInUse(true);
commands.add(new NodeCommand(new NodeRecord(txId), node));
PhysicalTransactionRepresentation transaction = new PhysicalTransactionRepresentation(commands);
transaction.setHeader(new byte[0], 0, 0, 0, 0, 0, 0);
return transaction;
}
use of org.neo4j.kernel.impl.transaction.command.Command.NodeCommand in project neo4j by neo4j.
the class ProtocolTest method justOneNode.
private Collection<StorageCommand> justOneNode() {
NodeRecord node = new NodeRecord(0);
node.setInUse(true);
return Arrays.<StorageCommand>asList(new NodeCommand(new NodeRecord(node.getId()), node));
}
use of org.neo4j.kernel.impl.transaction.command.Command.NodeCommand in project neo4j by neo4j.
the class IndexBatchTransactionApplierTest method node.
private NodeCommand node(long nodeId) {
NodeRecord after = new NodeRecord(nodeId, true, false, NO_NEXT_RELATIONSHIP.intValue(), NO_NEXT_PROPERTY.intValue(), 0);
NodeLabelsField.parseLabelsField(after).add(1, null, null);
return new NodeCommand(new NodeRecord(nodeId), after);
}
Aggregations