Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void readArrayAndStringPropertiesWithDifferentBlockSizes()
        public virtual void ReadArrayAndStringPropertiesWithDifferentBlockSizes()
        {
            string stringValue = RandomStringUtils.randomAlphanumeric(10000);

            sbyte[] arrayValue = RandomStringUtils.randomAlphanumeric(10000).Bytes;

            GraphDatabaseService db = (new TestGraphDatabaseFactory()).setFileSystem(Fs.get()).newImpermanentDatabaseBuilder().setConfig(GraphDatabaseSettings.string_block_size, "1024").setConfig(GraphDatabaseSettings.array_block_size, "2048").newGraphDatabase();

            try
            {
                long nodeId;
                using (Transaction tx = Db.beginTx())
                {
                    Node node = Db.createNode();
                    nodeId = node.Id;
                    node.SetProperty("string", stringValue);
                    node.SetProperty("array", arrayValue);
                    tx.Success();
                }

                using (Transaction tx = Db.beginTx())
                {
                    Node node = Db.getNodeById(nodeId);
                    assertEquals(stringValue, node.GetProperty("string"));
                    assertArrayEquals(arrayValue, ( sbyte[] )node.GetProperty("array"));
                    tx.Success();
                }
            }
            finally
            {
                Db.shutdown();
            }
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandlePointsUsingRestResultDataContent() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHandlePointsUsingRestResultDataContent()
        {
            //Given
            GraphDatabaseFacade db = Server().Database.Graph;

            using (Transaction tx = Db.beginTx())
            {
                Node node = Db.createNode(label("N"));
                node.SetProperty("coordinates", pointValue(WGS84, 30.655691, 104.081602));
                node.SetProperty("location", "Shanghai");
                node.SetProperty("type", "gps");
                tx.Success();
            }

            //When
            HTTP.Response response = RunQuery("MATCH (n:N) RETURN n", "rest");

            assertEquals(200, response.Status());
            AssertNoErrors(response);

            //Then
            JsonNode row = response.Get("results").get(0).get("data").get(0).get("rest").get(0).get("data").get("coordinates");

            AssertGeometryTypeEqual(GeometryType.GEOMETRY_POINT, row);
            AssertCoordinatesEqual(new double[] { 30.655691, 104.081602 }, row);
            AssertCrsEqual(WGS84, row);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldOnlyIndexIndexedProperties() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldOnlyIndexIndexedProperties()
        {
            IndexReference index;

            using (KernelTransactionImplementation tx = KernelTransaction)
            {
                SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP);
                index = tx.SchemaWrite().indexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME);
                tx.Success();
            }
            Await(index);

            long firstID;

            using (Transaction tx = Db.beginTx())
            {
                firstID = CreateNodeIndexableByPropertyValue(Label, "Hello. Hello again.");
                SetNodeProp(firstID, "prop2", "zebra");

                Node node2 = Db.createNode(Label);
                node2.SetProperty("prop2", "zebra");
                node2.SetProperty("prop3", "hello");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "hello", firstID);
                AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "zebra");
            }
        }
