@Test public void shouldReadASimplePropertyRecordById() throws IOException { URL propertyStoreFile = getClass().getResource("exampledb/neostore.propertystore.db"); LegacyPropertyRecord propertyRecord = new LegacyPropertyStoreReader(new File(propertyStoreFile.getFile())).readPropertyRecord(24); int keyIndexId = propertyRecord.getKeyIndexId(); assertEquals(2, keyIndexId); Object value = propertyRecord.getType().getValue(propertyRecord, null); assertEquals(Integer.MAX_VALUE, value); }
@Test public void shouldReadAStringPropertyRecordById() throws IOException { URL propertyStoreFile = getClass().getResource("exampledb/neostore.propertystore.db"); URL stringStoreFile = getClass().getResource("exampledb/neostore.propertystore.db.strings"); URL arrayStoreFile = getClass().getResource("exampledb/neostore.propertystore.db.arrays"); LegacyPropertyRecord propertyRecord = new LegacyPropertyStoreReader(new File(propertyStoreFile.getFile())).readPropertyRecord(25); int keyIndexId = propertyRecord.getKeyIndexId(); assertEquals(3, keyIndexId); Object value = propertyRecord .getType() .getValue( propertyRecord, new LegacyDynamicRecordFetcher( new File(stringStoreFile.getFile()), new File(arrayStoreFile.getFile()))); assertEquals(1000, ((String) value).length()); }
@Test public void shouldReadAnArrayPropertyRecordById() throws IOException { URL propertyStoreFile = getClass().getResource("exampledb/neostore.propertystore.db"); URL stringStoreFile = getClass().getResource("exampledb/neostore.propertystore.db.strings"); URL arrayStoreFile = getClass().getResource("exampledb/neostore.propertystore.db.arrays"); LegacyPropertyRecord propertyRecord2 = new LegacyPropertyStoreReader(new File(propertyStoreFile.getFile())).readPropertyRecord(32); int keyIndexId = propertyRecord2.getKeyIndexId(); assertEquals(10, keyIndexId); Object value = propertyRecord2 .getType() .getValue( propertyRecord2, new LegacyDynamicRecordFetcher( new File(stringStoreFile.getFile()), new File(arrayStoreFile.getFile()))); assertArrayEquals(MigrationTestUtils.makeLongArray(), (int[]) value); }