//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void basicProperties()
        public virtual void BasicProperties()
        {
            GraphDatabaseAPI  db = ( GraphDatabaseAPI )_factory.newImpermanentDatabase();
            PropertyContainer graphProperties = Properties(db);

            assertThat(graphProperties, inTx(db, not(hasProperty("test"))));

            Transaction tx = Db.beginTx();

            graphProperties.SetProperty("test", "yo");
            assertEquals("yo", graphProperties.GetProperty("test"));
            tx.Success();
            tx.Close();
            assertThat(graphProperties, inTx(db, hasProperty("test").withValue("yo")));
            tx = Db.beginTx();
            assertNull(graphProperties.RemoveProperty("something non existent"));
            assertEquals("yo", graphProperties.RemoveProperty("test"));
            assertNull(graphProperties.GetProperty("test", null));
            graphProperties.SetProperty("other", 10);
            assertEquals(10, graphProperties.GetProperty("other"));
            graphProperties.SetProperty("new", "third");
            tx.Success();
            tx.Close();
            assertThat(graphProperties, inTx(db, not(hasProperty("test"))));
            assertThat(graphProperties, inTx(db, hasProperty("other").withValue(10)));
            assertThat(getPropertyKeys(db, graphProperties), containsOnly("other", "new"));

            tx = Db.beginTx();
            graphProperties.SetProperty("rollback", true);
            assertEquals(true, graphProperties.GetProperty("rollback"));
            tx.Close();
            assertThat(graphProperties, inTx(db, not(hasProperty("rollback"))));
            Db.shutdown();
        }
Exemple #2
0
 public override void ClearGraph()
 {
     GraphDatabaseServiceCleaner.cleanDatabaseContent(_db);
     using (Transaction tx = _db.beginTx())
     {
         PropertyContainer graphProperties = graphProperties();
         foreach (string key in graphProperties.PropertyKeys)
         {
             graphProperties.RemoveProperty(key);
         }
         tx.Success();
     }
 }