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 testIndexFlip()
        public virtual void TestIndexFlip()
        {
            IndexProxyFactory       indexProxyFactory       = mock(typeof(IndexProxyFactory));
            FailedIndexProxyFactory failedIndexProxyFactory = mock(typeof(FailedIndexProxyFactory));
            FlippableIndexProxy     flipper = new FlippableIndexProxy();

            flipper.FlipTarget = indexProxyFactory;

            IndexPopulator indexPopulator1 = CreateIndexPopulator();
            IndexPopulator indexPopulator2 = CreateIndexPopulator();

            AddPopulator(indexPopulator1, 1, flipper, failedIndexProxyFactory);
            AddPopulator(indexPopulator2, 2, flipper, failedIndexProxyFactory);

            when(indexPopulator1.SampleResult()).thenThrow(SampleError);

            _multipleIndexPopulator.indexAllEntities();
            _multipleIndexPopulator.flipAfterPopulation(false);

            verify(indexPopulator1).close(false);
            verify(failedIndexProxyFactory, times(1)).create(any(typeof(Exception)));

            verify(indexPopulator2).close(true);
            verify(indexPopulator2).sampleResult();
            verify(_indexStoreView).replaceIndexCounts(anyLong(), anyLong(), anyLong(), anyLong());
            verify(_schemaState).clear();
        }
Exemplo n.º 2
0
        private static IndexPopulator AddPopulator(BatchingMultipleIndexPopulator batchingPopulator, IndexDescriptor descriptor)
        {
            IndexPopulator populator = mock(typeof(IndexPopulator));

            IndexProxyFactory       indexProxyFactory       = mock(typeof(IndexProxyFactory));
            FailedIndexProxyFactory failedIndexProxyFactory = mock(typeof(FailedIndexProxyFactory));
            FlippableIndexProxy     flipper = new FlippableIndexProxy();

            flipper.FlipTarget = indexProxyFactory;

            batchingPopulator.AddPopulator(populator, descriptor.WithId(1).withoutCapabilities(), flipper, failedIndexProxyFactory, "testIndex");

            return(populator);
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotBeAbleToFlipAfterDrop() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotBeAbleToFlipAfterDrop()
        {
            //GIVEN
            IndexProxy        actual = mockIndexProxy();
            IndexProxy        failed = mockIndexProxy();
            IndexProxyFactory indexContextFactory = mock(typeof(IndexProxyFactory));

            FlippableIndexProxy @delegate = new FlippableIndexProxy(actual);

            @delegate.FlipTarget = indexContextFactory;

            //WHEN
            @delegate.Drop();

            //THEN
            ExpectedException.expect(typeof(IndexProxyAlreadyClosedKernelException));
            @delegate.Flip(NoOp(), SingleFailedDelegate(failed));
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldVerifyConstraintsBeforeFlippingIfToldTo() throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldVerifyConstraintsBeforeFlippingIfToldTo()
        {
            // given
            IndexProxyFactory       indexProxyFactory       = mock(typeof(IndexProxyFactory));
            FailedIndexProxyFactory failedIndexProxyFactory = mock(typeof(FailedIndexProxyFactory));
            FlippableIndexProxy     flipper = new FlippableIndexProxy();

            flipper.FlipTarget = indexProxyFactory;
            IndexPopulator indexPopulator = CreateIndexPopulator();

            AddPopulator(indexPopulator, 1, flipper, failedIndexProxyFactory);
            when(indexPopulator.SampleResult()).thenReturn(new IndexSample());

            // when
            _multipleIndexPopulator.indexAllEntities();
            _multipleIndexPopulator.flipAfterPopulation(true);

            // then
            verify(indexPopulator).verifyDeferredConstraints(any(typeof(NodePropertyAccessor)));
            verify(indexPopulator).close(true);
        }