Exemple #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void compositeNodeKeyConstraintUpdate() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CompositeNodeKeyConstraintUpdate()
        {
            GraphDatabaseService database = (new EnterpriseGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(TestDirectory.storeDir()).setConfig(OnlineBackupSettings.online_backup_enabled, Settings.FALSE).newGraphDatabase();

            Label label = Label.label("label");

            using (Transaction transaction = database.BeginTx())
            {
                Node node = database.CreateNode(label);
                node.SetProperty("b", ( short )3);
                node.SetProperty("a", new double[] { 0.6, 0.4, 0.2 });
                transaction.Success();
            }

            using (Transaction transaction = database.BeginTx())
            {
                string query = format("CREATE CONSTRAINT ON (n:%s) ASSERT (n.%s,n.%s) IS NODE KEY", label.Name(), "a", "b");
                database.Execute(query);
                transaction.Success();
            }

            AwaitIndex(database);

            using (Transaction transaction = database.BeginTx())
            {
                Node node = database.CreateNode(label);
                node.SetProperty("a", ( short )7);
                node.SetProperty("b", new double[] { 0.7, 0.5, 0.3 });
                transaction.Success();
            }
            database.Shutdown();

            ConsistencyCheckService.Result consistencyCheckResult = CheckDbConsistency(TestDirectory.storeDir());
            assertTrue("Database is consistent", consistencyCheckResult.Successful);
        }
Exemple #5
0
        /// <summary>
        /// Used by cc </summary>
        /// <param name="db"> </param>
        /// <param name="tx"> </param>
        public static void CreateSomeData(GraphDatabaseService db, Transaction tx)
        {
            Node node = Db.createNode();

            node.SetProperty(PROP_NAME, "Neo");
            node.SetProperty(PROP_RANDOM, GlobalRandom.NextDouble * 10000);
            Db.createNode().createRelationshipTo(node, RelationshipType.withName("KNOWS"));
            tx.Success();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void canAddMultipleShortStringsToTheSameNode()
        public virtual void CanAddMultipleShortStringsToTheSameNode()
        {
            Node node = Graphdb.GraphDatabaseAPI.createNode();

            node.SetProperty("key", "value");
            node.SetProperty("reverse", "esrever");
            Commit();
            assertThat(node, inTx(Graphdb.GraphDatabaseAPI, hasProperty("key").withValue("value")));
            assertThat(node, inTx(Graphdb.GraphDatabaseAPI, hasProperty("reverse").withValue("esrever")));
        }
Exemple #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void addAndRemovePropertiesWithinOneTransaction()
        public virtual void AddAndRemovePropertiesWithinOneTransaction()
        {
            Node node = GraphDb.createNode();

            node.SetProperty("name", "oscar");
            node.SetProperty("favourite_numbers", new long?[] { 1L, 2L, 3L });
            node.SetProperty("favourite_colors", new string[] { "blue", "red" });
            node.RemoveProperty("favourite_colors");
            NewTransaction();

            assertNotNull(node.GetProperty("favourite_numbers", null));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotFindRemovedProperties() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotFindRemovedProperties()
        {
            IndexReference index;

            using (KernelTransactionImplementation tx = KernelTransaction)
            {
                SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, "prop", "prop2");
                index = tx.SchemaWrite().indexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME);
                tx.Success();
            }
            Await(index);
            long firstID;
            long secondID;
            long thirdID;

            using (Transaction tx = Db.beginTx())
            {
                firstID  = CreateNodeIndexableByPropertyValue(Label, "Hello. Hello again.");
                secondID = CreateNodeIndexableByPropertyValue(Label, "A zebroid (also zedonk, zorse, zebra mule, zonkey, and zebmule) is the offspring of any " + "cross between a zebra and any other equine: essentially, a zebra hybrid.");
                thirdID  = CreateNodeIndexableByPropertyValue(Label, "Hello. Hello again.");

                SetNodeProp(firstID, "zebra");
                SetNodeProp(secondID, "Hello. Hello again.");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                Node node  = Db.getNodeById(firstID);
                Node node2 = Db.getNodeById(secondID);
                Node node3 = Db.getNodeById(thirdID);

                node.SetProperty("prop", "tomtar");
                node.SetProperty("prop2", "tomtar");

                node2.SetProperty("prop", "tomtar");
                node2.SetProperty("prop2", "Hello");

                node3.RemoveProperty("prop");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "hello", secondID);
                AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "zebra");
                AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "zedonk");
                AssertQueryFindsNothing(ktx, NODE_INDEX_NAME, "cross");
            }
        }
