@Override public PropertyRecord newRecord() { return new PropertyRecord( -1 ); }
@Override public PropertyRecord newUnused( long key, PrimitiveRecord additionalData ) { PropertyRecord record = new PropertyRecord( key ); setOwner( record, additionalData ); return andMarkAsCreated( record ); }
@Test void shouldAllowSkipAfterCheckDiffReference() { // given referenceCheck.checkDiffReference( new PropertyRecord( 0 ), new PropertyRecord( 0 ), null ); // when referenceCheck.skip(); }
@Test void shouldNotAllowCheckReferenceAfterCheckDiffReference() { // given referenceCheck.checkDiffReference( new PropertyRecord( 0 ), new PropertyRecord( 0 ), null ); // when IllegalStateException exception = assertThrows( IllegalStateException.class, () -> referenceCheck.checkReference( new PropertyRecord( 0 ), null ) ); assertEquals( "Reference has already been checked.", exception.getMessage() ); }
@Override protected PropertyRecord createNullRecord( long id ) { PropertyRecord record = new PropertyRecord( id ); record.setNextProp( 0 ); record.setPrevProp( 0 ); return record; }
@Test void shouldNotAllowCheckDiffReferenceAfterSkip() { // given referenceCheck.skip(); // when IllegalStateException exception = assertThrows( IllegalStateException.class, () -> referenceCheck.checkDiffReference( new PropertyRecord( 0 ), new PropertyRecord( 0 ), null ) ); assertEquals( "Reference has already been checked.", exception.getMessage() ); }
@Test void shouldNotAllowCheckReferenceAfterCheckReference() { // given referenceCheck.checkReference( new PropertyRecord( 0 ), null ); // when IllegalStateException exception = assertThrows( IllegalStateException.class, () -> referenceCheck.checkReference( new PropertyRecord( 0 ), null ) ); assertEquals( "Reference has already been checked.", exception.getMessage() ); }
@Test void shouldNotReportAnythingForPropertyRecordNotInUse() { // given PropertyRecord property = notInUse( new PropertyRecord( 42 ) ); // when ConsistencyReport.PropertyConsistencyReport report = check( property ); // then verifyNoMoreInteractions( report ); }
@Test void shouldNotReportAnythingForPropertyWithoutBlocksThatDoesNotReferenceAnyOtherRecords() { // given PropertyRecord property = inUse( new PropertyRecord( 42 ) ); // when ConsistencyReport.PropertyConsistencyReport report = check( property ); // then verifyNoMoreInteractions( report ); }
@Test void shouldAllowSkipAfterCheckReference() { // given referenceCheck.checkReference( new PropertyRecord( 0 ), null ); // when referenceCheck.skip(); }
@Test void shouldReportPropertyNotInUse() { // given NodeRecord node = inUse( new NodeRecord( 42, false, NONE, 11 ) ); PropertyRecord property = add( notInUse( new PropertyRecord( 11 ) ) ); // when ConsistencyReport.NodeConsistencyReport report = check( node ); // then verify( report ).propertyNotInUse( property ); verifyNoMoreInteractions( report ); }
private PropertyRecord propertyRecordWithSingleIntProperty( long id, int propertyKeyId, long prev, long next ) { PropertyRecord record = new PropertyRecord( id ).initialize( true, prev, next ); PropertyBlock block = new PropertyBlock(); PropertyStore.encodeValue( block, propertyKeyId, Values.intValue( 10 ), null, null, false ); record.addPropertyBlock( block ); return record; } } );
@Test void shouldReportTooHighEpochSecondDateTimeRecord() { // given PropertyRecord property = inUse( new PropertyRecord( 42 ) ); final int keyId = 6; add( inUse( new PropertyKeyTokenRecord( keyId ) ) ); final long[] longs = TemporalType.encodeDateTime( keyId, Instant.MAX.getEpochSecond() + 1,1, 0 ); expectInvalidPropertyValue( property, longs ); }
@Test void shouldNotReportAnythingForRecordWithConsistentReferenceToProperty() { // given NeoStoreRecord record = new NeoStoreRecord(); record.setNextProp( add( inUse( new PropertyRecord( 7 ) ) ).getId() ); // when ConsistencyReport.NeoStoreConsistencyReport report = check( record ); // then verifyNoMoreInteractions( report ); }
@Test void shouldReportTooHighEpochSecondLocalDateTimeRecord() { // given PropertyRecord property = inUse( new PropertyRecord( 42 ) ); final int keyId = 6; add( inUse( new PropertyKeyTokenRecord( keyId ) ) ); final long[] longs = TemporalType.encodeLocalDateTime( keyId, Instant.MAX.getEpochSecond() + 1,1 ); expectInvalidPropertyValue( property, longs ); }
@Test void shouldNotReportAnythingForNodeWithConsistentReferences() { // given NodeRecord node = inUse( new NodeRecord( 42, false, 7, 11 ) ); add( inUse( new RelationshipRecord( 7, 42, 0, 0 ) ) ); add( inUse( new PropertyRecord( 11 ) ) ); // when ConsistencyReport.NodeConsistencyReport report = check( node ); // then verifyNoMoreInteractions( report ); }
@Test void shouldReportTooHighNanoTimeRecord() { // given PropertyRecord property = inUse( new PropertyRecord( 42 ) ); final int keyId = 6; add( inUse( new PropertyKeyTokenRecord( keyId ) ) ); final long[] longs = TemporalType.encodeTime( keyId, LocalTime.MAX.toNanoOfDay() + 1, 0 ); expectInvalidPropertyValue( property, longs ); }
@Test void shouldReportTooHighDateRecord() { // given PropertyRecord property = inUse( new PropertyRecord( 42 ) ); final int keyId = 6; add( inUse( new PropertyKeyTokenRecord( keyId ) ) ); final long[] longs = TemporalType.encodeDate( keyId, LocalDate.MAX.toEpochDay() + 1 ); expectInvalidPropertyValue( property, longs ); }
@Test void shouldReportTooHighOffsetSecondDateTimeRecord() { // given PropertyRecord property = inUse( new PropertyRecord( 42 ) ); final int keyId = 6; add( inUse( new PropertyKeyTokenRecord( keyId ) ) ); final long[] longs = TemporalType.encodeDateTime( keyId, 1,1, ZoneOffset.MAX.getTotalSeconds() + 1 ); expectInvalidPropertyValue( property, longs ); }
@Test void shouldReportTooHighLocalTimeRecord() { // given PropertyRecord property = inUse( new PropertyRecord( 42 ) ); final int keyId = 6; add( inUse( new PropertyKeyTokenRecord( keyId ) ) ); final long[] longs = TemporalType.encodeLocalTime( keyId, LocalTime.MAX.toNanoOfDay() + 1 ); expectInvalidPropertyValue( property, longs ); }