public void create( RelationshipGroupRecord group ) { group.setCreated(); update( new RelationshipGroupRecord( group.getId(), group.getType() ), group ); }
public static RelationshipGroupCommand createRelationshipGroup( long id, int type ) { RelationshipGroupRecord before = new RelationshipGroupRecord( id ); RelationshipGroupRecord after = new RelationshipGroupRecord( id, type ); after.setInUse( true ); after.setCreated(); return new RelationshipGroupCommand( before, after ); }
@Test public void shouldReadRelationshipGroupCommand() throws Throwable { // Given InMemoryClosableChannel channel = new InMemoryClosableChannel(); RelationshipGroupRecord before = new RelationshipGroupRecord( 42, 3 ); RelationshipGroupRecord after = new RelationshipGroupRecord( 42, 3, 4, 5, 6, 7, 8, true ); after.setCreated(); new Command.RelationshipGroupCommand( before, after ).serialize( channel ); // When PhysicalLogCommandReaderV3_0 reader = new PhysicalLogCommandReaderV3_0(); Command command = reader.read( channel ); assertTrue( command instanceof Command.RelationshipGroupCommand); Command.RelationshipGroupCommand relationshipGroupCommand = (Command.RelationshipGroupCommand) command; // Then assertEquals( before, relationshipGroupCommand.getBefore() ); assertEquals( after, relationshipGroupCommand.getAfter() ); }
RelationshipGroupRecord record = change.forChangingData(); record.setInUse( true ); record.setCreated(); record.setOwningNode( node.getId() );
@Test public void readRelationshipGroupCommandWithNonRequiredSecondaryUnit() throws IOException { // Given InMemoryClosableChannel channel = new InMemoryClosableChannel(); RelationshipGroupRecord before = new RelationshipGroupRecord( 42, 3 ); RelationshipGroupRecord after = new RelationshipGroupRecord( 42, 3, 4, 5, 6, 7, 8, true ); after.setRequiresSecondaryUnit( false ); after.setSecondaryUnitId( 17 ); after.setCreated(); new Command.RelationshipGroupCommand( before, after ).serialize( channel ); // When PhysicalLogCommandReaderV3_0 reader = new PhysicalLogCommandReaderV3_0(); Command command = reader.read( channel ); assertTrue( command instanceof Command.RelationshipGroupCommand); Command.RelationshipGroupCommand relationshipGroupCommand = (Command.RelationshipGroupCommand) command; // Then assertEquals( before, relationshipGroupCommand.getBefore() ); assertEquals( after, relationshipGroupCommand.getAfter() ); verifySecondaryUnit( after, relationshipGroupCommand.getAfter() ); }
@Test public void readRelationshipGroupCommandWithSecondaryUnit() throws IOException { // Given InMemoryClosableChannel channel = new InMemoryClosableChannel(); RelationshipGroupRecord before = new RelationshipGroupRecord( 42, 3 ); RelationshipGroupRecord after = new RelationshipGroupRecord( 42, 3, 4, 5, 6, 7, 8, true ); after.setRequiresSecondaryUnit( true ); after.setSecondaryUnitId( 17 ); after.setCreated(); new Command.RelationshipGroupCommand( before, after ).serialize( channel ); // When PhysicalLogCommandReaderV3_0 reader = new PhysicalLogCommandReaderV3_0(); Command command = reader.read( channel ); assertTrue( command instanceof Command.RelationshipGroupCommand); Command.RelationshipGroupCommand relationshipGroupCommand = (Command.RelationshipGroupCommand) command; // Then assertEquals( before, relationshipGroupCommand.getBefore() ); assertEquals( after, relationshipGroupCommand.getAfter() ); verifySecondaryUnit( after, relationshipGroupCommand.getAfter() ); }
public void create( RelationshipGroupRecord group ) { group.setCreated(); update( group ); }
RelationshipGroupRecord record = change.forChangingData(); record.setInUse( true ); record.setCreated(); record.setOwningNode( node.getId() );