Exemple #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void removeOneOfThree()
        public virtual void RemoveOneOfThree()
        {
            Node node = GraphDb.createNode();

            node.SetProperty("1", 1);
            node.SetProperty("2", 2);
            node.SetProperty("3", 3);
            NewTransaction();

            node.RemoveProperty("2");
            NewTransaction();
            assertNull(node.GetProperty("2", null));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void canReplaceShortStringWithLongString()
        public virtual void CanReplaceShortStringWithLongString()
        {
            Node node = Graphdb.GraphDatabaseAPI.createNode();

            node.SetProperty("key", "value");
            NewTx();

            assertEquals("value", node.GetProperty("key"));

            node.SetProperty("key", LONG_STRING);
            Commit();

            assertThat(node, inTx(Graphdb.GraphDatabaseAPI, hasProperty("key").withValue(LONG_STRING)));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void canUpdateShortStringInplace()
        public virtual void CanUpdateShortStringInplace()
        {
            Node node = Graphdb.GraphDatabaseAPI.createNode();

            node.SetProperty("key", "value");

            NewTx();

            assertEquals("value", node.GetProperty("key"));

            node.SetProperty("key", "other");
            Commit();

            assertThat(node, inTx(Graphdb.GraphDatabaseAPI, hasProperty("key").withValue("other")));
        }
Exemple #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void validateNodePropertiesOnPopulation()
        internal virtual void ValidateNodePropertiesOnPopulation()
        {
            setUp();
            Label  label        = Label.label("populationTestNodeLabel");
            string propertyName = "populationTestPropertyName";

            using (Transaction transaction = _database.beginTx())
            {
                Node node = _database.createNode(label);
                node.SetProperty(propertyName, StringUtils.repeat("a", IndexWriter.MAX_TERM_LENGTH + 1));
                transaction.Success();
            }

            IndexDefinition indexDefinition = CreateIndex(label, propertyName);

            try
            {
                using (Transaction ignored = _database.beginTx())
                {
                    _database.schema().awaitIndexesOnline(5, TimeUnit.MINUTES);
                }
            }
            catch (System.InvalidOperationException)
            {
                using (Transaction ignored = _database.beginTx())
                {
                    string indexFailure = _database.schema().getIndexFailure(indexDefinition);
                    assertThat(indexFailure, allOf(containsString("java.lang.IllegalArgumentException:"), containsString("Please see index documentation for limitations.")));
                }
            }
        }
Exemple #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testBasicPropagationFromSlaveToMaster()
        public virtual void TestBasicPropagationFromSlaveToMaster()
        {
            // given
            ClusterManager.ManagedCluster cluster = ClusterRule.startCluster();
            HighlyAvailableGraphDatabase  master  = cluster.Master;
            HighlyAvailableGraphDatabase  slave   = cluster.AnySlave;
            long nodeId;

            // a node with a property
            using (Transaction tx = master.BeginTx())
            {
                Node node = master.CreateNode();
                nodeId = node.Id;
                node.SetProperty("foo", "bar");
                tx.Success();
            }

            cluster.Sync();

            // when
            // the slave does a change
            using (Transaction tx = slave.BeginTx())
            {
                slave.GetNodeById(nodeId).setProperty("foo", "bar2");
                tx.Success();
            }

            // then
            // the master must pick up the change
            using (Transaction tx = master.BeginTx())
            {
                assertEquals("bar2", master.GetNodeById(nodeId).getProperty("foo"));
                tx.Success();
            }
        }
Exemple #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testBasicPropagationFromMasterToSlave()
        public virtual void TestBasicPropagationFromMasterToSlave()
        {
            // given
            ClusterManager.ManagedCluster cluster = ClusterRule.startCluster();
            long nodeId = 4;
            HighlyAvailableGraphDatabase master = cluster.Master;

            using (Transaction tx = master.BeginTx())
            {
                Node node = master.CreateNode();
                node.SetProperty("Hello", "World");
                nodeId = node.Id;

                tx.Success();
            }

            cluster.Sync();

            // No need to wait, the push factor is 2
            HighlyAvailableGraphDatabase slave1 = cluster.AnySlave;

            CheckNodeOnSlave(nodeId, slave1);

            HighlyAvailableGraphDatabase slave2 = cluster.GetAnySlave(slave1);

            CheckNodeOnSlave(nodeId, slave2);
        }
        private void AttemptAndFailConstraintCreation()
        {
            using (Transaction tx = Db.beginTx())
            {
                for (int i = 0; i < 2; i++)
                {
                    Node node1 = Db.createNode(_label);
                    node1.SetProperty("prop", true);
                }

                tx.Success();
            }

            // when
            try
            {
                using (Transaction tx = Db.beginTx())
                {
                    Db.schema().constraintFor(_label).assertPropertyIsUnique("prop").create();
                    fail("Should have failed with ConstraintViolationException");
                    tx.Success();
                }
            }
            catch (ConstraintViolationException)
            {
            }

            // then
            using (Transaction ignore = Db.beginTx())
            {
                assertEquals(0, Iterables.count(Db.schema().Indexes));
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void firstRecordOtherThanZeroIfNotFirst()
        public virtual void FirstRecordOtherThanZeroIfNotFirst()
        {
            File             storeDir = TestDirectory.databaseDir();
            GraphDatabaseAPI db       = ( GraphDatabaseAPI )_factory.newImpermanentDatabase(storeDir);
            Transaction      tx       = Db.beginTx();
            Node             node     = Db.createNode();

            node.SetProperty("name", "Yo");
            tx.Success();
            tx.Close();
            Db.shutdown();

            db = ( GraphDatabaseAPI )_factory.newImpermanentDatabase(storeDir);
            tx = Db.beginTx();
            Properties(db).setProperty("test", "something");
            tx.Success();
            tx.Close();
            Db.shutdown();

            Config       config       = Config.defaults();
            StoreFactory storeFactory = new StoreFactory(TestDirectory.databaseLayout(), config, new DefaultIdGeneratorFactory(Fs.get()), PageCacheRule.getPageCache(Fs.get()), Fs.get(), NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY);
            NeoStores    neoStores    = storeFactory.OpenAllNeoStores();
            long         prop         = neoStores.MetaDataStore.GraphNextProp;

            assertTrue(prop != 0);
            neoStores.Close();
        }
Exemple #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void removeSomeAndSetSome()
        public virtual void RemoveSomeAndSetSome()
        {
            Node node = GraphDb.createNode();

            node.SetProperty("remove me", "trash");
            NewTransaction();

            node.RemoveProperty("remove me");
            node.SetProperty("foo", "bar");
            node.SetProperty("baz", 17);
            NewTransaction();

            assertEquals("bar", node.GetProperty("foo"));
            assertEquals(17, node.GetProperty("baz"));
            assertNull(node.GetProperty("remove me", null));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSearchAcrossMultipleProperties() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSearchAcrossMultipleProperties()
        {
            IndexReference index;

            using (KernelTransactionImplementation tx = KernelTransaction)
            {
                SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, "prop", "prop2");
                index = tx.SchemaWrite().indexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), NODE_INDEX_NAME);
                tx.Success();
            }
            Await(index);

            long firstID;
            long secondID;
            long thirdID;

            using (Transaction tx = Db.beginTx())
            {
                firstID  = CreateNodeIndexableByPropertyValue(Label, "Tomtar tomtar oftsat i tomteutstyrsel.");
                secondID = CreateNodeIndexableByPropertyValue(Label, "Olof och Hans");
                SetNodeProp(secondID, "prop2", "och karl");

                Node node3 = Db.createNode(Label);
                thirdID = node3.Id;
                node3.SetProperty("prop2", "Tomtar som inte tomtar ser upp till tomtar som tomtar.");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsIds(ktx, NODE_INDEX_NAME, "tomtar Karl", firstID, secondID, thirdID);
            }
        }
Exemple #19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void slaveShouldMoveToPendingAndThenRecoverIfMasterDiesAndThenRecovers() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SlaveShouldMoveToPendingAndThenRecoverIfMasterDiesAndThenRecovers()
        {
            HighlyAvailableGraphDatabase master   = _cluster.Master;
            HighlyAvailableGraphDatabase theSlave = _cluster.AnySlave;

            string propertyName  = "prop";
            string propertyValue = "value1";
            long   slaveNodeId;

            ClusterManager.RepairKit repairKit = _cluster.fail(master);
            _cluster.await(memberSeesOtherMemberAsFailed(theSlave, master));

            assertEquals(HighAvailabilityMemberState.PENDING, theSlave.InstanceState);

            repairKit.Repair();

            _cluster.await(allSeesAllAsAvailable());

            using (Transaction tx = theSlave.BeginTx())
            {
                Node node = theSlave.CreateNode();
                slaveNodeId = node.Id;
                node.SetProperty(propertyName, propertyValue);
                tx.Success();
            }

            using (Transaction tx = master.BeginTx())
            {
                assertEquals(propertyValue, master.GetNodeById(slaveNodeId).getProperty(propertyName));
                tx.Success();
            }
        }
Exemple #20
0
        internal static void CreateData(GraphDatabaseService db, int size)
        {
            for (int i = 0; i < size; i++)
            {
                Node node1 = Db.createNode(_label);
                Node node2 = Db.createNode(_label);

                node1.SetProperty(PROPERTY_KEY, "svej" + i);
                node2.SetProperty("tjabba", "tjena");
                node1.SetProperty("foobar", "baz_bat");
                node2.SetProperty("foobar", "baz_bat");

                Relationship rel = node1.CreateRelationshipTo(node2, RelationshipType.withName("halla"));
                rel.SetProperty("this", "that");
            }
        }
Exemple #21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void removeAndAddSameProperty()
        public virtual void RemoveAndAddSameProperty()
        {
            Node node = GraphDb.createNode();

            node.SetProperty("foo", "bar");
            NewTransaction();

            node.RemoveProperty("foo");
            node.SetProperty("foo", "bar");
            NewTransaction();
            assertEquals("bar", node.GetProperty("foo"));

            node.SetProperty("foo", "bar");
            node.RemoveProperty("foo");
            NewTransaction();
            assertNull(node.GetProperty("foo", null));
        }
Exemple #22
0
 private static void CreateANode(HighlyAvailableGraphDatabase db, Label label, string value, string property)
 {
     using (Transaction tx = Db.beginTx())
     {
         Node node = Db.createNode(label);
         node.SetProperty(property, value);
         tx.Success();
     }
 }
Exemple #23
0
        private void CreateData()
        {
            Label label = Label.label("toRetry");

            using (Transaction transaction = _database.beginTx())
            {
                Node node = _database.createNode(label);
                node.SetProperty("c", "d");
                transaction.Success();
            }
        }
Exemple #24
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void loadManyProperties()
        public virtual void LoadManyProperties()
        {
            Node node = GraphDb.createNode();

            for (int i = 0; i < 200; i++)
            {
                node.SetProperty("property " + i, "value");
            }
            NewTransaction();
            assertEquals("value", node.GetProperty("property 0"));
        }
Exemple #25
0
 private static void GenerateRandomData(GraphDatabaseAPI database, Label label, string nameProperty)
 {
     for (int i = 0; i < 1000; i++)
     {
         using (Transaction transaction = database.BeginTx())
         {
             Node node = database.CreateNode(label);
             node.SetProperty(nameProperty, "PlanetExpress" + i);
             transaction.Success();
         }
     }
 }
Exemple #26
0
        private void CreateChainOfNodesWithLabelAndProperty(int length, string relationshipName, string labelName, string property, string value)
        {
            RelationshipType relationshipType = RelationshipType.withName(relationshipName);
            Label            label            = Label.label(labelName);
            Node             prev             = null;

            for (int i = 0; i < length; i++)
            {
                Node node = _db.createNode(label);
                node.SetProperty(property, value);
                if (!property.Equals("name"))
                {
                    node.SetProperty("name", labelName + " " + i);
                }
                if (prev != null)
                {
                    prev.CreateRelationshipTo(node, relationshipType);
                }
                prev = node;
            }
        }
Exemple #27
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSetDoubleArrayProperty()
        public virtual void TestSetDoubleArrayProperty()
        {
            using (Transaction ignore = _db.beginTx())
            {
                Node node = _db.createNode();
                for (int i = 0; i < 100; i++)
                {
                    node.SetProperty("foo", new double[] { 0, 0, i, i });
                    assertArrayEquals(new double[] { 0, 0, i, i }, ( double[] )node.GetProperty("foo"), 0.1D);
                }
            }
        }
Exemple #28
0
 private void CreateAliens()
 {
     using (Transaction tx = _db.beginTx())
     {
         for (int i = 0; i < 32; i++)
         {
             Node alien = _db.createNode(_alien);
             alien.SetProperty(SPECIMEN, i / 2);
         }
         tx.Success();
     }
 }
Exemple #29
0
 internal static void CreateTestData(GraphDatabaseService db)
 {
     using (Transaction tx = Db.beginTx())
     {
         Label            label            = Label.label("Label");
         RelationshipType relationshipType = RelationshipType.withName("REL");
         long[]           largeValue       = new long[1024];
         for (int i = 0; i < 1000; i++)
         {
             Node node = Db.createNode(label);
             node.SetProperty("Niels", "Borh");
             node.SetProperty("Albert", largeValue);
             for (int j = 0; j < 30; j++)
             {
                 Relationship rel = node.CreateRelationshipTo(node, relationshipType);
                 rel.SetProperty("Max", "Planck");
             }
         }
         tx.Success();
     }
 }
Exemple #30
0
        private long CreateNodeWithPropertyOn(HighlyAvailableGraphDatabase db, string property, string value)
        {
            using (Transaction tx = Db.beginTx())
            {
                Node node = Db.createNode();
                node.SetProperty(property, value);

                tx.Success();

                return(node.Id);
            }
        }