private void ReadEachProperty(PropertyContainer entity) { foreach (string k in entity.PropertyKeys) { entity.GetProperty(k); } }
//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(); }
//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(); }
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(); } }
//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(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testEquals() public virtual void TestEquals() { GraphDatabaseAPI db = ( GraphDatabaseAPI )_factory.newImpermanentDatabase(); PropertyContainer graphProperties = Properties(db); using (Transaction tx = Db.beginTx()) { graphProperties.SetProperty("test", "test"); tx.Success(); } assertEquals(graphProperties, Properties(db)); Db.shutdown(); db = ( GraphDatabaseAPI )_factory.newImpermanentDatabase(); assertNotEquals(graphProperties, Properties(db)); Db.shutdown(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void graphPropertiesAreLockedPerTx() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void GraphPropertiesAreLockedPerTx() { GraphDatabaseAPI db = ( GraphDatabaseAPI )_factory.newImpermanentDatabase(); Worker worker1 = new Worker("W1", new State(db)); Worker worker2 = new Worker("W2", new State(db)); PropertyContainer properties = properties(db); worker1.BeginTx(); worker2.BeginTx(); string key1 = "name"; string value1 = "Value 1"; string key2 = "some other property"; string value2 = "Value 2"; string key3 = "say"; string value3 = "hello"; worker1.SetProperty(key1, value1).get(); assertThat(properties, inTx(db, not(hasProperty(key1)))); assertFalse(worker2.HasProperty(key1)); Future <Void> blockedSetProperty = worker2.SetProperty(key2, value2); assertThat(properties, inTx(db, not(hasProperty(key1)))); assertThat(properties, inTx(db, not(hasProperty(key2)))); worker1.SetProperty(key3, value3).get(); assertFalse(blockedSetProperty.Done); assertThat(properties, inTx(db, not(hasProperty(key1)))); assertThat(properties, inTx(db, not(hasProperty(key2)))); assertThat(properties, inTx(db, not(hasProperty(key3)))); worker1.CommitTx(); assertThat(properties, inTx(db, hasProperty(key1))); assertThat(properties, inTx(db, not(hasProperty(key2)))); assertThat(properties, inTx(db, hasProperty(key3))); blockedSetProperty.get(); assertTrue(blockedSetProperty.Done); worker2.CommitTx(); assertThat(properties, inTx(db, hasProperty(key1).withValue(value1))); assertThat(properties, inTx(db, hasProperty(key2).withValue(value2))); assertThat(properties, inTx(db, hasProperty(key3).withValue(value3))); worker1.Dispose(); worker2.Dispose(); Db.shutdown(); }
public PropertiesRepresentation(PropertyContainer entity) : base(RepresentationType.Properties) { this._entity = entity; }
internal State(GraphDatabaseAPI db) { this.Db = db; this.Properties = Properties(db); }