Skip to content

Commit

Permalink
Test and fix for Primitive#getPropertyValues() not loading dynamic pr…
Browse files Browse the repository at this point in the history
…operties properly
  • Loading branch information
tinwelint committed Aug 27, 2012
1 parent 7f68721 commit 94c74a4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
Expand Up @@ -94,13 +94,13 @@ public Iterable<Object> getPropertyValues( NodeManager nodeManager )
{
continue;
}
values.add( property.getValue() );
values.add( getPropertyValue( nodeManager, property ) );
}
if ( addMap != null )
{
for ( PropertyData property : addMap.values() )
{
values.add( property.getValue() );
values.add( getPropertyValue( nodeManager, property ) );
}
}
return values;
Expand Down
Expand Up @@ -19,6 +19,12 @@
*/
package org.neo4j.kernel.impl.core;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import static org.neo4j.helpers.collection.IteratorUtil.first;

import org.junit.Test;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
Expand All @@ -28,11 +34,8 @@
import org.neo4j.kernel.impl.AbstractNeo4jTestCase;
import org.neo4j.test.TargetDirectory;

import static org.junit.Assert.*;

public class TestProperties extends AbstractNeo4jTestCase
{

@Test
public void addAndRemovePropertiesWithinOneTransaction() throws Exception
{
Expand Down Expand Up @@ -259,4 +262,23 @@ public void loadManyProperties() throws Exception
clearCache();
assertEquals( "value", node.getProperty( "property 0" ) );
}

@Test
public void getPropertyValuesShouldReturnCorrectValues() throws Exception
{
String key = "title";
// value1 fits in an inlined record
String value1 = "123456789123456789123456789123456789123456789123456789";
// value2 requires a dynamic record
String value2 = "12345678912345678912345678912345678912345678912345678912";
Node node1 = getGraphDb().createNode();
node1.setProperty( key, value1 );
Node node2 = getGraphDb().createNode();
node2.setProperty( key, value2 );
newTransaction();
clearCache();

assertEquals( value1, first( node1.getPropertyValues() ) );
assertEquals( value2, first( node2.getPropertyValues() ) );
}
}

0 comments on commit 94c74a4

Please sign in to comment.