Search in sources :

Example 16 with NeoStoreDataSource

use of org.neo4j.kernel.NeoStoreDataSource in project neo4j by neo4j.

the class TestAutoIndexing method testRemoveUnloadedHeavyProperty.

@Test
public void testRemoveUnloadedHeavyProperty() {
    /*
         * Checks a bug where removing non-cached heavy properties
         * would cause NPE in auto indexer.
         */
    graphDb.index().getNodeAutoIndexer().setEnabled(true);
    graphDb.index().getNodeAutoIndexer().startAutoIndexingProperty("nodeProp");
    newTransaction();
    Node node1 = graphDb.createNode();
    // Large array, needed for making sure this is a heavy property
    node1.setProperty("nodeProp", new int[] { -1, 2, 3, 4, 5, 6, 1, 1, 1, 1 });
    newTransaction();
    // clear the caches
    NeoStoreDataSource dataSource = graphDb.getDependencyResolver().resolveDependency(NeoStoreDataSource.class);
    node1.removeProperty("nodeProp");
    newTransaction();
    assertFalse(node1.hasProperty("nodeProp"));
}
Also used : Node(org.neo4j.graphdb.Node) NeoStoreDataSource(org.neo4j.kernel.NeoStoreDataSource) Test(org.junit.Test)

Aggregations

NeoStoreDataSource (org.neo4j.kernel.NeoStoreDataSource)16 Test (org.junit.Test)9 Monitors (org.neo4j.kernel.monitoring.Monitors)5 File (java.io.File)4 URI (java.net.URI)4 InstanceId (org.neo4j.cluster.InstanceId)4 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)4 PageCache (org.neo4j.io.pagecache.PageCache)4 StoreId (org.neo4j.kernel.impl.store.StoreId)4 TransactionIdStore (org.neo4j.kernel.impl.transaction.log.TransactionIdStore)4 IOException (java.io.IOException)3 InetSocketAddress (java.net.InetSocketAddress)3 ClusterMemberAvailability (org.neo4j.cluster.member.ClusterMemberAvailability)3 DataSourceManager (org.neo4j.kernel.impl.transaction.state.DataSourceManager)3 URISyntaxException (java.net.URISyntaxException)2 TimeUnit (java.util.concurrent.TimeUnit)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 DependencyResolver (org.neo4j.graphdb.DependencyResolver)2 PagedFile (org.neo4j.io.pagecache.PagedFile)2 AvailabilityGuard (org.neo4j.kernel.AvailabilityGuard)2