Ejemplo n.º 1
0
        private void TestDateTypeWithPrecedingInLinedLong(Value value)
        {
            _node1.setProperty("l1", 255);                 // Setting these low bits was triggering a bug in some date types decision on formatting
            string key = "dt";

            _node1.setProperty(key, value);
            NewTransaction();

            object property = _node1.getProperty(key);

            assertEquals(value.AsObjectCopy(), property);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWriteOutThePropertyRecordBeforeReferencingItFromANodeRecord() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldWriteOutThePropertyRecordBeforeReferencingItFromANodeRecord()
        {
            Race race = new Race();

            long[]     latestNodeId = new long[1];
            AtomicLong writes       = new AtomicLong();
            AtomicLong reads        = new AtomicLong();
            long       endTime      = currentTimeMillis() + SECONDS.toMillis(2);

            race.WithEndCondition(() => (writes.get() > 100 && reads.get() > 10_000) || currentTimeMillis() > endTime);
            race.AddContestant(() =>
            {
                using (Transaction tx = Db.beginTx())
                {
                    Node node       = Db.createNode();
                    latestNodeId[0] = node.Id;
                    node.setProperty("largeProperty", LONG_STRING_VALUE);
                    tx.success();
                }
                writes.incrementAndGet();
            });
            race.AddContestant(() =>
            {
                try
                {
                    using (Transaction tx = Db.GraphDatabaseAPI.beginTx())
                    {
                        Node node = Db.GraphDatabaseAPI.getNodeById(latestNodeId[0]);

                        foreach (string propertyKey in node.PropertyKeys)
                        {
                            node.getProperty(propertyKey);
                        }
                        tx.success();
                    }
                }
                catch (NotFoundException e)
                {
                    if (Exceptions.contains(e, typeof(InvalidRecordException)))
                    {
                        throw e;
                    }
                }
                reads.incrementAndGet();
            });
            race.Go();
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWriteOutTheDynamicChainBeforeUpdatingThePropertyRecord() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldWriteOutTheDynamicChainBeforeUpdatingThePropertyRecord()
        {
            Race race = new Race();

            long[]     latestNodeId = new long[1];
            AtomicLong writes       = new AtomicLong();
            AtomicLong reads        = new AtomicLong();
            long       endTime      = currentTimeMillis() + SECONDS.toMillis(2);

            race.WithEndCondition(() => (writes.get() > 100 && reads.get() > 10_000) || currentTimeMillis() > endTime);
            race.AddContestant(() =>
            {
                using (Transaction tx = Db.beginTx())
                {
                    Node node       = Db.createNode();
                    latestNodeId[0] = node.Id;
                    node.setProperty("largeProperty", LONG_STRING_VALUE);
                    tx.success();
                }
                writes.incrementAndGet();
            });
            race.AddContestant(() =>
            {
                try
                {
                    using (Transaction tx = Db.GraphDatabaseAPI.beginTx())
                    {
                        Node node = Db.GraphDatabaseAPI.getNodeById(latestNodeId[0]);
                        foreach (string propertyKey in node.PropertyKeys)
                        {
                            node.getProperty(propertyKey);
                        }
                        tx.success();
                    }
                }
                catch (NotFoundException)
                {
                    // This will catch nodes not found (expected) and also PropertyRecords not found (shouldn't happen
                    // but handled in shouldWriteOutThePropertyRecordBeforeReferencingItFromANodeRecord)
                }
                reads.incrementAndGet();
            });
            race.Go();
        }