예제 #1
0
//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();
        }
예제 #2
0
 private void ReadEachProperty(PropertyContainer entity)
 {
     foreach (string k in entity.PropertyKeys)
     {
         entity.GetProperty(k);
     }
 }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void getNonExistentGraphPropertyWithDefaultValue()
        public virtual void getNonExistentGraphPropertyWithDefaultValue()
        {
            GraphDatabaseAPI  db = ( GraphDatabaseAPI )_factory.newImpermanentDatabase();
            PropertyContainer graphProperties = Properties(db);
            Transaction       tx = Db.beginTx();

            assertEquals("default", graphProperties.GetProperty("test", "default"));
            tx.Success();
            tx.Close();
            Db.shutdown();
        }
예제 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToCreateLongGraphPropertyChainsAndReadTheCorrectNextPointerFromTheStore()
        public virtual void ShouldBeAbleToCreateLongGraphPropertyChainsAndReadTheCorrectNextPointerFromTheStore()
        {
            GraphDatabaseService database = _factory.newImpermanentDatabase();

            PropertyContainer graphProperties = Properties(( GraphDatabaseAPI )database);

            using (Transaction tx = database.BeginTx())
            {
                graphProperties.SetProperty("a", new string[] { "A", "B", "C", "D", "E" });
                graphProperties.SetProperty("b", true);
                graphProperties.SetProperty("c", "C");
                tx.Success();
            }

            using (Transaction tx = database.BeginTx())
            {
                graphProperties.SetProperty("d", new string[] { "A", "F" });
                graphProperties.SetProperty("e", true);
                graphProperties.SetProperty("f", "F");
                tx.Success();
            }

            using (Transaction tx = database.BeginTx())
            {
                graphProperties.SetProperty("g", new string[] { "F" });
                graphProperties.SetProperty("h", false);
                graphProperties.SetProperty("i", "I");
                tx.Success();
            }

            using (Transaction tx = database.BeginTx())
            {
                assertArrayEquals(new string[] { "A", "B", "C", "D", "E" }, ( string[] )graphProperties.GetProperty("a"));
                assertTrue(( bool )graphProperties.GetProperty("b"));
                assertEquals("C", graphProperties.GetProperty("c"));

                assertArrayEquals(new string[] { "A", "F" }, ( string[] )graphProperties.GetProperty("d"));
                assertTrue(( bool )graphProperties.GetProperty("e"));
                assertEquals("F", graphProperties.GetProperty("f"));

                assertArrayEquals(new string[] { "F" }, ( string[] )graphProperties.GetProperty("g"));
                assertFalse(( bool )graphProperties.GetProperty("h"));
                assertEquals("I", graphProperties.GetProperty("i"));
                tx.Success();
            }
            database.Shutdown();
        }