コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            KernelTransaction transaction = mock(typeof(KernelTransaction));

            _tokenRead  = mock(typeof(TokenRead));
            _schemaRead = mock(typeof(SchemaRead));
            _procedure  = new IndexProcedures(transaction, null);

            when(transaction.TokenRead()).thenReturn(_tokenRead);
            when(transaction.SchemaRead()).thenReturn(_schemaRead);
            _indexingService = mock(typeof(IndexingService));
            _procedure       = new IndexProcedures(transaction, _indexingService);
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotReindexNodesWhenDefaultAnalyzerIsChanged() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotReindexNodesWhenDefaultAnalyzerIsChanged()
        {
            long firstID;
            long secondID;

            ApplySetting(FulltextConfig.FulltextDefaultAnalyzer, ENGLISH);
            SchemaDescriptor descriptor = FulltextAdapter.schemaFor(NODE, new string[] { Label.name() }, Settings, PROP);
            IndexReference   nodes;

            using (KernelTransactionImplementation transaction = KernelTransaction)
            {
                SchemaWrite schemaWrite = transaction.SchemaWrite();
                nodes = schemaWrite.IndexCreate(descriptor, FulltextIndexProviderFactory.Descriptor.name(), "nodes");
                transaction.Success();
            }
            Await(nodes);

            using (Transaction tx = Db.beginTx())
            {
                firstID  = CreateNodeIndexableByPropertyValue(Label, "Hello and hello again, in the end.");
                secondID = CreateNodeIndexableByPropertyValue(Label, "En apa och en tomte bodde i ett hus.");

                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                KernelTransaction ktx = KernelTransaction(tx);
                AssertQueryFindsNothing(ktx, "nodes", "and");
                AssertQueryFindsNothing(ktx, "nodes", "in");
                AssertQueryFindsNothing(ktx, "nodes", "the");
                AssertQueryFindsIds(ktx, "nodes", "en", secondID);
                AssertQueryFindsIds(ktx, "nodes", "och", secondID);
                AssertQueryFindsIds(ktx, "nodes", "ett", secondID);
            }

            ApplySetting(FulltextConfig.FulltextDefaultAnalyzer, SWEDISH);
            using (KernelTransactionImplementation ktx = KernelTransaction)
            {
                SchemaRead schemaRead = ktx.SchemaRead();
                Await(schemaRead.IndexGetForName("nodes"));
                // These results should be exactly the same as before the configuration change and restart.
                AssertQueryFindsNothing(ktx, "nodes", "and");
                AssertQueryFindsNothing(ktx, "nodes", "in");
                AssertQueryFindsNothing(ktx, "nodes", "the");
                AssertQueryFindsIds(ktx, "nodes", "en", secondID);
                AssertQueryFindsIds(ktx, "nodes", "och", secondID);
                AssertQueryFindsIds(ktx, "nodes", "ett", secondID);
            }
        }