Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMatchOnTwoProperties()
        public virtual void ShouldMatchOnTwoProperties()
        {
            // when
            IList <IndexDescriptor> matched = new List <IndexDescriptor>();

            NodeSchemaMatcher.OnMatchingSchema(iterator(Index1_2), UN_INDEXED_PROP_ID, _props, matched.add);

            // then
            assertThat(matched, contains(Index1_2));
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMatchOnSpecialProperty()
        public virtual void ShouldMatchOnSpecialProperty()
        {
            // when
            IList <IndexDescriptor> matched = new List <IndexDescriptor>();

            NodeSchemaMatcher.OnMatchingSchema(iterator(IndexOnSpecialProperty), SPECIAL_PROP_ID, _props, matched.add);

            // then
            assertThat(matched, contains(IndexOnSpecialProperty));
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotMatchIfNodeIsMissingLabel()
        public virtual void ShouldNotMatchIfNodeIsMissingLabel()
        {
            // when
            IList <IndexDescriptor> matched = new List <IndexDescriptor>();

            NodeSchemaMatcher.OnMatchingSchema(iterator(IndexWithMissingLabel), _node.labels().all(), UN_INDEXED_PROP_ID, _props, matched.add);

            // then
            assertThat(matched, empty());
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMatchSeveralTimes()
        public virtual void ShouldMatchSeveralTimes()
        {
            // given
            IList <IndexDescriptor> indexes = Arrays.asList(Index1, Index1, Index1_2, Index1_2);

            // when
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.List<org.neo4j.storageengine.api.schema.IndexDescriptor> matched = new java.util.ArrayList<>();
            IList <IndexDescriptor> matched = new List <IndexDescriptor>();

            NodeSchemaMatcher.OnMatchingSchema(indexes.GetEnumerator(), UN_INDEXED_PROP_ID, _props, matched.add);

            // then
            assertThat(matched, equalTo(indexes));
        }
Ejemplo n.º 5
0
        internal virtual void OnPropertyRemove(NodeCursor node, PropertyCursor propertyCursor, long[] labels, int propertyKeyId, int[] existingPropertyKeyIds, Value value)
        {
            Debug.Assert(NoSchemaChangedInTx());
            ICollection <SchemaDescriptor> indexes = _indexingService.getRelatedIndexes(labels, propertyKeyId, NODE);

            if (indexes.Count > 0)
            {
                MutableIntObjectMap <Value> materializedProperties = IntObjectMaps.mutable.empty();
                NodeSchemaMatcher.OnMatchingSchema(indexes.GetEnumerator(), propertyKeyId, existingPropertyKeyIds, index =>
                {
                    Value[] values = GetValueTuple(node, propertyCursor, propertyKeyId, value, index.schema().PropertyIds, materializedProperties);
                    _read.txState().indexDoUpdateEntry(index.schema(), node.NodeReference(), ValueTuple.of(values), null);
                });
            }
        }
Ejemplo n.º 6
0
        internal virtual void OnPropertyChange(NodeCursor node, PropertyCursor propertyCursor, long[] labels, int propertyKeyId, int[] existingPropertyKeyIds, Value beforeValue, Value afterValue)
        {
            Debug.Assert(NoSchemaChangedInTx());
            ICollection <SchemaDescriptor> indexes = _indexingService.getRelatedIndexes(labels, propertyKeyId, NODE);

            if (indexes.Count > 0)
            {
                MutableIntObjectMap <Value> materializedProperties = IntObjectMaps.mutable.empty();
                NodeSchemaMatcher.OnMatchingSchema(indexes.GetEnumerator(), propertyKeyId, existingPropertyKeyIds, index =>
                {
                    int[] propertyIds   = index.PropertyIds;
                    Value[] valuesAfter = GetValueTuple(node, propertyCursor, propertyKeyId, afterValue, propertyIds, materializedProperties);

                    // The valuesBefore tuple is just like valuesAfter, except is has the afterValue instead of the beforeValue
                    Value[] valuesBefore = valuesAfter.Clone();
                    int k           = ArrayUtils.IndexOf(propertyIds, propertyKeyId);
                    valuesBefore[k] = beforeValue;

                    _indexingService.validateBeforeCommit(index, valuesAfter);
                    _read.txState().indexDoUpdateEntry(index, node.NodeReference(), ValueTuple.of(valuesBefore), ValueTuple.of(valuesAfter));
                });
            }
        }