@Override public RelationshipRecord clone() { RelationshipRecord record = new RelationshipRecord( getId() ).initialize( inUse(), nextProp, firstNode, secondNode, type, firstPrevRel, firstNextRel, secondPrevRel, secondNextRel, firstInFirstChain, firstInSecondChain ); record.setSecondaryUnitId( getSecondaryUnitId() ); return record; }
@Test public void readRelationshipCommandWithNonRequiredSecondaryUnit() throws IOException { InMemoryClosableChannel channel = new InMemoryClosableChannel(); RelationshipRecord before = new RelationshipRecord( 42, true, 1, 2, 3, 4, 5, 6, 7, true, true ); before.setRequiresSecondaryUnit( false ); before.setSecondaryUnitId( 52 ); RelationshipRecord after = new RelationshipRecord( 42, true, 1, 8, 3, 4, 5, 6, 7, true, true ); new Command.RelationshipCommand( before, after ).serialize( channel ); PhysicalLogCommandReaderV3_0 reader = new PhysicalLogCommandReaderV3_0(); Command command = reader.read( channel ); assertTrue( command instanceof Command.RelationshipCommand ); Command.RelationshipCommand relationshipCommand = (Command.RelationshipCommand) command; assertEquals( before, relationshipCommand.getBefore() ); verifySecondaryUnit( before, relationshipCommand.getBefore() ); assertEquals( after, relationshipCommand.getAfter() ); }
@Test public void readRelationshipCommandWithSecondaryUnit() throws IOException { InMemoryClosableChannel channel = new InMemoryClosableChannel(); RelationshipRecord before = new RelationshipRecord( 42, true, 1, 2, 3, 4, 5, 6, 7, true, true ); before.setRequiresSecondaryUnit( true ); before.setSecondaryUnitId( 47 ); RelationshipRecord after = new RelationshipRecord( 42, true, 1, 8, 3, 4, 5, 6, 7, true, true ); new Command.RelationshipCommand( before, after ).serialize( channel ); PhysicalLogCommandReaderV3_0 reader = new PhysicalLogCommandReaderV3_0(); Command command = reader.read( channel ); assertTrue( command instanceof Command.RelationshipCommand ); Command.RelationshipCommand relationshipCommand = (Command.RelationshipCommand) command; assertEquals( before, relationshipCommand.getBefore() ); verifySecondaryUnit( before, relationshipCommand.getBefore() ); assertEquals( after, relationshipCommand.getAfter() ); }
if ( hasSecondaryUnit ) record.setSecondaryUnitId( channel.getLong() );
if ( hasSecondaryUnit ) record.setSecondaryUnitId( channel.getLong() );
relationship.setSecondaryUnitId( 12 ); relationship.setRequiresSecondaryUnit( true );
@Override public RelationshipRecord clone() { RelationshipRecord record = new RelationshipRecord( getId() ).initialize( inUse(), nextProp, firstNode, secondNode, type, firstPrevRel, firstNextRel, secondPrevRel, secondNextRel, firstInFirstChain, firstInSecondChain ); record.setSecondaryUnitId( getSecondaryUnitId() ); return record; }
if ( hasSecondaryUnit ) record.setSecondaryUnitId( channel.getLong() );
if ( hasSecondaryUnit ) record.setSecondaryUnitId( channel.getLong() );