use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class CoreReplicatedContentMarshalTest method shouldMarshalTokenRequest.
@Test
public void shouldMarshalTokenRequest() throws Exception {
ByteBuf buffer = Unpooled.buffer();
ArrayList<StorageCommand> commands = new ArrayList<>();
LabelTokenRecord before = new LabelTokenRecord(0);
LabelTokenRecord after = new LabelTokenRecord(0);
after.setInUse(true);
after.setCreated();
after.setNameId(3232);
commands.add(new Command.LabelTokenCommand(before, after));
ReplicatedContent message = new ReplicatedTokenRequest(TokenType.LABEL, "theLabel", ReplicatedTokenRequestSerializer.commandBytes(commands));
assertMarshalingEquality(buffer, message);
}
use of org.neo4j.storageengine.api.StorageCommand 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.storageengine.api.StorageCommand in project neo4j by neo4j.
the class PhysicalLogCommandReadersTest method assertCanReadRelGroup.
private void assertCanReadRelGroup(CommandReader reader) throws IOException {
StorageCommand command = reader.read(channelWithRelGroupRecord());
assertValidRelGroupCommand(command);
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class TransactionRecordStateTest method transaction.
private TransactionRepresentation transaction(TransactionRecordState recordState) throws TransactionFailureException {
List<StorageCommand> commands = new ArrayList<>();
recordState.extractCommands(commands);
PhysicalTransactionRepresentation transaction = new PhysicalTransactionRepresentation(commands);
transaction.setHeader(new byte[0], 0, 0, 0, 0, 0, 0);
return transaction;
}
use of org.neo4j.storageengine.api.StorageCommand in project neo4j by neo4j.
the class TransactionRecordStateTest method shouldPrepareRelevantRecords.
@Test
public void shouldPrepareRelevantRecords() throws Exception {
// GIVEN
PrepareTrackingRecordFormats format = new PrepareTrackingRecordFormats(Standard.LATEST_RECORD_FORMATS);
NeoStores neoStores = neoStoresRule.open(format, GraphDatabaseSettings.dense_node_threshold.name(), "1");
// WHEN
TransactionRecordState state = newTransactionRecordState(neoStores);
state.nodeCreate(0);
state.relCreate(0, 0, 0, 0);
state.relCreate(1, 0, 0, 0);
state.relCreate(2, 0, 0, 0);
List<StorageCommand> commands = new ArrayList<>();
state.extractCommands(commands);
// THEN
int nodes = 0, rels = 0, groups = 0;
for (StorageCommand command : commands) {
if (command instanceof NodeCommand) {
assertTrue(format.node().prepared(((NodeCommand) command).getAfter()));
nodes++;
} else if (command instanceof RelationshipCommand) {
assertTrue(format.relationship().prepared(((RelationshipCommand) command).getAfter()));
rels++;
} else if (command instanceof RelationshipGroupCommand) {
assertTrue(format.relationshipGroup().prepared(((RelationshipGroupCommand) command).getAfter()));
groups++;
}
}
assertEquals(1, nodes);
assertEquals(3, rels);
assertEquals(1, groups);
}
Aggregations