use of org.neo4j.storageengine.api.PropertyItem in project neo4j by neo4j.
the class StorageLayerPropertyTest method should_get_all_node_properties.
@Test
public void should_get_all_node_properties() throws Exception {
// GIVEN
String longString = "AlalalalalongAlalalalalongAlalalalalongAlalalalalongAlalalalalongAlalalalalongAlalalalalongAlalalalalong";
Object[] properties = { longString, createNew(String.class), createNew(long.class), createNew(int.class), createNew(byte.class), createNew(short.class), createNew(boolean.class), createNew(char.class), createNew(float.class), createNew(double.class), array(0, String.class), array(0, long.class), array(0, int.class), array(0, byte.class), array(0, short.class), array(0, boolean.class), array(0, char.class), array(0, float.class), array(0, double.class), array(1, String.class), array(1, long.class), array(1, int.class), array(1, byte.class), array(1, short.class), array(1, boolean.class), array(1, char.class), array(1, float.class), array(1, double.class), array(256, String.class), array(256, long.class), array(256, int.class), array(256, byte.class), array(256, short.class), array(256, boolean.class), array(256, char.class), array(256, float.class), array(256, double.class) };
int propKey = disk.propertyKeyGetOrCreateForName("prop");
StorageStatement statement = state.getStoreStatement();
for (Object value : properties) {
// given
long nodeId = createLabeledNode(db, singletonMap("prop", value), label1).getId();
// when
try (Cursor<NodeItem> node = statement.acquireSingleNodeCursor(nodeId)) {
node.next();
Lock lock = node.get().lock();
try (Cursor<PropertyItem> props = statement.acquireSinglePropertyCursor(node.get().nextPropertyId(), propKey, lock)) {
if (props.next()) {
Object propVal = props.get().value();
//then
assertTrue(propVal + ".valueEquals(" + value + ")", Property.property(propKey, propVal).valueEquals(value));
} else {
fail();
}
}
}
}
}
use of org.neo4j.storageengine.api.PropertyItem in project neo4j by neo4j.
the class StateOperationsAutoIndexingTest method shouldSignalRelationshipPropertyChangedToAutoIndex.
@Test
public void shouldSignalRelationshipPropertyChangedToAutoIndex() throws Exception {
// Given
int propertyKeyId = 1;
DefinedProperty property = property(propertyKeyId, "Hello!");
PropertyItem existingProperty = mock(PropertyItem.class);
when(existingProperty.propertyKeyId()).thenReturn(property.propertyKeyId());
when(existingProperty.value()).thenReturn("Goodbye!");
RelationshipItem relationship = mock(RelationshipItem.class);
when(storeStmt.acquireSingleRelationshipCursor(1337)).thenReturn(cursor(relationship));
when(storeLayer.relationshipGetProperty(storeStmt, relationship, propertyKeyId)).thenReturn(cursor(existingProperty));
// When
context.relationshipSetProperty(stmt, 1337, property);
// Then
verify(relOps).propertyChanged(eq(writeOps), eq(1337L), any(Property.class), eq(property));
}
use of org.neo4j.storageengine.api.PropertyItem in project neo4j by neo4j.
the class StateOperationsAutoIndexingTest method shouldSignalNodePropertyRemovedToAutoIndex.
@Test
public void shouldSignalNodePropertyRemovedToAutoIndex() throws Exception {
// Given
PropertyItem existingProperty = mock(PropertyItem.class);
when(existingProperty.propertyKeyId()).thenReturn(1);
when(existingProperty.value()).thenReturn("Goodbye!");
int propertyKeyId = existingProperty.propertyKeyId();
NodeItem node = mock(NodeItem.class);
when(storeLayer.nodeGetProperty(eq(storeStmt), any(NodeItem.class), eq(propertyKeyId))).thenReturn(cursor(existingProperty));
when(node.labels()).thenReturn(PrimitiveIntCollections.emptySet());
when(storeStmt.acquireSingleNodeCursor(1337)).thenReturn(cursor(node));
// When
context.nodeRemoveProperty(stmt, 1337, propertyKeyId);
// Then
verify(nodeOps).propertyRemoved(writeOps, 1337L, propertyKeyId);
}
Aggregations