use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_2_4 method visitPropertyCommand.
private Command visitPropertyCommand(ReadableChannel channel) throws IOException {
// ID
// 8
long id = channel.getLong();
// BEFORE
PropertyRecord before = readPropertyRecord(id, channel);
if (before == null) {
return null;
}
// AFTER
PropertyRecord after = readPropertyRecord(id, channel);
if (after == null) {
return null;
}
return new Command.PropertyCommand(before, after);
}
use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class NeoStoresTest method validateRel2.
private void validateRel2(long rel, DefinedProperty prop1, DefinedProperty prop2, DefinedProperty prop3, long firstNode, long secondNode, int relType) throws IOException {
ArrayMap<Integer, Pair<DefinedProperty, Long>> props = new ArrayMap<>();
propertyLoader.relLoadProperties(rel, newPropertyReceiver(props));
int count = 0;
for (int keyId : props.keySet()) {
long id = props.get(keyId).other();
PropertyRecord record = getRecord(pStore, id);
PropertyBlock block = record.getPropertyBlock(props.get(keyId).first().propertyKeyId());
DefinedProperty data = block.newPropertyData(pStore);
if (data.propertyKeyId() == prop1.propertyKeyId()) {
assertEquals("prop1", MyPropertyKeyToken.getIndexFor(keyId).name());
assertEquals("string2", data.value());
relAddProperty(rel, prop1.propertyKeyId(), "-string2");
} else if (data.propertyKeyId() == prop2.propertyKeyId()) {
assertEquals("prop2", MyPropertyKeyToken.getIndexFor(keyId).name());
assertEquals(2, data.value());
relAddProperty(rel, prop2.propertyKeyId(), -2);
} else if (data.propertyKeyId() == prop3.propertyKeyId()) {
assertEquals("prop3", MyPropertyKeyToken.getIndexFor(keyId).name());
assertEquals(false, data.value());
relAddProperty(rel, prop3.propertyKeyId(), true);
} else {
throw new IOException();
}
count++;
}
assertEquals(3, count);
assertRelationshipData(rel, firstNode, secondNode, relType);
}
use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class NeoStoresTest method deleteNode2.
private void deleteNode2(long node, DefinedProperty prop1, DefinedProperty prop2, DefinedProperty prop3) throws IOException {
ArrayMap<Integer, Pair<DefinedProperty, Long>> props = new ArrayMap<>();
propertyLoader.nodeLoadProperties(node, newPropertyReceiver(props));
int count = 0;
for (int keyId : props.keySet()) {
long id = props.get(keyId).other();
PropertyRecord record = pStore.getRecord(id, pStore.newRecord(), NORMAL);
PropertyBlock block = record.getPropertyBlock(props.get(keyId).first().propertyKeyId());
DefinedProperty data = block.newPropertyData(pStore);
if (data.propertyKeyId() == prop1.propertyKeyId()) {
assertEquals("prop1", MyPropertyKeyToken.getIndexFor(keyId).name());
assertEquals("-string2", data.value());
} else if (data.propertyKeyId() == prop2.propertyKeyId()) {
assertEquals("prop2", MyPropertyKeyToken.getIndexFor(keyId).name());
assertEquals(-2, data.value());
} else if (data.propertyKeyId() == prop3.propertyKeyId()) {
assertEquals("prop3", MyPropertyKeyToken.getIndexFor(keyId).name());
assertEquals(true, data.value());
transaction.nodeDoRemoveProperty(node, prop3);
} else {
throw new IOException();
}
count++;
}
assertEquals(3, count);
CountingPropertyReceiver propertyCounter = new CountingPropertyReceiver();
propertyLoader.nodeLoadProperties(node, propertyCounter);
assertEquals(3, propertyCounter.count);
assertHasRelationships(node);
transaction.nodeDoDelete(node);
}
use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class NeoStoresTest method deleteRel1.
private void deleteRel1(long rel, DefinedProperty prop1, DefinedProperty prop2, DefinedProperty prop3, long firstNode, long secondNode, int relType) throws Exception {
ArrayMap<Integer, Pair<DefinedProperty, Long>> props = new ArrayMap<>();
propertyLoader.relLoadProperties(rel, newPropertyReceiver(props));
int count = 0;
for (int keyId : props.keySet()) {
long id = props.get(keyId).other();
PropertyRecord record = pStore.getRecord(id, pStore.newRecord(), NORMAL);
PropertyBlock block = record.getPropertyBlock(props.get(keyId).first().propertyKeyId());
DefinedProperty data = block.newPropertyData(pStore);
if (data.propertyKeyId() == prop1.propertyKeyId()) {
assertEquals("prop1", MyPropertyKeyToken.getIndexFor(keyId).name());
assertEquals("-string1", data.value());
} else if (data.propertyKeyId() == prop2.propertyKeyId()) {
assertEquals("prop2", MyPropertyKeyToken.getIndexFor(keyId).name());
assertEquals(-1, data.value());
} else if (data.propertyKeyId() == prop3.propertyKeyId()) {
assertEquals("prop3", MyPropertyKeyToken.getIndexFor(keyId).name());
assertEquals(false, data.value());
transaction.relationshipDoRemoveProperty(rel, prop3);
} else {
throw new IOException();
}
count++;
}
assertEquals(3, count);
CountingPropertyReceiver propertyCounter = new CountingPropertyReceiver();
propertyLoader.relLoadProperties(rel, propertyCounter);
assertEquals(3, propertyCounter.count);
assertRelationshipData(rel, firstNode, secondNode, relType);
relDelete(rel);
assertHasRelationships(firstNode);
assertHasRelationships(secondNode);
}
use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class NeoStoresTest method deleteRel2.
private void deleteRel2(long rel, DefinedProperty prop1, DefinedProperty prop2, DefinedProperty prop3, long firstNode, long secondNode, int relType) throws Exception {
ArrayMap<Integer, Pair<DefinedProperty, Long>> props = new ArrayMap<>();
propertyLoader.relLoadProperties(rel, newPropertyReceiver(props));
int count = 0;
for (int keyId : props.keySet()) {
long id = props.get(keyId).other();
PropertyRecord record = pStore.getRecord(id, pStore.newRecord(), NORMAL);
PropertyBlock block = record.getPropertyBlock(props.get(keyId).first().propertyKeyId());
DefinedProperty data = block.newPropertyData(pStore);
if (data.propertyKeyId() == prop1.propertyKeyId()) {
assertEquals("prop1", MyPropertyKeyToken.getIndexFor(keyId).name());
assertEquals("-string2", data.value());
} else if (data.propertyKeyId() == prop2.propertyKeyId()) {
assertEquals("prop2", MyPropertyKeyToken.getIndexFor(keyId).name());
assertEquals(-2, data.value());
} else if (data.propertyKeyId() == prop3.propertyKeyId()) {
assertEquals("prop3", MyPropertyKeyToken.getIndexFor(keyId).name());
assertEquals(true, data.value());
transaction.relationshipDoRemoveProperty(rel, prop3);
} else {
throw new IOException();
}
count++;
}
assertEquals(3, count);
CountingPropertyReceiver propertyCounter = new CountingPropertyReceiver();
propertyLoader.relLoadProperties(rel, propertyCounter);
assertEquals(3, propertyCounter.count);
assertRelationshipData(rel, firstNode, secondNode, relType);
relDelete(rel);
assertHasRelationships(firstNode);
assertHasRelationships(secondNode);
}
Aggregations