@Override public RecordReference<DynamicRecord> propertyKeyName( int id ) { return referenceTo( access.getPropertyKeyNameStore(), id ); }
@Test public void shouldReportPropertyKeyInconsistencies() throws Exception { // given final Reference<Integer> inconsistentKey = new Reference<>(); fixture.apply( new GraphStoreFixture.Transaction() { @Override protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next ) { inconsistentKey.set( next.propertyKey() ); tx.propertyKey( inconsistentKey.get(), "FOO" ); } } ); StoreAccess access = fixture.directStoreAccess().nativeStores(); DynamicRecord record = access.getPropertyKeyNameStore().getRecord( inconsistentKey.get() + 1, access.getPropertyKeyNameStore().newRecord(), FORCE ); record.setInUse( false ); access.getPropertyKeyNameStore().updateRecord( record ); // when ConsistencySummaryStatistics stats = check(); // then on( stats ).verify( RecordType.PROPERTY_KEY, 1 ) .andThatsAllFolks(); }
tasks.add( create( "LabelTokenStore", nativeStores.getLabelTokenStore(), ROUND_ROBIN ) ); tasks.add( create( "RelationshipTypeNameStore", nativeStores.getRelationshipTypeNameStore(), ROUND_ROBIN ) ); tasks.add( create( "PropertyKeyNameStore", nativeStores.getPropertyKeyNameStore(), ROUND_ROBIN ) ); tasks.add( create( "LabelNameStore", nativeStores.getLabelNameStore(), ROUND_ROBIN ) ); tasks.add( create( "NodeDynamicLabelStore", nativeStores.getNodeDynamicLabelStore(), ROUND_ROBIN ) );
@Test public void shouldReportPropertyKeyNameInconsistencies() throws Exception { // given final Reference<Integer> inconsistentName = new Reference<>(); fixture.apply( new GraphStoreFixture.Transaction() { @Override protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next ) { inconsistentName.set( next.propertyKey() ); tx.propertyKey( inconsistentName.get(), "FOO" ); } } ); StoreAccess access = fixture.directStoreAccess().nativeStores(); DynamicRecord record = access.getPropertyKeyNameStore().getRecord( inconsistentName.get() + 1, access.getPropertyKeyNameStore().newRecord(), FORCE ); record.setNextBlock( record.getId() ); access.getPropertyKeyNameStore().updateRecord( record ); // when ConsistencySummaryStatistics stats = check(); // then on( stats ).verify( RecordType.PROPERTY_KEY_NAME, 1 ) .andThatsAllFolks(); }
arrayPropId = stores.getArrayStore().getHighId(); relTypeId = (int) stores.getRelationshipTypeTokenStore().getHighId(); propKeyId = (int) stores.getPropertyKeyNameStore().getHighId();
@Test public void shouldReportPropertyKeyInconsistencies() throws Exception { // given final Reference<Integer> inconsistentKey = new Reference<>(); fixture.apply( new GraphStoreFixture.Transaction() { @Override protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next ) { inconsistentKey.set( next.propertyKey() ); tx.propertyKey( inconsistentKey.get(), "FOO" ); } } ); StoreAccess access = fixture.directStoreAccess().nativeStores(); DynamicRecord record = access.getPropertyKeyNameStore().forceGetRecord( inconsistentKey.get()+1 ); record.setInUse( false ); access.getPropertyKeyNameStore().updateRecord( record ); // when ConsistencySummaryStatistics stats = check( fixture.directStoreAccess() ); // then on( stats ).verify( RecordType.PROPERTY_KEY, 1 ) .andThatsAllFolks(); }
@Test public void shouldReportPropertyKeyNameInconsistencies() throws Exception { // given final Reference<Integer> inconsistentName = new Reference<>(); fixture.apply( new GraphStoreFixture.Transaction() { @Override protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next ) { inconsistentName.set( next.propertyKey() ); tx.propertyKey( inconsistentName.get(), "FOO" ); } } ); StoreAccess access = fixture.directStoreAccess().nativeStores(); DynamicRecord record = access.getPropertyKeyNameStore().forceGetRecord( inconsistentName.get()+1 ); record.setNextBlock( record.getId() ); access.getPropertyKeyNameStore().updateRecord( record ); // when ConsistencySummaryStatistics stats = check( fixture.directStoreAccess() ); // then on( stats ).verify( RecordType.PROPERTY_KEY_NAME, 1 ) .andThatsAllFolks(); }
private void generateInitialData() { GraphDatabaseBuilder builder = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder( directory ); GraphDatabaseAPI graphDb = (GraphDatabaseAPI) builder.newGraphDatabase(); try { generateInitialData( graphDb ); StoreAccess stores = new StoreAccess( graphDb ).initialize(); schemaId = stores.getSchemaStore().getHighId(); nodeId = stores.getNodeStore().getHighId(); labelId = (int) stores.getLabelTokenStore().getHighId(); nodeLabelsId = stores.getNodeDynamicLabelStore().getHighId(); relId = stores.getRelationshipStore().getHighId(); relGroupId = stores.getRelationshipGroupStore().getHighId(); propId = (int) stores.getPropertyStore().getHighId(); stringPropId = stores.getStringStore().getHighId(); arrayPropId = stores.getArrayStore().getHighId(); relTypeId = (int) stores.getRelationshipTypeTokenStore().getHighId(); propKeyId = (int) stores.getPropertyKeyNameStore().getHighId(); } finally { graphDb.shutdown(); } }