Ejemplo n.º 1
0
        private void ShouldWriteAndReadSettings(params CoordinateReferenceSystem[] crss)
        {
            // given
            IndexSpecificSpaceFillingCurveSettingsCache indexSettings = new IndexSpecificSpaceFillingCurveSettingsCache(new ConfiguredSpaceFillingCurveSettingsCache(Config.defaults()), new Dictionary <CoordinateReferenceSystem, SpaceFillingCurveSettings>());

            foreach (CoordinateReferenceSystem crs in crss)
            {
                indexSettings.ForCrs(crs, true);
            }
            SpaceFillingCurveSettingsWriter writer = new SpaceFillingCurveSettingsWriter(indexSettings);

            // when
            writer.Accept(_pageCursor);
            _pageCursor.rewind();

            // then
            IDictionary <CoordinateReferenceSystem, SpaceFillingCurveSettings> read = new Dictionary <CoordinateReferenceSystem, SpaceFillingCurveSettings>();
            SpaceFillingCurveSettingsReader reader = new SpaceFillingCurveSettingsReader(read);

            reader.Read(ByteBuffer.wrap(_data));
            assertEquals(AsMap(indexSettings), read);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldReadMultipleSettings()
        internal virtual void ShouldReadMultipleSettings()
        {
            // given
            ConfiguredSpaceFillingCurveSettingsCache globalSettings = new ConfiguredSpaceFillingCurveSettingsCache(Config.defaults());
            IDictionary <CoordinateReferenceSystem, SpaceFillingCurveSettings> expectedSpecificSettings = new Dictionary <CoordinateReferenceSystem, SpaceFillingCurveSettings>();

            RememberSettings(globalSettings, expectedSpecificSettings, WGS84, WGS84_3D, Cartesian);
            IndexSpecificSpaceFillingCurveSettingsCache specificSettings = new IndexSpecificSpaceFillingCurveSettingsCache(globalSettings, expectedSpecificSettings);
            SpaceFillingCurveSettingsWriter             writer           = new SpaceFillingCurveSettingsWriter(specificSettings);

            sbyte[] bytes = new sbyte[Org.Neo4j.Io.pagecache.PageCache_Fields.PAGE_SIZE];
            writer.Accept(new ByteArrayPageCursor(bytes));

            IDictionary <CoordinateReferenceSystem, SpaceFillingCurveSettings> readExpectedSettings = new Dictionary <CoordinateReferenceSystem, SpaceFillingCurveSettings>();
            SpaceFillingCurveSettingsReader reader = new SpaceFillingCurveSettingsReader(readExpectedSettings);

            // when
            reader.Read(ByteBuffer.wrap(bytes));

            // then
            assertEquals(expectedSpecificSettings, readExpectedSettings);
        }