コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCreateConstraintIndexForSpecifiedProvider() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCreateConstraintIndexForSpecifiedProvider()
        {
            // given
            IndexingService indexingService = mock(typeof(IndexingService));
            StubKernel      kernel          = new StubKernel(this);

            when(_schemaRead.indexGetCommittedId(_indexReference)).thenReturn(INDEX_ID);
            IndexProxy indexProxy = mock(typeof(IndexProxy));

            when(indexingService.GetIndexProxy(INDEX_ID)).thenReturn(indexProxy);
            when(indexingService.getIndexProxy(_descriptor)).thenReturn(indexProxy);
            NodePropertyAccessor    nodePropertyAccessor = mock(typeof(NodePropertyAccessor));
            ConstraintIndexCreator  creator            = new ConstraintIndexCreator(() => kernel, indexingService, nodePropertyAccessor, _logProvider);
            IndexProviderDescriptor providerDescriptor = new IndexProviderDescriptor("Groovy", "1.2");

            // when
            KernelTransactionImplementation transaction = CreateTransaction();

            creator.CreateUniquenessConstraintIndex(transaction, _descriptor, providerDescriptor.Name());

            // then
            assertEquals(1, kernel.Transactions.Count);
            KernelTransactionImplementation transactionInstance = kernel.Transactions[0];

            verify(transactionInstance).indexUniqueCreate(eq(_descriptor), eq(providerDescriptor.Name()));
            verify(_schemaRead).index(_descriptor);
            verify(_schemaRead).indexGetCommittedId(any());
            verifyNoMoreInteractions(_schemaRead);
        }
コード例 #2
0
        private IndexProvider Put(IndexProviderDescriptor providerDescriptor, IndexProvider provider)
        {
            IndexProvider existing = _indexProvidersByDescriptor.putIfAbsent(providerDescriptor, provider);

            if (!_indexProvidersByName.ContainsKey(providerDescriptor.Name()))
            {
                _indexProvidersByName.Add(providerDescriptor.Name(), provider);
            }
            return(existing);
        }
コード例 #3
0
        public override IndexProvider Lookup(IndexProviderDescriptor providerDescriptor)
        {
            AssertInit();
            IndexProvider provider = _indexProvidersByDescriptor[providerDescriptor];

            AssertProviderFound(provider, providerDescriptor.Name());
            return(provider);
        }