IndexSamplingConfig samplingConfig = new IndexSamplingConfig( new Config() ); IndexPopulator populator = storeAccess.indexes().getPopulator( rule.getId(), descriptor, indexConfig, samplingConfig ); populator.markAsFailed( "Oh noes! I was a shiny index and then I was failed" ); populator.close( false );
@Test public void shouldReportNodesThatAreNotIndexed() throws Exception { // given IndexSamplingConfig samplingConfig = new IndexSamplingConfig( new Config() ); for ( IndexRule indexRule : loadAllIndexRules( fixture.directStoreAccess().nativeStores().getSchemaStore() ) ) { IndexAccessor accessor = fixture.directStoreAccess().indexes().getOnlineAccessor( indexRule.getId(), new IndexConfiguration( indexRule.isConstraintIndex() ), samplingConfig ); IndexUpdater updater = accessor.newUpdater( IndexUpdateMode.ONLINE ); updater.remove( asPrimitiveLongSet( indexedNodes ) ); updater.close(); accessor.close(); } // when ConsistencySummaryStatistics stats = check(); // then on( stats ).verify( RecordType.NODE, 1 ) .andThatsAllFolks(); }
@Test public void shouldReportNodesWithDuplicatePropertyValueInUniqueIndex() throws Exception { // given IndexConfiguration indexConfig = new IndexConfiguration( false ); IndexSamplingConfig samplingConfig = new IndexSamplingConfig( new Config() ); for ( IndexRule indexRule : loadAllIndexRules( fixture.directStoreAccess().nativeStores().getSchemaStore() ) ) { IndexAccessor accessor = fixture.directStoreAccess() .indexes() .getOnlineAccessor( indexRule.getId(), indexConfig, samplingConfig ); IndexUpdater updater = accessor.newUpdater( IndexUpdateMode.ONLINE ); updater.process( NodePropertyUpdate.add( 42, 0, "value", new long[]{3} ) ); updater.close(); accessor.close(); } // when ConsistencySummaryStatistics stats = check(); // then on( stats ).verify( RecordType.NODE, 1 ) .verify( RecordType.INDEX, 2 ) .andThatsAllFolks(); }