Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testStringPrefix_SomeValues()
        public virtual void TestStringPrefixSomeValues()
        {
            StringPrefixPredicate p = IndexQuery.StringPrefix(_propId, stringValue("dog"));

            assertFalse(Test(p, "doffington"));
            assertFalse(Test(p, "doh, not this again!"));
            assertTrue(Test(p, "dog"));
            assertTrue(Test(p, "doggidog"));
            assertTrue(Test(p, "doggidogdog"));
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPrefixScanInOrder() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPrefixScanInOrder()
        {
            IList <Pair <long, Value> > expected = new List <Pair <long, Value> >();

            using (Transaction tx = beginTransaction())
            {
                expected.Add(NodeWithProp(tx, "bee hive"));
                NodeWithProp(tx, "a");
                expected.Add(NodeWithProp(tx, "become"));
                expected.Add(NodeWithProp(tx, "be"));
                expected.Add(NodeWithProp(tx, "bachelor"));
                NodeWithProp(tx, "street smart");
                expected.Add(NodeWithProp(tx, "builder"));
                NodeWithProp(tx, "ceasar");
                tx.Success();
            }

            CreateIndex();

            // when
            using (Transaction tx = beginTransaction())
            {
                int            label = tx.TokenRead().nodeLabel("Node");
                int            prop  = tx.TokenRead().propertyKey("prop");
                IndexReference index = tx.SchemaRead().index(label, prop);

                using (NodeValueIndexCursor cursor = tx.Cursors().allocateNodeValueIndexCursor())
                {
                    NodeWithProp(tx, "allow");
                    expected.Add(NodeWithProp(tx, "bastard"));
                    expected.Add(NodeWithProp(tx, "bully"));
                    NodeWithProp(tx, "willow");

                    IndexQuery query = IndexQuery.StringPrefix(prop, stringValue("b"));
                    tx.DataRead().nodeIndexSeek(index, cursor, IndexOrder, true, query);

                    AssertResultsInOrder(expected, cursor);
                }
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPerformStringPrefixSearch() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPerformStringPrefixSearch()
        {
            // given
            ISet <Pair <long, Value> > expected = new HashSet <Pair <long, Value> >();

            using (Transaction tx = beginTransaction())
            {
                expected.Add(NodeWithProp(tx, "suff1"));
                NodeWithPropId(tx, "supp");
                tx.Success();
            }

            CreateIndex();

            // when
            using (Transaction tx = beginTransaction())
            {
                int label = tx.TokenRead().nodeLabel("Node");
                int prop  = tx.TokenRead().propertyKey("prop");
                expected.Add(NodeWithProp(tx, "suff2"));
                NodeWithPropId(tx, "skruff");
                IndexReference index = tx.SchemaRead().index(label, prop);

                AssertNodeAndValueForSeek(expected, tx, index, NeedsValues, "suffpa", IndexQuery.StringPrefix(prop, stringValue("suff")));
            }
        }
Exemplo n.º 4
0
        // STRING PREFIX

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testStringPrefix_FalseForIrrelevant()
        public virtual void TestStringPrefixFalseForIrrelevant()
        {
            StringPrefixPredicate p = IndexQuery.StringPrefix(_propId, stringValue("dog"));

            AssertFalseForOtherThings(p);
        }