Пример #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()
        {
            Dictionary <int, Value> map = new Dictionary <int, Value>();

            map[PROP_ID1]           = stringValue("hello");
            map[PROP_ID2]           = stringValue("world");
            map[UN_INDEXED_PROP_ID] = stringValue("!");
            _node = new StubNodeCursor(false);
            _node.withNode(42, new long[] { LABEL_ID1 }, map);
            _node.next();
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup() throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Setup()
        {
            _txState = mock(typeof(TransactionState));

            Dictionary <int, Value> map = new Dictionary <int, Value>();

            map[PROP_ID1] = Values.of("hi1");
            map[PROP_ID2] = Values.of("hi2");
            map[PROP_ID3] = Values.of("hi3");
            _node         = (new StubNodeCursor()).withNode(0, new long[] { LABEL_ID1, LABEL_ID2 }, map);
            _node.next();

            _propertyCursor = new StubPropertyCursor();

            Read readOps = mock(typeof(Read));

            when(readOps.TxState()).thenReturn(_txState);

            IndexingService indexingService = mock(typeof(IndexingService));
            IndexProxy      indexProxy      = mock(typeof(IndexProxy));

            when(indexingService.getIndexProxy(any(typeof(SchemaDescriptor)))).thenReturn(indexProxy);
            when(indexingService.getRelatedIndexes(any(), anyInt(), any())).thenAnswer(invocationOnMock =>
            {
                long[] labels     = invocationOnMock.getArgument(0);
                int propertyKeyId = invocationOnMock.getArgument(1);
                ISet <SchemaDescriptor> descriptors = new HashSet <SchemaDescriptor>();
                foreach (IndexDescriptor index in _indexes)
                {
                    if (contains(labels, index.schema().keyId()) && contains(index.schema().PropertyIds, propertyKeyId))
                    {
                        descriptors.add(index.schema());
                    }
                }
                return(descriptors);
            });
            when(indexingService.getRelatedIndexes(any(), any(typeof(int[])), any())).thenAnswer(invocationOnMock =>
            {
                long[] labels        = invocationOnMock.getArgument(0);
                int[] propertyKeyIds = invocationOnMock.getArgument(1);
                ISet <SchemaDescriptor> descriptors = new HashSet <SchemaDescriptor>();
                foreach (IndexDescriptor index in _indexes)
                {
                    if (contains(labels, index.schema().keyId()))
                    {
                        bool containsAll = true;
                        foreach (int propertyId in index.schema().PropertyIds)
                        {
                            containsAll &= contains(propertyKeyIds, propertyId);
                        }
                        if (containsAll)
                        {
                            descriptors.add(index.schema());
                        }
                    }
                }
                return(descriptors);
            });

            _indexTxUpdater = new IndexTxStateUpdater(readOps, indexingService);
        }