//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void dropShouldDeleteEntireIndexFolder() public virtual void DropShouldDeleteEntireIndexFolder() { // given File root = Storage.directory().directory("root"); IndexDirectoryStructure directoryStructure = IndexDirectoryStructure.directoriesByProvider(root).forProvider(GenericNativeIndexProvider.Descriptor); long indexId = 8; File indexDirectory = directoryStructure.DirectoryForIndex(indexId); StoreIndexDescriptor descriptor = IndexDescriptorFactory.forSchema(SchemaDescriptorFactory.forLabel(1, 1)).withId(indexId); IndexSpecificSpaceFillingCurveSettingsCache spatialSettings = mock(typeof(IndexSpecificSpaceFillingCurveSettingsCache)); PageCache pageCache = Storage.pageCache(); FileSystemAbstraction fs = Storage.fileSystem(); File indexFile = new File(indexDirectory, "my-index"); GenericLayout layout = new GenericLayout(1, spatialSettings); RecoveryCleanupWorkCollector immediate = immediate(); IndexDropAction dropAction = new FileSystemIndexDropAction(fs, directoryStructure); GenericNativeIndexPopulator populator = new GenericNativeIndexPopulator(pageCache, fs, indexFile, layout, EMPTY, descriptor, spatialSettings, directoryStructure, mock(typeof(SpaceFillingCurveConfiguration)), dropAction, false); populator.Create(); // when assertTrue(fs.ListFiles(indexDirectory).Length > 0); populator.Drop(); // then assertFalse(fs.FileExists(indexDirectory)); }
private void PutFormatVersion(PageCursor cursor) { GenericLayout layout = Layout; int major = layout.MajorVersion(); cursor.PutInt(major); int minor = layout.MinorVersion(); cursor.PutInt(minor); }
private BlockBasedIndexPopulator <GenericKey, NativeIndexValue> InstantiatePopulator(BlockStorage.Monitor monitor, ByteBufferFactory bufferFactory) { Config config = Config.defaults(); ConfiguredSpaceFillingCurveSettingsCache settingsCache = new ConfiguredSpaceFillingCurveSettingsCache(config); IndexSpecificSpaceFillingCurveSettingsCache spatialSettings = new IndexSpecificSpaceFillingCurveSettingsCache(settingsCache, new Dictionary <Org.Neo4j.Values.Storable.CoordinateReferenceSystem, SpaceFillingCurveSettings>()); GenericLayout layout = new GenericLayout(1, spatialSettings); BlockBasedIndexPopulator <GenericKey, NativeIndexValue> populator = new BlockBasedIndexPopulatorAnonymousInnerClass(this, Storage.pageCache(), _fs, _indexFile, layout, EMPTY, _indexDescriptor, spatialSettings, _directoryStructure, _dropAction, bufferFactory, monitor); populator.Create(); return(populator); }
private void PutData(PageCursor c) { GenericLayout layout = Layout; GenericKey key = layout.NewKey(); foreach (Value value in _values) { InitializeFromValue(key, value); c.PutInt(key.Size()); layout.WriteKey(c, key); } }
private GenericBlockBasedIndexPopulator InstantiatePopulator(StoreIndexDescriptor indexDescriptor) { Config config = Config.defaults(); ConfiguredSpaceFillingCurveSettingsCache settingsCache = new ConfiguredSpaceFillingCurveSettingsCache(config); IndexSpecificSpaceFillingCurveSettingsCache spatialSettings = new IndexSpecificSpaceFillingCurveSettingsCache(settingsCache, new Dictionary <Org.Neo4j.Values.Storable.CoordinateReferenceSystem, SpaceFillingCurveSettings>()); GenericLayout layout = new GenericLayout(1, spatialSettings); SpaceFillingCurveConfiguration configuration = SpaceFillingCurveSettingsFactory.getConfiguredSpaceFillingCurveConfiguration(config); GenericBlockBasedIndexPopulator populator = new GenericBlockBasedIndexPopulator(Storage.pageCache(), _fs, _indexFile, layout, EMPTY, indexDescriptor, spatialSettings, _directoryStructure, configuration, _dropAction, false, heapBufferFactory(1024)); populator.Create(); return(populator); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() public virtual void Setup() { DefaultFileSystemAbstraction fs = this._fs.get(); PageCache pc = _pageCacheRule.getPageCache(fs); File file = _directory.file("index"); GenericLayout layout = new GenericLayout(1, _indexSettings); RecoveryCleanupWorkCollector collector = RecoveryCleanupWorkCollector.ignore(); _descriptor = TestIndexDescriptorFactory.forLabel(1, 1).withId(1); IndexDirectoryStructure.Factory factory = IndexDirectoryStructure.directoriesByProvider(_directory.storeDir()); IndexDirectoryStructure structure = factory.ForProvider(GenericNativeIndexProvider.Descriptor); IndexDropAction dropAction = new FileSystemIndexDropAction(fs, structure); _accessor = new GenericNativeIndexAccessor(pc, fs, file, layout, collector, EMPTY, _descriptor, _indexSettings, new StandardConfiguration(), dropAction, false); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: protected void verifyFormat(java.io.File storeFile) throws FormatViolationException, java.io.IOException protected internal override void VerifyFormat(File storeFile) { AtomicReference <FormatViolationException> exception = new AtomicReference <FormatViolationException>(); WithCursor(storeFile, false, c => { int major = c.Int; int minor = c.Int; GenericLayout layout = Layout; if (major != layout.MajorVersion() || minor != layout.MinorVersion()) { exception.set(new FormatViolationException(this, string.Format("Read format version {0:D}.{1:D}, but layout has version {2:D}.{3:D}", major, minor, layout.MajorVersion(), layout.MinorVersion()))); } }); if (exception.get() != null) { throw exception.get(); } }
private void VerifyData(PageCursor c) { GenericLayout layout = Layout; GenericKey readCompositeKey = layout.NewKey(); GenericKey comparison = layout.NewKey(); foreach (Value value in _values) { int keySize = c.Int; layout.ReadKey(c, readCompositeKey, keySize); foreach (Value readValue in readCompositeKey.AsValues()) { InitializeFromValue(comparison, value); assertEquals(0, layout.Compare(readCompositeKey, comparison), DetailedFailureMessage(readCompositeKey, comparison)); if (readValue != Values.NO_VALUE) { assertEquals(value, readValue, "expected read value to be " + value + ", but was " + readValue); } } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReportCorrectValidationErrorsOnRandomlyGeneratedValues() public virtual void ShouldReportCorrectValidationErrorsOnRandomlyGeneratedValues() { // given int slots = Random.Next( 1, 6 ); int maxLength = Random.Next( 15, 30 ) * slots; GenericLayout layout = new GenericLayout( slots, SpatialSettings() ); GenericIndexKeyValidator validator = new GenericIndexKeyValidator( maxLength, layout ); GenericKey key = layout.NewKey(); int countOk = 0; int countNotOk = 0; for ( int i = 0; i < 100; i++ ) { // when Value[] tuple = GenerateValueTuple( slots ); bool isOk; try { validator.Validate( tuple ); isOk = true; countOk++; } catch ( System.ArgumentException ) { isOk = false; countNotOk++; } int actualSize = actualSize( tuple, key ); bool manualIsOk = actualSize <= maxLength; // then if ( manualIsOk != isOk ) { fail( format( "Validator not validating %s correctly. Manual validation on actual key resulted in %b whereas validator said %b", Arrays.ToString( tuple ), manualIsOk, isOk ) ); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @BeforeEach void createLayout() internal virtual void CreateLayout() { this._numberOfSlots = Random.Next(1, 3); this._layout = new GenericLayout(_numberOfSlots, _spatialSettings); }