예제 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testDefaultsAreSeparateForNodesAndRelationships()
        public virtual void TestDefaultsAreSeparateForNodesAndRelationships()
        {
            StopDb();
            _config = new Dictionary <string, string>();
            _config[GraphDatabaseSettings.node_keys_indexable.name()] = "propName";
            _config[GraphDatabaseSettings.node_auto_indexing.name()]  = "true";
            // Now only node properties named propName should be indexed.
            StartDb();

            NewTransaction();

            Node node1 = _graphDb.createNode();
            Node node2 = _graphDb.createNode();

            node1.SetProperty("propName", "node1");
            node2.SetProperty("propName", "node2");
            node2.SetProperty("propName_", "node2");

            Relationship rel = node1.CreateRelationshipTo(node2, RelationshipType.withName("DYNAMIC"));

            rel.SetProperty("propName", "rel1");

            NewTransaction();

            ReadableIndex <Node> autoIndex = _graphDb.index().NodeAutoIndexer.AutoIndex;

            assertEquals(node1, autoIndex.Get("propName", "node1").Single);
            assertEquals(node2, autoIndex.Get("propName", "node2").Single);
            assertFalse(_graphDb.index().RelationshipAutoIndexer.AutoIndex.get("propName", "rel1").hasNext());
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testChangesAreVisibleInTransaction()
        public virtual void TestChangesAreVisibleInTransaction()
        {
            NewTransaction();

            AutoIndexer <Node> autoIndexer = _graphDb.index().NodeAutoIndexer;

            autoIndexer.StartAutoIndexingProperty("nodeProp");
            autoIndexer.Enabled = true;

            Node node1 = _graphDb.createNode();

            node1.SetProperty("nodeProp", "nodePropValue");
            node1.SetProperty("nodePropNonIndexable", "valueWhatever");
            ReadableIndex <Node> nodeIndex = autoIndexer.AutoIndex;

            assertEquals(node1, nodeIndex.Get("nodeProp", "nodePropValue").Single);

            NewTransaction();

            Node node2 = _graphDb.createNode();

            node2.SetProperty("nodeProp", "nodePropValue2");
            assertEquals(node2, nodeIndex.Get("nodeProp", "nodePropValue2").Single);
            node2.SetProperty("nodeProp", "nodePropValue3");
            assertEquals(node2, nodeIndex.Get("nodeProp", "nodePropValue3").Single);
            node2.RemoveProperty("nodeProp");
            assertFalse(nodeIndex.Get("nodeProp", "nodePropValue2").hasNext());
            assertFalse(nodeIndex.Get("nodeProp", "nodePropValue3").hasNext());

            NewTransaction();

            assertEquals(node1, nodeIndex.Get("nodeProp", "nodePropValue").Single);
            assertFalse(nodeIndex.Get("nodeProp", "nodePropValue2").hasNext());
            assertFalse(nodeIndex.Get("nodeProp", "nodePropValue3").hasNext());
        }
예제 #3
0
 public override IndexHits <T> Get(string key, object value)
 {
     return(@delegate.Get(key, value));
 }